diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-06-11 14:02:47 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-06-11 14:02:47 +0300 |
commit | 5d8e81b6c8fc7abe75188007c6a86bb501a314ad (patch) | |
tree | 8e6567b92dec35f067d15c96a216631f494fd5bf /include/py/homekit/config/config.py | |
parent | 58b5a1b5fca1cd898b1121778a3205ce2dafae36 (diff) |
config: turn ConfigUnit into singleton
Diffstat (limited to 'include/py/homekit/config/config.py')
-rw-r--r-- | include/py/homekit/config/config.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/py/homekit/config/config.py b/include/py/homekit/config/config.py index f2a3990..29364af 100644 --- a/include/py/homekit/config/config.py +++ b/include/py/homekit/config/config.py @@ -76,6 +76,13 @@ class BaseConfigUnit(ABC): class ConfigUnit(BaseConfigUnit): NAME = 'dumb' + _instance = None + + def __new__(cls, *args, **kwargs): + if cls._instance is None: + cls._instance = super(ConfigUnit, cls).__new__(cls, *args, **kwargs) + return cls._instance + def __init__(self, name=None, load=True): super().__init__() |