DataInterfaceStore#

class DataInterfaceStore(*args)#

Bases: MutableMapping[str, _V]

Mapping of registered interfaces.

Interface classes are stored using their unique ID, or SHORTNAME if not defined. They can be retrieved using ID or SHORTNAME, as preferred.

Parameters:

args (_V | str)

add(di, name=None)#

Register an interface subclass.

Will register it under: - name if supplied - DataInterface.ID if defined - DataInterface.SHORTNAME if defined

If the SHORTNAME attribute is defined, an alias will be stored in InterfaceStore.shortnames, and the interface can either be accessed with its ID or shortname.

Parameters:
  • di (_V | str) – The interface class to register, or a fully qualified import string. The interface would then be imported when accessed.

  • name (str | None) – Use this instead of the ID.

Return type:

None

get_no_import(key)#

Retrieve interface without importing it if a string.

Parameters:

key (str)

Return type:

_V | str

register(name=None)#

Decorator to register an interface.

Parameters:

name (str | None)

Return type:

Callable[[_V], _V]

shortnames: dict[str, list[str]]#

Mapping of shortnames to dict keys (the ID by default).