gemseo / utils

Show inherited members

base_multiton module

Implementation of the multiton design pattern.

class gemseo.utils.base_multiton.BaseABCMultiton(name, bases, namespace, **kwargs)[source]

Bases: ABCMeta, BaseMultiton

A metaclass of abstract classes implementing the multiton design pattern.

class gemseo.utils.base_multiton.BaseMultiton(class_name, class_bases, class_dict)[source]

Bases: GoogleDocstringInheritanceMeta

A metaclass implementing the multiton design pattern.

See Multiton.

As opposed to the functools.lru_cache, the objects built from this metaclass can be pickled.

This metaclass has a cache which is a mapping of classes to class instances. When instantiating a class, if an instance has already been created for this class, then the cached instance is used, otherwise a new instance is created and stored into the cache.

Parameters:
classmethod clear_cache()[source]

Clear the cache.

Return type:

None