snowshu.core.utils¶
-
snowshu.core.utils.case_insensitive_dict_value(dictionary, caseless_key) → Any¶ finds a key in a dict without case sensitivity, returns value.
Searches for the FIRST match (insensitive dict keys can have multiple matches) and returns that value.
- Parameters
dictionary (-) – The dictionary to traverse.
caseless_key (-) – The key case-insensitive search the dictionary for.
- Returns
the value of insensitive key. Raises KeyError if not found.
-
snowshu.core.utils.correct_case(val: str, upper: bool = True)¶
-
snowshu.core.utils.fetch_adapter(name: str, section: str) → Union[Type[BaseSourceAdapter], Type[BaseTargetAdapter], Type[BaseSQLAdapter]]¶ Locates and returns the specified adapter.
- Parameters
name – The name of the adapter to look up.
section – One of (‘source’,’target’,’storage’).
- Returns
The adapter if found, raises
AdapterNotFound.
-
snowshu.core.utils.get_config_value(parent: dict, key: str, envar: Optional[str] = None, parent_name: Optional[str] = None) → Any¶
-
snowshu.core.utils.key_for_value(dictionary, value)¶ finds the key for a given value in a dict.
-
snowshu.core.utils.load_from_file_or_path(loadable: Union[pathlib.Path, str, TextIO]) → dict¶