habitat.utils.common module

Functions

def check_make_dir(directory_path: str) -> bool
Check for the existence of the provided directory_path and create it if not found.
def cull_string_list_by_substrings(full_list: typing.List[str], included_substrings: typing.List[str], excluded_substrings: typing.List[str]) -> typing.List[str]
Cull a list of strings to the subset of strings containing any of the “included_substrings” and none of the “excluded_substrings”. Returns the culled list, does not modify the input list.
def flatten_dict(d: typing.Dict, parent_key: str = '', sep: str = '.') -> typing.Dict
Flattens nested dict.

Function documentation

def habitat.utils.common.flatten_dict(d: typing.Dict, parent_key: str = '', sep: str = '.') -> typing.Dict

Flattens nested dict.

Source: https://stackoverflow.com/questions/6027558/flatten-nested-dictionaries-compressing-keys

param d:
Nested dict.
param parent_key:
Parameter to set parent dict key.
param sep:
Nested keys separator.
return:
Flattened dict.