filefisher.FileFinder.create_path_name

filefisher.FileFinder.create_path_name#

FileFinder.create_path_name(keys=None, **keys_kwargs)#

build path (folder) name from keys

Parameters:
  • keys (dict) – Dictionary containing keys to create the path (folder) name.

  • **keys_kwargs ({key: indexer, …}, optional) – The keyword arguments form of keys. When the same key is passed in keys and keys_kwargs the latter takes priority.

Examples

>>> path_pattern = "/root/{category}"
>>> file_pattern = "{category}_file_{number}"
>>> ff = FileFinder(path_pattern, file_pattern)
>>> ff.create_path_name(category="foo")
'/root/foo/'
>>> ff.create_path_name(dict(category="foo"))
'/root/foo/'
>>> ff.create_path_name(dict(category="foo"), category="bar")
'/root/bar/'