Module agents.event_bus
Classes
class EventBus-
Expand source code
class EventBus(EventEmitter[EventTypes]): _instance = None def __new__(cls): if cls._instance is None: cls._instance = super(EventBus, cls).__new__(cls) cls._instance._initialized = False return cls._instance def __init__(self): if not self._initialized: super().__init__() self._initialized = True @classmethod def get_instance(cls) -> 'EventBus': return cls()Abstract base class for generic types.
On Python 3.12 and newer, generic classes implicitly inherit from Generic when they declare a parameter list after the class's name::
class Mapping[KT, VT]: def __getitem__(self, key: KT) -> VT: ... # Etc.On older versions of Python, however, generic classes have to explicitly inherit from Generic.
After a class has been declared to be generic, it can then be used as follows::
def lookup_name[KT, VT](mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return defaultAncestors
- EventEmitter
- typing.Generic
Static methods
def get_instance() ‑> EventBus