yasmin.blackboard module
- class yasmin.blackboard.Blackboard(init: Dict[str, Any] | None = None)
Bases:
object
A thread-safe blackboard for storing key-value pairs.
The Blackboard class provides a mechanism to store data in a dictionary-like format, allowing for concurrent access and modification through thread-safe operations.
- Attributes:
_data (Dict[str, Any]): A dictionary holding the data stored in the blackboard. __lock (Lock): A threading lock to ensure thread-safe access to the _data attribute.
- Methods:
__getitem__(key): Retrieve a value associated with the given key. __setitem__(key, value): Set a value for the given key. __delitem__(key): Remove the value associated with the given key. __contains__(key): Check if a key exists in the blackboard. __len__(): Return the number of items in the blackboard. __repr__(): Return a string representation of the blackboard’s data.