From 06209dd94c262eb4b2e13800b5e69d7e53b256ff Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Fri, 16 Aug 2024 16:54:20 +0200 Subject: [PATCH] Bump ruff to 0.6.0 (#123985) --- .pre-commit-config.yaml | 2 +- homeassistant/components/environment_canada/config_flow.py | 4 ++-- homeassistant/components/environment_canada/coordinator.py | 4 ++-- requirements_test_pre_commit.txt | 2 +- tests/components/environment_canada/test_config_flow.py | 4 ++-- tests/components/lg_netcast/__init__.py | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f057931e2a8..4c3ce7fe104 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.7 + rev: v0.6.0 hooks: - id: ruff args: diff --git a/homeassistant/components/environment_canada/config_flow.py b/homeassistant/components/environment_canada/config_flow.py index a351bb0ef06..79b37c64c1b 100644 --- a/homeassistant/components/environment_canada/config_flow.py +++ b/homeassistant/components/environment_canada/config_flow.py @@ -1,7 +1,7 @@ """Config flow for Environment Canada integration.""" import logging -import xml.etree.ElementTree as et +import xml.etree.ElementTree as ET import aiohttp from env_canada import ECWeather, ec_exc @@ -52,7 +52,7 @@ class EnvironmentCanadaConfigFlow(ConfigFlow, domain=DOMAIN): if user_input is not None: try: info = await validate_input(user_input) - except (et.ParseError, vol.MultipleInvalid, ec_exc.UnknownStationId): + except (ET.ParseError, vol.MultipleInvalid, ec_exc.UnknownStationId): errors["base"] = "bad_station_id" except aiohttp.ClientConnectionError: errors["base"] = "cannot_connect" diff --git a/homeassistant/components/environment_canada/coordinator.py b/homeassistant/components/environment_canada/coordinator.py index e17c360e3fb..8e77b309c78 100644 --- a/homeassistant/components/environment_canada/coordinator.py +++ b/homeassistant/components/environment_canada/coordinator.py @@ -1,7 +1,7 @@ """Coordinator for the Environment Canada (EC) component.""" import logging -import xml.etree.ElementTree as et +import xml.etree.ElementTree as ET from env_canada import ec_exc @@ -27,6 +27,6 @@ class ECDataUpdateCoordinator(DataUpdateCoordinator): """Fetch data from EC.""" try: await self.ec_data.update() - except (et.ParseError, ec_exc.UnknownStationId) as ex: + except (ET.ParseError, ec_exc.UnknownStationId) as ex: raise UpdateFailed(f"Error fetching {self.name} data: {ex}") from ex return self.ec_data diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index ba54a19da3e..091f872d511 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -1,5 +1,5 @@ # Automatically generated from .pre-commit-config.yaml by gen_requirements_all.py, do not edit codespell==2.3.0 -ruff==0.5.7 +ruff==0.6.0 yamllint==1.35.1 diff --git a/tests/components/environment_canada/test_config_flow.py b/tests/components/environment_canada/test_config_flow.py index f2c35ab4295..d61966e8da1 100644 --- a/tests/components/environment_canada/test_config_flow.py +++ b/tests/components/environment_canada/test_config_flow.py @@ -1,7 +1,7 @@ """Test the Environment Canada (EC) config flow.""" from unittest.mock import AsyncMock, MagicMock, Mock, patch -import xml.etree.ElementTree as et +import xml.etree.ElementTree as ET import aiohttp import pytest @@ -94,7 +94,7 @@ async def test_create_same_entry_twice(hass: HomeAssistant) -> None: (aiohttp.ClientResponseError(Mock(), (), status=404), "bad_station_id"), (aiohttp.ClientResponseError(Mock(), (), status=400), "error_response"), (aiohttp.ClientConnectionError, "cannot_connect"), - (et.ParseError, "bad_station_id"), + (ET.ParseError, "bad_station_id"), (ValueError, "unknown"), ], ) diff --git a/tests/components/lg_netcast/__init__.py b/tests/components/lg_netcast/__init__.py index ce3e09aeb65..6e608ae207b 100644 --- a/tests/components/lg_netcast/__init__.py +++ b/tests/components/lg_netcast/__init__.py @@ -1,7 +1,7 @@ """Tests for LG Netcast TV.""" from unittest.mock import patch -from xml.etree import ElementTree +import xml.etree.ElementTree as ET from pylgnetcast import AccessTokenError, LgNetCastClient, SessionIdError import requests @@ -56,7 +56,7 @@ def _patched_lgnetcast_client( if always_404: return None if invalid_details: - raise ElementTree.ParseError("Mocked Parsed Error") + raise ET.ParseError("Mocked Parsed Error") return { "uuid": UNIQUE_ID if not no_unique_id else None, "model_name": MODEL_NAME,