Skip to content

InteroperableRegistry

autogen.interop.registry.InteroperableRegistry #

InteroperableRegistry()
Source code in autogen/interop/registry.py
def __init__(self) -> None:
    self._registry: dict[str, type[Interoperable]] = {}

register #

register(short_name, cls)
Source code in autogen/interop/registry.py
def register(self, short_name: str, cls: InteroperableClass) -> InteroperableClass:
    if short_name in self._registry:
        raise ValueError(f"Duplicate registration for {short_name}")

    self._registry[short_name] = cls

    return cls

get_short_names #

get_short_names()
Source code in autogen/interop/registry.py
def get_short_names(self) -> list[str]:
    return sorted(self._registry.keys())

get_supported_types #

get_supported_types()
Source code in autogen/interop/registry.py
def get_supported_types(self) -> list[str]:
    short_names = self.get_short_names()
    supported_types = [name for name in short_names if self._registry[name].get_unsupported_reason() is None]
    return supported_types

get_class #

get_class(short_name)
Source code in autogen/interop/registry.py
def get_class(self, short_name: str) -> type[Interoperable]:
    return self._registry[short_name]

get_instance classmethod #

get_instance()
Source code in autogen/interop/registry.py
@classmethod
def get_instance(cls) -> "InteroperableRegistry":
    return _register