PathManager#
- class do_dpc.utils.path_manager.PathManager(base_dir=None)[source]#
Bases:
objectManages file paths and directories, ensuring they exist and formatting filenames.
Responsibilities: - Provides paths for logs, data, and other files. - Ensures necessary folders exist. - Adds timestamps to filenames when needed.
- logger#
Logger instance for logging information and errors.
- Type:
logging.Logger
- base_dir#
Base directory for logs and data.
- Type:
Path
- log_dir#
Directory path for log files.
- Type:
Path
- data_dir#
Directory path for data files.
- Type:
Path
- Parameters:
base_dir (Path, optional) – Base directory for logs and data. Defaults to the current working directory.
- Raises:
ValueError – If base_dir is not a valid directory path.
Methods#
get_data_path#
- do_dpc.utils.path_manager.PathManager.get_data_path(self, filename, with_date=False)#
Returns the full path for a data file.
- Parameters:
filename (str) – Name of the data file.
with_date (bool, optional) – If True, prepends the date in YYYY-MM-DD format to the filename.
- Returns:
Full path to the data file.
- Return type:
Path
get_examples_path#
- do_dpc.utils.path_manager.PathManager.get_examples_path(self)#
Returns the full path to the example folder.
- Returns:
Full path to the example folder.
- Return type:
Path
get_log_file#
- do_dpc.utils.path_manager.PathManager.get_log_file(self, with_date=True)#
Returns the full path to the log file.
- Parameters:
with_date (bool, optional) – If True, adds the current date in YYYY-MM-DD format to the filename.
- Returns:
Full path to the log file.
- Return type:
Path
get_video_path#
- do_dpc.utils.path_manager.PathManager.get_video_path(self)#
Returns the full path to the video folder.
- Returns:
Full path to the video folder.
- Return type:
Path