medcat.utils.registry ===================== .. py:module:: medcat.utils.registry Attributes ---------- .. autoapisummary:: medcat.utils.registry.logger medcat.utils.registry.P Exceptions ---------- .. autoapisummary:: medcat.utils.registry.MedCATRegistryException Classes ------- .. autoapisummary:: medcat.utils.registry.Registry Module Contents --------------- .. py:data:: logger .. py:data:: P .. py:class:: Registry(type, lazy_defaults = None) Bases: :py:obj:`Generic`\ [\ :py:obj:`P`\ ] Abstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default .. py:method:: __init__(type, lazy_defaults = None) .. py:attribute:: _components :type: dict[str, Callable[Ellipsis, P]] .. py:attribute:: _type .. py:attribute:: _lazy_defaults .. py:method:: register(component_name, creator) .. py:method:: get_component(component_name) Get the component that's registered. The component generally refers to the class, but may be another method that creates the object needed. :param component_name: The name of the component. :type component_name: str :raises MedCATRegistryException: If no component by requested name is registered. :Returns: **Callable[..., P]** -- The creator for the registered component. .. py:method:: _ensure_lazy_default(component_name) .. py:method:: register_all_defaults() Register all default (lazily-added) components. .. py:method:: list_components() List all available component names and class names. :Returns: **list[tuple[str, str]]** -- The list of the names and class names for each registered componetn. .. py:method:: unregister_component(component_name) Unregister a component. :param component_name: The component name. :type component_name: str :raises MedCATRegistryException: If no component by the name specified had been registered. :Returns: **Callable[..., P]** -- The creator of the component. .. py:method:: unregister_all_components() Unregister all components. .. py:method:: __contains__(component_name) .. py:method:: __getitem__(component_name) .. py:attribute:: __slots__ :value: () .. py:attribute:: _is_protocol :value: False .. py:method:: __class_getitem__(params) :classmethod: .. py:method:: __init_subclass__(*args, **kwargs) :classmethod: .. py:exception:: MedCATRegistryException(*args) Bases: :py:obj:`Exception` Common base class for all non-exit exceptions. .. py:method:: __init__(*args) Initialize self. See help(type(self)) for accurate signature. .. py:class:: __cause__ exception cause .. py:class:: __context__ exception context .. py:method:: __delattr__() Implement delattr(self, name). .. py:method:: __dir__() Default dir() implementation. .. py:method:: __eq__() Return self==value. .. py:method:: __format__() Default object formatter. .. py:method:: __ge__() Return self>=value. .. py:method:: __getattribute__() Return getattr(self, name). .. py:method:: __gt__() Return self>value. .. py:method:: __hash__() Return hash(self). .. py:method:: __le__() Return self<=value. .. py:method:: __lt__() Return self