cobra_db.utils
Module Contents
Functions
|
Lazyly use the "find" bash command to recursively get all the files |
|
Lazy iterator to recursively find all files with .dcm extension under a path |
|
List all directories directly below path |
|
List paths of files with <extension> directly inside a folder. |
|
Parse DA and TM as datetime |
|
Parse AS as int |
|
Reads the fist level keys and returns everything that is the same for all dicts. |
Reads first level keys and returns a dict with all the keys where the values are |
- cobra_db.utils.find_files(path: str, query: str, regex: bool = False)[source]
Lazyly use the “find” bash command to recursively get all the files that match query on path.
- Parameters:
path – path to search
query – query to match
regex – use -regex instead of -name
- Raises:
FileNotFoundError – when nothing is found
- Yield:
absolute paths of files
- cobra_db.utils.find_dcm(path)[source]
Lazy iterator to recursively find all files with .dcm extension under a path
- Parameters:
path – path to find
- Yield:
absolute paths of files
- cobra_db.utils.list_dirs(path: str) List[str][source]
List all directories directly below path
- Parameters:
path – path to get directories from
- Returns:
list of directories as absolute paths
- cobra_db.utils.list_files(folder_path: str, extension: str) List[str][source]
List paths of files with <extension> directly inside a folder.
- Parameters:
folder_path – the path to the folder
extension – the extension to look for
- Returns:
list of absolute paths of files
- cobra_db.utils.parse_DA_TM_as_datetime(DA: str, TM: str) datetime.datetime[source]
Parse DA and TM as datetime