From fb66ceb302261292ea7f58f2e3961ea0d35e3fc8 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 11 Aug 2023 13:13:04 +0200 Subject: [PATCH] Update mypy to 1.5.0 (#98179) --- homeassistant/components/bluetooth/manager.py | 2 +- homeassistant/components/litterrobot/binary_sensor.py | 4 ++-- homeassistant/components/litterrobot/select.py | 2 +- homeassistant/components/litterrobot/sensor.py | 2 +- mypy.ini | 2 +- requirements_test.txt | 2 +- script/hassfest/mypy_config.py | 5 +++-- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/bluetooth/manager.py b/homeassistant/components/bluetooth/manager.py index ce778e0309b..bd91c622316 100644 --- a/homeassistant/components/bluetooth/manager.py +++ b/homeassistant/components/bluetooth/manager.py @@ -637,7 +637,7 @@ class BluetoothManager: else: # We could write out every item in the typed dict here # but that would be a bit inefficient and verbose. - callback_matcher.update(matcher) # type: ignore[typeddict-item] + callback_matcher.update(matcher) callback_matcher[CONNECTABLE] = matcher.get(CONNECTABLE, True) connectable = callback_matcher[CONNECTABLE] diff --git a/homeassistant/components/litterrobot/binary_sensor.py b/homeassistant/components/litterrobot/binary_sensor.py index 5308a3b4f83..0872c5c831d 100644 --- a/homeassistant/components/litterrobot/binary_sensor.py +++ b/homeassistant/components/litterrobot/binary_sensor.py @@ -48,7 +48,7 @@ class LitterRobotBinarySensorEntity(LitterRobotEntity[_RobotT], BinarySensorEnti BINARY_SENSOR_MAP: dict[type[Robot], tuple[RobotBinarySensorEntityDescription, ...]] = { - LitterRobot: ( + LitterRobot: ( # type: ignore[type-abstract] # only used for isinstance check RobotBinarySensorEntityDescription[LitterRobot]( key="sleeping", translation_key="sleeping", @@ -66,7 +66,7 @@ BINARY_SENSOR_MAP: dict[type[Robot], tuple[RobotBinarySensorEntityDescription, . is_on_fn=lambda robot: robot.sleep_mode_enabled, ), ), - Robot: ( + Robot: ( # type: ignore[type-abstract] # only used for isinstance check RobotBinarySensorEntityDescription[Robot]( key="power_status", translation_key="power_status", diff --git a/homeassistant/components/litterrobot/select.py b/homeassistant/components/litterrobot/select.py index 6fabd6ea526..7f2ea62f956 100644 --- a/homeassistant/components/litterrobot/select.py +++ b/homeassistant/components/litterrobot/select.py @@ -48,7 +48,7 @@ class RobotSelectEntityDescription( ROBOT_SELECT_MAP: dict[type[Robot], RobotSelectEntityDescription] = { - LitterRobot: RobotSelectEntityDescription[LitterRobot, int]( + LitterRobot: RobotSelectEntityDescription[LitterRobot, int]( # type: ignore[type-abstract] # only used for isinstance check key="cycle_delay", translation_key="cycle_delay", icon="mdi:timer-outline", diff --git a/homeassistant/components/litterrobot/sensor.py b/homeassistant/components/litterrobot/sensor.py index ba601a0ba54..935bbaca595 100644 --- a/homeassistant/components/litterrobot/sensor.py +++ b/homeassistant/components/litterrobot/sensor.py @@ -66,7 +66,7 @@ class LitterRobotSensorEntity(LitterRobotEntity[_RobotT], SensorEntity): ROBOT_SENSOR_MAP: dict[type[Robot], list[RobotSensorEntityDescription]] = { - LitterRobot: [ + LitterRobot: [ # type: ignore[type-abstract] # only used for isinstance check RobotSensorEntityDescription[LitterRobot]( key="waste_drawer_level", translation_key="waste_drawer", diff --git a/mypy.ini b/mypy.ini index b3ab53bf8a9..1c47ad019a2 100644 --- a/mypy.ini +++ b/mypy.ini @@ -17,7 +17,7 @@ warn_unused_configs = true warn_unused_ignores = true enable_error_code = ignore-without-code, redundant-self, truthy-iterable disable_error_code = annotation-unchecked -strict_concatenate = false +extra_checks = false check_untyped_defs = true disallow_incomplete_defs = true disallow_subclassing_any = true diff --git a/requirements_test.txt b/requirements_test.txt index 79a26736b2b..73267ff5ab3 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -11,7 +11,7 @@ astroid==2.15.4 coverage==7.2.7 freezegun==1.2.2 mock-open==1.4.0 -mypy==1.4.1 +mypy==1.5.0 pre-commit==3.3.3 pydantic==1.10.12 pylint==2.17.4 diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index ad4a0f64fe4..779d76078d6 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -51,8 +51,9 @@ GENERAL_SETTINGS: Final[dict[str, str]] = { ] ), "disable_error_code": ", ".join(["annotation-unchecked"]), - # Strict_concatenate breaks passthrough ParamSpec typing - "strict_concatenate": "false", + # Impractical in real code + # E.g. this breaks passthrough ParamSpec typing with Concatenate + "extra_checks": "false", } # This is basically the list of checks which is enabled for "strict=true".