From 3c246b78004917d494e6c81a389e73bee4f0bf70 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Wed, 25 May 2022 20:42:14 +0200 Subject: [PATCH] Update mypy to 0.960 (#72481) --- homeassistant/components/recorder/purge.py | 4 ++-- homeassistant/components/sonos/helpers.py | 2 +- homeassistant/util/color.py | 6 +++--- requirements_test.txt | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/recorder/purge.py b/homeassistant/components/recorder/purge.py index 432e3993add..10136dfb5a6 100644 --- a/homeassistant/components/recorder/purge.py +++ b/homeassistant/components/recorder/purge.py @@ -315,7 +315,7 @@ def _select_unused_attributes_ids( seen_ids |= { attrs_id[0] for attrs_id in session.execute( - attributes_ids_exist_in_states(*attr_ids) + attributes_ids_exist_in_states(*attr_ids) # type: ignore[arg-type] ).all() if attrs_id[0] is not None } @@ -362,7 +362,7 @@ def _select_unused_event_data_ids( seen_ids |= { data_id[0] for data_id in session.execute( - data_ids_exist_in_events(*data_ids_group) + data_ids_exist_in_events(*data_ids_group) # type: ignore[arg-type] ).all() if data_id[0] is not None } diff --git a/homeassistant/components/sonos/helpers.py b/homeassistant/components/sonos/helpers.py index 22d9f6c08a5..9e8fcbd6a12 100644 --- a/homeassistant/components/sonos/helpers.py +++ b/homeassistant/components/sonos/helpers.py @@ -62,7 +62,7 @@ def soco_error( def wrapper(self: _T, *args: _P.args, **kwargs: _P.kwargs) -> _R | None: """Wrap for all soco UPnP exception.""" - args_soco = next((arg for arg in args if isinstance(arg, SoCo)), None) # type: ignore[attr-defined] + args_soco = next((arg for arg in args if isinstance(arg, SoCo)), None) try: result = funct(self, *args, **kwargs) except (OSError, SoCoException, SoCoUPnPException) as err: diff --git a/homeassistant/util/color.py b/homeassistant/util/color.py index 21c877f9377..448b417cc97 100644 --- a/homeassistant/util/color.py +++ b/homeassistant/util/color.py @@ -3,7 +3,7 @@ from __future__ import annotations import colorsys import math -from typing import NamedTuple, cast +from typing import NamedTuple import attr @@ -295,9 +295,9 @@ def color_xy_brightness_to_RGB( # Apply reverse gamma correction. r, g, b = map( - lambda x: (12.92 * x) + lambda x: (12.92 * x) # type: ignore[no-any-return] if (x <= 0.0031308) - else ((1.0 + 0.055) * cast(float, pow(x, (1.0 / 2.4))) - 0.055), + else ((1.0 + 0.055) * pow(x, (1.0 / 2.4)) - 0.055), [r, g, b], ) diff --git a/requirements_test.txt b/requirements_test.txt index 29e7364059f..7e4e29de339 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -11,7 +11,7 @@ codecov==2.1.12 coverage==6.4 freezegun==1.2.1 mock-open==1.4.0 -mypy==0.950 +mypy==0.960 pre-commit==2.19.0 pylint==2.13.9 pipdeptree==2.2.1