Support user mapping

This commit is contained in:
Luigi311
2022-05-23 04:18:02 -06:00
parent 768103f113
commit 8d39bd6d33
5 changed files with 168 additions and 83 deletions

View File

@@ -27,3 +27,12 @@ def str_to_bool(value: any) -> bool:
if not value:
return False
return str(value).lower() in ("y", "yes", "t", "true", "on", "1")
# Get mapped value
def search_mapping(dictionary: dict, key_value: str):
if key_value in dictionary.keys():
return dictionary[key_value]
elif key_value in dictionary.values():
return list(dictionary.keys())[list(dictionary.values()).index(key_value)]
else:
return None