mkt.databases.utils.try_except_match_str2dict

mkt.databases.utils.try_except_match_str2dict(str_in: str, dict_in: dict[str, Any], bool_keyout: bool = True) Any[source]

Dictionary match with exception handling.

Parameters:
  • str_in (str) – Input string

  • dict_in (dict[str, Any]) – Dictionary where keys are strings to match with str_in

  • bool_keyout (bool) – If true and no match, return string

Returns:

Returns either dictionary value if match, str_in if no match and bool_keyout = True else None

Return type:

Any