diff --git a/aioesphomeapi/client.py b/aioesphomeapi/client.py index 8ac4b190a..042fc84de 100644 --- a/aioesphomeapi/client.py +++ b/aioesphomeapi/client.py @@ -9,7 +9,7 @@ from google.protobuf import message -from .api_pb2 import ( # type: ignore +from .api_pb2 import ( # type: ignore[attr-defined] AlarmControlPanelCommandRequest, BluetoothConnectionsFreeResponse, BluetoothDeviceClearCacheResponse, diff --git a/aioesphomeapi/client_base.py b/aioesphomeapi/client_base.py index a727c92c6..0a5cd5196 100644 --- a/aioesphomeapi/client_base.py +++ b/aioesphomeapi/client_base.py @@ -16,7 +16,7 @@ ) from ._frame_helper.noise import APINoiseFrameHelper # noqa: F401 from ._frame_helper.plain_text import APIPlaintextFrameHelper # noqa: F401 -from .api_pb2 import ( # type: ignore +from .api_pb2 import ( # type: ignore[attr-defined] BluetoothConnectionsFreeResponse, BluetoothDeviceConnectionResponse, BluetoothGATTErrorResponse, diff --git a/aioesphomeapi/connection.py b/aioesphomeapi/connection.py index 10651e72b..52d7afe9a 100644 --- a/aioesphomeapi/connection.py +++ b/aioesphomeapi/connection.py @@ -22,7 +22,7 @@ from ._frame_helper.base import MAX_NAME_LEN, safe_label_str from ._frame_helper.noise import APINoiseFrameHelper from ._frame_helper.plain_text import APIPlaintextFrameHelper -from .api_pb2 import ( # type: ignore # type: ignore +from .api_pb2 import ( # type: ignore[attr-defined] DST_RULE_TYPE_DAY_OF_YEAR as DST_RULE_TYPE_DAY_OF_YEAR_PB, DST_RULE_TYPE_JULIAN_NO_LEAP as DST_RULE_TYPE_JULIAN_NO_LEAP_PB, DST_RULE_TYPE_MONTH_WEEK_DAY as DST_RULE_TYPE_MONTH_WEEK_DAY_PB, diff --git a/aioesphomeapi/core.py b/aioesphomeapi/core.py index 918a82772..631bb6984 100644 --- a/aioesphomeapi/core.py +++ b/aioesphomeapi/core.py @@ -5,7 +5,7 @@ from aioesphomeapi.model import BluetoothGATTError -from .api_pb2 import ( # type: ignore +from .api_pb2 import ( # type: ignore[attr-defined] AlarmControlPanelCommandRequest, AlarmControlPanelStateResponse, AuthenticationRequest, diff --git a/aioesphomeapi/log_reader.py b/aioesphomeapi/log_reader.py index d57b150e7..65462f5f4 100644 --- a/aioesphomeapi/log_reader.py +++ b/aioesphomeapi/log_reader.py @@ -8,7 +8,7 @@ import logging import sys -from .api_pb2 import SubscribeLogsResponse # type: ignore +from .api_pb2 import SubscribeLogsResponse # type: ignore[attr-defined] from .client import APIClient from .log_parser import parse_log_message from .log_runner import async_run diff --git a/aioesphomeapi/log_runner.py b/aioesphomeapi/log_runner.py index 0b9490063..1ba17096e 100644 --- a/aioesphomeapi/log_runner.py +++ b/aioesphomeapi/log_runner.py @@ -6,7 +6,7 @@ from zeroconf.asyncio import AsyncZeroconf -from .api_pb2 import SubscribeLogsResponse # type: ignore +from .api_pb2 import SubscribeLogsResponse # type: ignore[attr-defined] from .client import APIClient from .core import APIConnectionError from .model import EntityInfo, EntityState, LogLevel diff --git a/aioesphomeapi/model.py b/aioesphomeapi/model.py index 0f26fbed2..f24d9ae95 100644 --- a/aioesphomeapi/model.py +++ b/aioesphomeapi/model.py @@ -17,7 +17,7 @@ if TYPE_CHECKING: - from .api_pb2 import ( # type: ignore + from .api_pb2 import ( # type: ignore[attr-defined] BluetoothLEAdvertisementResponse, HomeassistantServiceMap, ) @@ -1398,7 +1398,7 @@ def _convert_homeassistant_service_map( if isinstance(value, dict): # already a dict, don't convert return value - return {v.key: v.value for v in value} # type: ignore + return {v.key: v.value for v in value} # type: ignore[union-attr] @_frozen_dataclass_decorator diff --git a/aioesphomeapi/model_conversions.py b/aioesphomeapi/model_conversions.py index 3c93dd5ed..682d2c46d 100644 --- a/aioesphomeapi/model_conversions.py +++ b/aioesphomeapi/model_conversions.py @@ -2,7 +2,7 @@ from typing import Any -from .api_pb2 import ( # type: ignore +from .api_pb2 import ( # type: ignore[attr-defined] AlarmControlPanelStateResponse, BinarySensorStateResponse, ClimateStateResponse, diff --git a/pyproject.toml b/pyproject.toml index 71eed7d66..6d0b6e58b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,7 @@ select = [ "G", # flake8-logging-format "I", # isort "PERF", # Perflint + "PGH", # pygrep-hooks "PIE", # flake8-pie "PL", # pylint "PT006", # pytest-parametrize-names-wrong-type diff --git a/tests/test_log_runner.py b/tests/test_log_runner.py index e6cf10932..6fa1fc41b 100644 --- a/tests/test_log_runner.py +++ b/tests/test_log_runner.py @@ -12,7 +12,7 @@ from aioesphomeapi.api_pb2 import ( DisconnectRequest, DisconnectResponse, - SubscribeLogsResponse, # type: ignore + SubscribeLogsResponse, # type: ignore[attr-defined] ) from aioesphomeapi.client import APIClient from aioesphomeapi.connection import APIConnection