filefisher.FileFinder.create_file_name#
- FileFinder.create_file_name(keys=None, **keys_kwargs)#
build file name from keys
- Parameters:
keys (dict) – Dictionary containing keys to create the file name.
**keys_kwargs ({key: indexer, …}, optional) – The keyword arguments form of
keys. When the same key is passed inkeysandkeys_kwargsthe latter takes priority.
Examples
>>> path_pattern = "/root/{category}" >>> file_pattern = "{category}_file_{number}"
>>> ff = FileFinder(path_pattern, file_pattern) >>> ff.create_file_name(category="foo", number=1) 'foo_file_1'
>>> ff.create_file_name(dict(category="foo", number=1)) 'foo_file_1'
>>> ff.create_file_name(dict(category="foo", number=1), category="bar") 'bar_file_1'