7.1.3.7. Singleton

Implement Singleton

class BookBrowser.Common.Singleton.SingletonMetaClass(class_name, super_classes, class_attribute_dict)[source]

Bases: type

A singleton metaclass.

This implementation supports subclassing and is thread safe.

__call__(*args, **kwargs)[source]

Call self as a function.

__init__(class_name, super_classes, class_attribute_dict)[source]

Initialize self. See help(type(self)) for accurate signature.

class BookBrowser.Common.Singleton.monostate[source]

Bases: object

A monostate base class.

static __new__(cls, *args, **kwargs)[source]

Create and return a new object. See help(type) for accurate signature.

_shared_state = {}
class BookBrowser.Common.Singleton.singleton(cls)[source]

Bases: object

A singleton class decorator.

This implementation doesn’t support subclassing.

__call__(*args, **kwargs)[source]

Call self as a function.

__init__(cls)[source]

Initialize self. See help(type(self)) for accurate signature.

BookBrowser.Common.Singleton.singleton_func(cls)[source]

A singleton function decorator.

This implementation doesn’t support subclassing.