renamerename.handlers.filetransformation
¶
Utility classes for mapping source filenames to target filenames.
Module Contents¶
Classes¶
Wrapper class as dictionary or mapping of source filename to target filename. |
- class renamerename.handlers.filetransformation.FileTransformation(transformations: dict)¶
Bases:
collections.abc.MutableMapping
Wrapper class as dictionary or mapping of source filename to target filename.
Constructor
- Parameters
transformations (dict) – mapping of source to target filenames
- Raises
TypeError – type of parameter given is not a dict
- __setitem__(self, key, value)¶
- __getitem__(self, key)¶
- __delitem__(self, key)¶
- __iter__(self)¶
- __len__(self)¶
- __str__(self)¶
Return str(self).
- __repr__(self)¶
Return repr(self).
- classmethod from_list(cls, filenames: List[str]) FileTransformation ¶
Construct FileTransformation instance from a list of filenames by mapping each filename to itself.
- Parameters
filenames (List[str]) – list of filenames to wrap as a transformation
- Returns
mapping of filenames to themselves
- Return type
- get_reversed(self) Dict[str, List[str]] ¶
Reverse mapping of source to target filenames, while maintain information on duplicate target filenames
- Returns
mapping of target to list of source filenames
- Return type
Dict[str: List[str]]
- has_duplicates(self) bool ¶
Check if target filenames contain duplicates.
- Returns
truth value whether some target filenames are duplicates
- Return type
bool