openfl.utilities.types.SingletonABCMeta
- class openfl.utilities.types.SingletonABCMeta(name, bases, namespace, **kwargs)
Bases:
ABCMetaMetaclass for singleton instances.
This metaclass ensures that only one instance of any class using it can be created.
- Class Attributes:
_instances (dict) – A dictionary mapping classes to their instances.
Methods
Return a type's method resolution order.
Register a virtual subclass of an ABC.
- __call__(*args, **kwargs)
Use the singleton instance if it has already been created.
- Parameters:
*args – Positional arguments to pass to the class constructor.
**kwargs – Keyword arguments to pass to the class constructor.
- Returns:
Any – The singleton instance of the class.
- mro()
Return a type’s method resolution order.
- register(subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.