register_filename_validator

namefiles.register_filename_validator(filename_validator: namefiles.JsonschemaValidator) bool

Registers file naming convention. Does not override existing file naming conventions.

Parameters

filename_validator

Raises
  • TypeError – If validator doesn’t provide a schema attribute, meaning it doesn’t implement JsonschemaValidator.

  • AttributeError – If ‘name’ is missing within the file naming convention.

Warning

This function doesn’t override already registered filename conventions. If the convention name is already occupied this function returns False. Check the functions return value and decide how to react on it.

Warning

This function doesn’t check the full validity of the custom file naming convention. Whether your custom file naming convention runs or not should be tested using standard python testing environments. Use this function, if you know what you are doing.

Returns

True if the naming convention is registered using the name of this convention, or False if the name was already occupied.

Return type

bool