my_code_base.filehandling.utils¶
Module Contents¶
- my_code_base.filehandling.utils.check_input_for_duplicates(func)[source]¶
A decorator that checks a list of file paths for duplicates before processing them.
- This decorator takes a function as input and returns a wrapped function that performs the following steps:
Checks if the input is a list and contains more than one element.
Compares each pair of file paths in the list using the os.stat signatures (file type, size, and modification time).
Removes any duplicates from the list.
Calls the original function with the cleaned-up list of file paths.
- Parameters:
(function) (func)
- Returns:
function
- Return type:
The wrapped function.
Example
>>> pytest.skip() >>> @check_input_for_duplicates >>> def process_files(file_list): >>> # Process the files >>> pass
Note
The wrapped function can still be parsed by Sphinx due to the
functools.wrapsdecorator.