src.utils package
Submodules
src.utils.util module
Utility module for this project.
Exception intended for unmet external dependencies |
|
Similar to MATLAB's |
|
Checks if the required dependencies are installed. |
|
Timing (decorator) function to time the execution of a function. |
- exception src.utils.util.DependencyError[source]
Bases:
ExceptionException intended for unmet external dependencies
- src.utils.util.check_dependencies(dependencies)[source]
Checks if the required dependencies are installed.
- Parameters:
- Raises:
DependencyError – If any of the dependencies are not installed.
- Return type:
- Returns:
True if all dependencies are installed.
- src.utils.util.file_parts(file)[source]
Similar to MATLAB’s
filepartsfunction shown here.- Splits a full filename into:
file path
filename (no file path, no file extension)
file extension
- Usage example:
>>> path_name, file_name, file_ext = file_parts('/Users/username/Desktop/file.txt') >>> path_name '/Users/username/Desktop' >>> file_name 'file' >>> file_ext '.txt'
- Parameters:
file (
str) – Input file filename.- Returns:
file path
filename (no file path, no file extension)
file extension
- Return type:
Tuple
- src.utils.util.timeit(func)[source]
Timing (decorator) function to time the execution of a function.
Prints the execution time of the function.
- Usage example:
>>> @timeit ... def main(): ... print("Hello, World!") ... >>> main() Begin: main Hello, World! End: main Execution time: 0.00 sec.
- Parameters:
func (
callable) – Function to be timed.- Return type:
callable- Returns:
Decorated function.