Bump ruff to 0.6.0 (#123985)

This commit is contained in:
Joost Lekkerkerker 2024-08-16 16:54:20 +02:00 committed by GitHub
parent c8b0c939e4
commit 06209dd94c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7 rev: v0.6.0
hooks: hooks:
- id: ruff - id: ruff
args: args:

View File

@ -1,7 +1,7 @@
"""Config flow for Environment Canada integration.""" """Config flow for Environment Canada integration."""
import logging import logging
import xml.etree.ElementTree as et import xml.etree.ElementTree as ET
import aiohttp import aiohttp
from env_canada import ECWeather, ec_exc from env_canada import ECWeather, ec_exc
@ -52,7 +52,7 @@ class EnvironmentCanadaConfigFlow(ConfigFlow, domain=DOMAIN):
if user_input is not None: if user_input is not None:
try: try:
info = await validate_input(user_input) 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" errors["base"] = "bad_station_id"
except aiohttp.ClientConnectionError: except aiohttp.ClientConnectionError:
errors["base"] = "cannot_connect" errors["base"] = "cannot_connect"

View File

@ -1,7 +1,7 @@
"""Coordinator for the Environment Canada (EC) component.""" """Coordinator for the Environment Canada (EC) component."""
import logging import logging
import xml.etree.ElementTree as et import xml.etree.ElementTree as ET
from env_canada import ec_exc from env_canada import ec_exc
@ -27,6 +27,6 @@ class ECDataUpdateCoordinator(DataUpdateCoordinator):
"""Fetch data from EC.""" """Fetch data from EC."""
try: try:
await self.ec_data.update() 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 raise UpdateFailed(f"Error fetching {self.name} data: {ex}") from ex
return self.ec_data return self.ec_data

View File

@ -1,5 +1,5 @@
# Automatically generated from .pre-commit-config.yaml by gen_requirements_all.py, do not edit # Automatically generated from .pre-commit-config.yaml by gen_requirements_all.py, do not edit
codespell==2.3.0 codespell==2.3.0
ruff==0.5.7 ruff==0.6.0
yamllint==1.35.1 yamllint==1.35.1

View File

@ -1,7 +1,7 @@
"""Test the Environment Canada (EC) config flow.""" """Test the Environment Canada (EC) config flow."""
from unittest.mock import AsyncMock, MagicMock, Mock, patch from unittest.mock import AsyncMock, MagicMock, Mock, patch
import xml.etree.ElementTree as et import xml.etree.ElementTree as ET
import aiohttp import aiohttp
import pytest 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=404), "bad_station_id"),
(aiohttp.ClientResponseError(Mock(), (), status=400), "error_response"), (aiohttp.ClientResponseError(Mock(), (), status=400), "error_response"),
(aiohttp.ClientConnectionError, "cannot_connect"), (aiohttp.ClientConnectionError, "cannot_connect"),
(et.ParseError, "bad_station_id"), (ET.ParseError, "bad_station_id"),
(ValueError, "unknown"), (ValueError, "unknown"),
], ],
) )

View File

@ -1,7 +1,7 @@
"""Tests for LG Netcast TV.""" """Tests for LG Netcast TV."""
from unittest.mock import patch from unittest.mock import patch
from xml.etree import ElementTree import xml.etree.ElementTree as ET
from pylgnetcast import AccessTokenError, LgNetCastClient, SessionIdError from pylgnetcast import AccessTokenError, LgNetCastClient, SessionIdError
import requests import requests
@ -56,7 +56,7 @@ def _patched_lgnetcast_client(
if always_404: if always_404:
return None return None
if invalid_details: if invalid_details:
raise ElementTree.ParseError("Mocked Parsed Error") raise ET.ParseError("Mocked Parsed Error")
return { return {
"uuid": UNIQUE_ID if not no_unique_id else None, "uuid": UNIQUE_ID if not no_unique_id else None,
"model_name": MODEL_NAME, "model_name": MODEL_NAME,