File: __init__.py

package info (click to toggle)
python-samsung-mdc 1.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 340 kB
  • sloc: python: 2,105; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 589 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from typing import Dict
import inspect

from .version import __version__  # noqa
from .connection import MDCConnection
from .command import Command
from . import commands


class MDC(MDCConnection):
    _commands: Dict[str, Command] = {}

    @classmethod
    def register_command(cls, command):
        cls._commands[command.name] = command
        setattr(cls, command.name, command)


for name, cls in inspect.getmembers(commands, inspect.isclass):
    if (issubclass(cls, Command)
       and cls is not Command
       and not name.startswith('_')):
        MDC.register_command(cls())