summaryrefslogtreecommitdiffstats
path: root/app_config.py
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-05-29 15:03:06 -0700
committeryum <yum.food.vr@gmail.com>2025-05-29 15:03:06 -0700
commit0ebc79354ace812731a5c9a0a670cecd1ea941d7 (patch)
tree10a83d8761f365a320919d219b4a6f653db31c4d /app_config.py
parentf8e95c0b85288a10f435e0edabf43defa0c303ac (diff)
Move core app logic into folder
Diffstat (limited to 'app_config.py')
-rw-r--r--app_config.py39
1 files changed, 0 insertions, 39 deletions
diff --git a/app_config.py b/app_config.py
deleted file mode 100644
index f911456..0000000
--- a/app_config.py
+++ /dev/null
@@ -1,39 +0,0 @@
-import os
-import sys
-import typing
-
-def getConfig(path: str) -> typing.Dict[str, typing.Union[str, float, int, bool]]:
- # Helper functions to detect and convert the type
- def is_int(value: str) -> bool:
- try:
- int(value)
- return True
- except ValueError:
- return False
-
- def is_float(value: str) -> bool:
- try:
- float(value)
- return True
- except ValueError:
- return False
-
- def convert_value(key: str, value: str):
- if key.startswith(("enable_", "remove_", "use_", "clear_")):
- return bool(int(value))
- elif is_int(value):
- return int(value)
- elif is_float(value):
- return float(value)
- else:
- return value
-
- config = {}
- with open(path, 'r') as file:
- for line in file:
- key_value = line.strip().split(": ", maxsplit=1)
- key = key_value[0]
- value = key_value[1] if len(key_value) > 1 else ""
- config[key] = convert_value(key, value.strip())
- return config
-