register_data_io

glotaran.plugin_system.data_io_registration.register_data_io(format_names: str | list[str]) Callable[[type[DataIoInterface]], type[DataIoInterface]][source]

Register data io plugins to one or more formats.

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

Parameters:

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

Returns:

Inner decorator function.

Return type:

Callable[[type[DataIoInterface]], type[DataIoInterface]]

Examples

>>> @register_data_io("my_format_1")
... class MyDataIo1(DataIoInterface):
...     pass
>>> @register_data_io(["my_format_1", "my_format_1_alias"])
... class MyDataIo2(DataIoInterface):
...     pass