productionsystem.singleton module¶
Singleton Utility Module.
-
exception
productionsystem.singleton.InstantiationError(*args, **kwargs)¶ Bases:
exceptions.RuntimeErrorInstantiation exception.
-
class
productionsystem.singleton.SingletonMeta¶ Bases:
typeSingleton MetaClass.
This can be used either with the static variable __metaclass__ or indirectly through the singleton class decorator see help(singleton).
- Examples:
>>> class test(object): >>> __metaclass__ = SingletonMeta
-
get_instance(*args, **kwargs)¶ Get instance.
-
setup(*args, **kwargs)¶ Initialise the instance.
-
productionsystem.singleton.singleton(cls)¶ Singleton class decorator.
A class decorator rendering the decorated class a singleton.
- Examples:
>>> @singleton >>> class test(object): >>> pass