summaryrefslogtreecommitdiff
path: root/include/py/homekit/soundsensor/__init__.py
blob: 30052f8ac694778bd8158b14c2add046925d172d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import importlib

__all__ = [
    'SoundSensorNode',
    'SoundSensorHitHandler',
    'SoundSensorServer',
    'SoundSensorServerGuardClient'
]


def __getattr__(name):
    if name in __all__:
        if name == 'SoundSensorNode':
            file = 'node'
        elif name == 'SoundSensorServerGuardClient':
            file = 'server_client'
        else:
            file = 'server'
        module = importlib.import_module(f'.{file}', __name__)
        return getattr(module, name)

    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")