productionsystem.singleton module

Singleton Utility Module.

exception productionsystem.singleton.InstantiationError(*args, **kwargs)

Bases: exceptions.RuntimeError

Instantiation exception.

class productionsystem.singleton.SingletonMeta

Bases: type

Singleton 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