diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5da3a6b21ff..fd2d5ac7e20 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,7 +31,7 @@ repos: - pyflakes==2.4.0 - flake8-docstrings==1.6.0 - pydocstyle==6.1.1 - - flake8-comprehensions==3.8.0 + - flake8-comprehensions==3.10.0 - flake8-noqa==1.2.1 - mccabe==0.6.1 files: ^(homeassistant|script|tests)/.+\.py$ diff --git a/homeassistant/util/color.py b/homeassistant/util/color.py index 448b417cc97..494ee04546c 100644 --- a/homeassistant/util/color.py +++ b/homeassistant/util/color.py @@ -294,22 +294,20 @@ def color_xy_brightness_to_RGB( b = X * 0.051713 - Y * 0.121364 + Z * 1.011530 # Apply reverse gamma correction. - r, g, b = map( - lambda x: (12.92 * x) # type: ignore[no-any-return] - if (x <= 0.0031308) - else ((1.0 + 0.055) * pow(x, (1.0 / 2.4)) - 0.055), - [r, g, b], + r, g, b = ( + 12.92 * x if (x <= 0.0031308) else ((1.0 + 0.055) * pow(x, (1.0 / 2.4)) - 0.055) + for x in (r, g, b) ) # Bring all negative components to zero. - r, g, b = map(lambda x: max(0, x), [r, g, b]) + r, g, b = (max(0, x) for x in (r, g, b)) # If one component is greater than 1, weight components by that value. max_component = max(r, g, b) if max_component > 1: - r, g, b = map(lambda x: x / max_component, [r, g, b]) + r, g, b = (x / max_component for x in (r, g, b)) - ir, ig, ib = map(lambda x: int(x * 255), [r, g, b]) + ir, ig, ib = (int(x * 255) for x in (r, g, b)) return (ir, ig, ib) diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index 23d675afaf1..c229bc51731 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -3,7 +3,7 @@ bandit==1.7.4 black==22.6.0 codespell==2.1.0 -flake8-comprehensions==3.8.0 +flake8-comprehensions==3.10.0 flake8-docstrings==1.6.0 flake8-noqa==1.2.1 flake8==4.0.1