MetaBaseBackend

class sherpa.plot.backends.MetaBaseBackend(name, bases, dct)[source] [edit on github]

Bases: type

Metaclass to operate a registry of backends

When any class that uses this metaclass is defined (i.e. the module is imported) then the class is added to the global sherpa.plot.backends.PLOT_BACKENDS dictionary using the class name or, if defined the "name" attribute of that class as key. If the key is already in use, a warning is issued and the class is not added.

This simple metaclass mimics the behavior of entrypoints to some degree: It is a registry of classes that provide a certain functionality. However, classes are only added to this registry when they are imported, so we need a manual import statement somewhere. Entrypoints could do that for an installed package, even those outside of Sherpa. However, the required importlib.metadata was added only in Python 3.10 to the standard library, so for now we prefer this home-grown solution that can give Sherpa most of the functionality with no new dependencies.

Methods Summary

mro()

Return a type's method resolution order.

Methods Documentation

mro()

Return a type’s method resolution order.