file_loadable_field

glotaran.project.dataclass_helpers.file_loadable_field(targetClass: type[FileLoadable], *, is_wrapper_class=False) FileLoadable[source]

Create a dataclass field which can be and object of type targetClass or file path.

Parameters:
  • targetClass (type[FileLoadable]) – Class the resulting value should be an instance of.

  • is_wrapper_class (bool) – Whether or not targetClass is a wrapper class, so the isinstance check will be ignored and instead the responsibility for supported types lies at the implementation of the loader.

Notes

This also requires to add init_file_loadable_fields in the __post_init__ method.

Returns:

Instance of targetClass.

Return type:

FileLoadable