Dantali0n / radloggerpy

Radiation monitoring solution for a variety of instrument types.
Apache License 2.0
2 stars 0 forks source link

Centralize fields and attribute variables across device CLI #9

Open Dantali0n opened 3 years ago

Dantali0n commented 3 years ago

The device CLI has many duplicates of the fields tuple and similarly reuses the same tuple of attributes often. These variables could be part of base classes similar to the pattern used for the arguments property in combination with the _arguments variable.

class Example(metaclass=abc.ABCMeta):
    """Arguments property is extensible by child classes"""

    _arguments = None

    @property
    def arguments(self):
        if self._arguments is None:
            self._arguments = dict()
            self._arguments.update({
                '--id': Argument(
                    '-i', help="Example argument attribute",
                    type=int)
            })
        return self._arguments