morpheus.utils.file_utils
File utilities for Morpheus
Functions
<a href="#morpheus.utils.file_utils.date_extractor">date_extractor</a> (file_object, filename_regex) |
Date is extracted from a file name using a specified regex pattern by this function. |
<a href="#morpheus.utils.file_utils.get_data_file_path">get_data_file_path</a> (data_filename) |
Get data file path. |
<a href="#morpheus.utils.file_utils.load_labels_file">load_labels_file</a> (labels_filename) |
Get list of labels from file. |
- date_extractor(file_object, filename_regex)[source]
Date is extracted from a file name using a specified regex pattern by this function. If there is no match with the pattern, extracts the modified or creation timestamp from the file.
- Parameters
- file_objectfsspec.core.OpenFile
File object
- filename_regexre.Pattern
Filename regex.
- Returns
- datetime
Extracted timestamp
- get_data_file_path(data_filename)[source]
Get data file path. Also handles paths relative to Morpheus root.
- Parameters
- data_filenamestr
Absolute or relative path of data file.
- Returns
- str
Data file path.
- load_labels_file(labels_filename)[source]
Get list of labels from file.
- Parameters
- labels_filenamestr
Labels file path
- Returns
- list[str]
List of labels