Singleton class
This metatclass creates Singleton objects by ensuring only one instance is created and any call is directed to that instance. The mro() function and following dunders, EXCEPT __call__, are inherited from the the stdlib Python library, which defines the “type” class.
Methods
- def mro(self, /)
- Return a type’s method resolution order.
Special methods
- def __call__(cls, *args, **kwargs)
- def __dir__(self, /)
- Specialized __dir__ implementation for types.
- def __format__(self, format_spec, /)
- Default object formatter.
- def __instancecheck__(self, instance, /)
- Check if an object is an instance.
- def __or__(self, value, /)
- Return self|value.
- def __prepare__() -> dict
- def __ror__(self, value, /)
- Return value|self.
- def __sizeof__(self, /)
- Return memory consumption of the type object.
- def __subclasscheck__(self, subclass, /)
- Check if a class is a subclass.
- def __subclasses__(self, /)
- Return a list of immediate subclasses.
Method documentation
def habitat. core. utils. Singleton. __format__(self, format_spec, /)
Default object formatter.
Return str(self) if format_spec is empty. Raise TypeError otherwise.