Skip to content

Commit

Permalink
config update
Browse files Browse the repository at this point in the history
  • Loading branch information
alexei-zebra committed Jul 9, 2022
1 parent 2258889 commit b4da10c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# config lib v1.0 by zebra
class Config:
def __init__(self) -> None:
self._configs = {}
def new_config(self, name :str, path = None):
path = path if path else f"config/{name}.cfg"
with open(path,'r') as file:
config = {}
for string in file.readlines():
string = string.strip()
if string[0] == '#':
continue
value_name, value = string.split('=')
config[value_name.strip()] = value.strip()
self._configs[name] = config
def get_config(self, name = None):
return self._configs[name] if name else self._configs

0 comments on commit b4da10c

Please sign in to comment.