From 9ff797edca1524455206087fcf026afd71acff37 Mon Sep 17 00:00:00 2001 From: clerie Date: Tue, 5 Jul 2022 19:33:31 +0200 Subject: [PATCH] Move config attribute to dedicated class. --- fieldpoc/config.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/fieldpoc/config.py b/fieldpoc/config.py index 68ea8e4..4bf47c4 100644 --- a/fieldpoc/config.py +++ b/fieldpoc/config.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -class ControllerConfig: +class ConfigBase: def __init__(self, c): self._c = c @@ -10,15 +10,15 @@ class ControllerConfig: else: raise AttributeError() -class DectConfig: + +class ControllerConfig(ConfigBase): def __init__(self, c): self._c = c - def __getattr__(self, name): - if name in self._c.keys(): - return self._c.get(name) - else: - raise AttributeError() + +class DectConfig(ConfigBase): + def __init__(self, c): + self._c = c def check(self): return True @@ -39,12 +39,6 @@ class ExtensionConfig: self.num = c[0] self._c = c[1] - def __getattr__(self, name): - if name in self._c.keys(): - return self._c.get(name) - else: - raise AttributeError() - class Extensions: def __init__(self, c):