model_organization.utils module¶
Functions
dir_contains (dirname, path[, exists]) |
Check if a file of directory is contained in another. |
get_module_path (mod) |
Convenience method to get the directory of a given python module |
get_next_name (old[, fmt]) |
Return the next name that numerically follows old |
get_toplevel_module (mod) |
|
go_through_dict (key, d[, setdefault]) |
Split up the key by . |
isstring (s) |
|
safe_list (l) |
Function to create a list |
-
dir_contains
(dirname, path, exists=True)[source]¶ Check if a file of directory is contained in another.
Parameters: Notes
path and dirname must be either both absolute or both relative paths
-
go_through_dict
(key, d, setdefault=None)[source]¶ Split up the key by . and get the value from the base dictionary d
Parameters: - key (str) – The key in the config configuration.
If the key goes some
levels deeper, keys may be separated by a
'.'
(e.g.'namelists.weathergen'
). Hence, to insert a','
, it must be escaped by a preceeding''
. - d (dict) – The configuration dictionary containing the key
- setdefault (callable) – If not None and an item is not existent in d, it is created by calling the given function
Returns: - str – The last level of the key
- dict – The dictionary in d that contains the last level of the key
- key (str) – The key in the config configuration.
If the key goes some
levels deeper, keys may be separated by a