register_project_io

glotaran.plugin_system.project_io_registration.register_project_io(format_names: str | list[str]) Callable[[type[ProjectIoInterface]], type[ProjectIoInterface]][source]

Register project io plugins to one or more formats.

Decorate a project io plugin class with @register_project_io(format_name|[*format_names]) to add it to the registry.

Parameters:

format_names (str | list[str]) – Name of the project io plugin under which it is registered.

Returns:

Inner decorator function.

Return type:

Callable[[type[ProjectIoInterface]], type[ProjectIoInterface]]

Examples

>>> @register_project_io("my_format_1")
... class MyProjectIo1(ProjectIoInterface):
...     pass
>>> @register_project_io(["my_format_1", "my_format_1_alias"])
... class MyProjectIo2(ProjectIoInterface):
...     pass