File tree Expand file tree Collapse file tree 12 files changed +61
-33
lines changed
Expand file tree Collapse file tree 12 files changed +61
-33
lines changed Original file line number Diff line number Diff line change 44
55import functools
66import re
7- from collections .abc import Callable
8- from typing import Any
7+ from typing import TYPE_CHECKING , Any
8+
9+ if TYPE_CHECKING :
10+ from collections .abc import Callable
911
1012_CAMEL_RE = re .compile (r"([A-Z]+)([A-Z][a-z])|([a-z\d])([A-Z])" )
1113
Original file line number Diff line number Diff line change 44
55import asyncio
66import contextlib
7- from collections .abc import Callable , Coroutine , Generator
87from dataclasses import dataclass
98from typing import TYPE_CHECKING , Any
109
1110from pyoverkiz .models import Action
1211
1312if TYPE_CHECKING :
13+ from collections .abc import Callable , Coroutine , Generator
14+
1415 from pyoverkiz .enums import ExecutionMode
1516
1617
Original file line number Diff line number Diff line change 33from __future__ import annotations
44
55import datetime
6- from collections .abc import Mapping
76from dataclasses import dataclass
8- from typing import Any , Protocol
7+ from typing import TYPE_CHECKING , Any , Protocol
8+
9+ if TYPE_CHECKING :
10+ from collections .abc import Mapping
911
1012
1113@dataclass (slots = True )
Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5- import ssl
6-
7- from aiohttp import ClientSession
5+ from typing import TYPE_CHECKING
86
97from pyoverkiz .auth .credentials import (
108 Credentials ,
2422 SomfyAuthStrategy ,
2523)
2624from pyoverkiz .enums import APIType , Server
27- from pyoverkiz .models import ServerConfig
25+
26+ if TYPE_CHECKING :
27+ import ssl
28+
29+ from aiohttp import ClientSession
30+
31+ from pyoverkiz .models import ServerConfig
2832
2933
3034def build_auth_strategy (
Original file line number Diff line number Diff line change 66import base64
77import binascii
88import json
9- import ssl
10- from collections .abc import Mapping
119from typing import TYPE_CHECKING , Any , cast
1210
1311if TYPE_CHECKING :
12+ import ssl
13+ from collections .abc import Mapping
14+
1415 from botocore .client import BaseClient
1516
17+ from pyoverkiz .auth .credentials import (
18+ LocalTokenCredentials ,
19+ RexelOAuthCodeCredentials ,
20+ TokenCredentials ,
21+ UsernamePasswordCredentials ,
22+ )
23+ from pyoverkiz .models import ServerConfig
24+
1625from aiohttp import ClientSession , FormData
1726
1827from pyoverkiz .auth .base import AuthContext , AuthStrategy
19- from pyoverkiz .auth .credentials import (
20- LocalTokenCredentials ,
21- RexelOAuthCodeCredentials ,
22- TokenCredentials ,
23- UsernamePasswordCredentials ,
24- )
2528from pyoverkiz .const import (
2629 COZYTOUCH_ATLANTIC_API ,
2730 COZYTOUCH_CLIENT_ID ,
4750 SomfyBadCredentialsError ,
4851 SomfyServiceError ,
4952)
50- from pyoverkiz .models import ServerConfig
5153
5254
5355class BaseAuthStrategy (AuthStrategy ):
Original file line number Diff line number Diff line change 66import ssl
77import urllib .parse
88from pathlib import Path
9- from types import TracebackType
10- from typing import Any , cast
9+ from typing import TYPE_CHECKING , Any , cast
1110
1211import backoff
1312from aiohttp import (
1615 ClientSession ,
1716 ServerDisconnectedError ,
1817)
19- from backoff .types import Details
2018
2119from pyoverkiz ._case import decamelize
2220from pyoverkiz .action_queue import ActionQueue , ActionQueueSettings
5250from pyoverkiz .obfuscate import obfuscate_sensitive_data
5351from pyoverkiz .response_handler import check_response
5452from pyoverkiz .serializers import prepare_payload
55- from pyoverkiz .types import JSON
53+
54+ if TYPE_CHECKING :
55+ from types import TracebackType
56+
57+ from backoff .types import Details
58+
59+ from pyoverkiz .types import JSON
5660
5761_LOGGER = logging .getLogger (__name__ )
5862
Original file line number Diff line number Diff line change 55import json
66import logging
77import re
8- from collections .abc import Iterator
9- from typing import Any , cast
8+ from typing import TYPE_CHECKING , Any , cast
109
1110from attr import define , field
1211
2423 UIWidget ,
2524 UpdateBoxStatus ,
2625)
27- from pyoverkiz .enums .command import OverkizCommand , OverkizCommandParam
2826from pyoverkiz .enums .protocol import Protocol
2927from pyoverkiz .enums .server import APIType , Server
3028from pyoverkiz .obfuscate import obfuscate_email , obfuscate_id , obfuscate_string
3129from pyoverkiz .types import DATA_TYPE_TO_PYTHON , StateType
3230
31+ if TYPE_CHECKING :
32+ from collections .abc import Iterator
33+
34+ from pyoverkiz .enums .command import OverkizCommand , OverkizCommandParam
35+
3336# pylint: disable=unused-argument, too-many-instance-attributes, too-many-locals
3437
3538# <protocol>://<gatewayId>/<deviceAddress>[#<subsystemId>]
Original file line number Diff line number Diff line change 33from __future__ import annotations
44
55import re
6- from typing import Any
6+ from typing import TYPE_CHECKING , Any
77
8- from pyoverkiz .types import JSON
8+ if TYPE_CHECKING :
9+ from pyoverkiz .types import JSON
910
1011
1112def obfuscate_id (id : str | None ) -> str :
Original file line number Diff line number Diff line change 33from __future__ import annotations
44
55from json import JSONDecodeError
6-
7- from aiohttp import ClientResponse
6+ from typing import TYPE_CHECKING
87
98from pyoverkiz .exceptions import (
109 AccessDeniedToGatewayError ,
3635 UnknownUserError ,
3736)
3837
38+ if TYPE_CHECKING :
39+ from aiohttp import ClientResponse
40+
3941# Primary dispatch: (errorCode, message_substring) -> error class.
4042# Checked in order; first match wins. Use errorCode as the primary key to
4143# reduce brittleness across cloud vs. local API variants.
Original file line number Diff line number Diff line change 33from __future__ import annotations
44
55import json
6- from collections .abc import Callable
7- from typing import Any
6+ from typing import TYPE_CHECKING , Any
87
98from pyoverkiz .enums import DataType
109
10+ if TYPE_CHECKING :
11+ from collections .abc import Callable
12+
1113StateType = str | int | float | bool | dict [str , Any ] | list [Any ] | None
1214
1315
You can’t perform that action at this time.
0 commit comments