mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 22:39:26 +08:00
25 lines
814 B
Python
25 lines
814 B
Python
from module.config.deep import deep_get
|
|
from module.config.full_config_generated import FullGeneratedConfig
|
|
from module.logger import logger
|
|
|
|
|
|
class AzurLaneFullConfig(FullGeneratedConfig):
|
|
def __init__(self, config):
|
|
self.config = config # AzurLaneConfig
|
|
|
|
def __getattribute__(self, item):
|
|
if item.find("_") == -1:
|
|
return super().__getattribute__(item)
|
|
path = item.replace('_', '.')
|
|
result = deep_get(self.config.data, path)
|
|
if result is None:
|
|
raise AttributeError(f"Config {path} not found !")
|
|
return result
|
|
|
|
def __setattr__(self, key, value):
|
|
if key.find("_") == -1:
|
|
return super().__setattr__(key, value)
|
|
path = key.replace('_', '.')
|
|
self.config[path] = value
|
|
self.config.update()
|