get_filename_validator

namefiles.get_filename_validator(convention_name: Optional[str] = None) namefiles.JsonschemaValidator

Returns a filename validator for applying the file naming convention.

Parameters

convention_name – The registered conventions name.

Returns

JsonschemaValidator

Raises

KeyError – On missing convention for requested name.

Examples

>>> from namefiles import get_filename_validator, STANDARD_CONVENTION_NAME
>>> type(get_filename_validator())
<class 'jsonschema.validators.create.<locals>.Validator'>
>>> get_filename_convention("not existing")
Traceback (most recent call last):
...
KeyError: "No file naming convention named by 'not existing' could be found."