fixed + completed type hints
This commit is contained in:
10
config.py
10
config.py
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
@@ -29,8 +31,9 @@ class Config:
|
||||
|
||||
def __init__(self, path: str = "config.json") -> None:
|
||||
self.load(path)
|
||||
|
||||
def load(self, path: str) -> None:
|
||||
|
||||
@staticmethod
|
||||
def load(path: str) -> None:
|
||||
with open(path, "r") as f:
|
||||
config = json.load(f)
|
||||
|
||||
@@ -39,5 +42,6 @@ class Config:
|
||||
if hasattr(Config, k):
|
||||
setattr(Config, k, v)
|
||||
|
||||
@staticmethod
|
||||
def formatKey(key: str) -> str:
|
||||
return re.sub(r"([a-z])([A-Z])", r"\1_\2", key).upper()
|
||||
return re.sub(r"([a-z])([A-Z])", r"\1_\2", key).upper()
|
||||
|
||||
Reference in New Issue
Block a user