File: typing.py

package info (click to toggle)
zigpy 0.86.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,124 kB
  • sloc: python: 36,886; sql: 2,109; makefile: 8
file content (53 lines) | stat: -rw-r--r-- 1,338 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""Typing helpers for Zigpy."""

from __future__ import annotations

import enum
from typing import TYPE_CHECKING, Any

ConfigType = dict[str, Any]

# pylint: disable=invalid-name
ClusterType = "Cluster"
ControllerApplicationType = "ControllerApplication"
CustomClusterType = "CustomCluster"
CustomDeviceType = "CustomDevice"
CustomEndpointType = "CustomEndpoint"
DeviceType = "Device"
EndpointType = "Endpoint"
ZDOType = "ZDO"
AddressingMode = "AddressingMode"


class UndefinedType(enum.Enum):
    """Singleton type for use with not set sentinel values."""

    _singleton = 0


UNDEFINED = UndefinedType._singleton  # noqa: SLF001


if TYPE_CHECKING:
    import zigpy.application
    import zigpy.device
    import zigpy.endpoint
    import zigpy.quirks
    import zigpy.types
    import zigpy.zcl
    import zigpy.zdo

    ClusterType = zigpy.zcl.Cluster
    ControllerApplicationType = zigpy.application.ControllerApplication
    CustomClusterType = zigpy.quirks.CustomCluster
    CustomDeviceType = zigpy.quirks.BaseCustomDevice
    CustomEndpointType = zigpy.quirks.CustomEndpoint
    DeviceType = zigpy.device.Device
    EndpointType = zigpy.endpoint.Endpoint
    ZDOType = zigpy.zdo.ZDO

    AddressingMode = (
        zigpy.types.Addressing.Group
        | zigpy.types.Addressing.IEEE
        | zigpy.types.Addressing.NWK
    )