Registries¶
- class schemashift.Registry[source]¶
Bases:
ABCAbstract base registry for FormatConfig objects.
- abstractmethod delete(name)[source]¶
Remove the config with the given name.
Returns True if the config existed and was removed, False otherwise.
- Return type:
- abstractmethod get(name)[source]¶
Return the config with the given name, or None if not found.
- Return type:
- class schemashift.DictRegistry[source]¶
Bases:
RegistryIn-memory registry suitable for testing and embedded use.
- delete(name)[source]¶
Remove the config with the given name.
Returns True if the config existed and was removed, False otherwise.
- Return type:
- load_schema(name=None)¶
Load a target schema associated with this registry, if supported.
- Return type:
- class schemashift.FileSystemRegistry(path)[source]¶
Bases:
RegistryStores configs as JSON files under a directory.
Each config is persisted as
{directory}/{name}.json.- delete(name)[source]¶
Remove the config with the given name.
Returns True if the config existed and was removed, False otherwise.
- Return type:
- load_schema(name=None)[source]¶
Load a TargetSchema from the schemas/ subdirectory.
If name is provided, loads
{schemas_dir}/{name}.yaml(falling back to.yml). If name isNoneand exactly one schema file exists, returns it. ReturnsNoneif theschemas/directory does not exist, is empty, or the named file is not found.- Raises:
ValueError – If multiple schemas exist and no explicit name is given.
- Return type: