Unignore Ruff UP006, UP007 (#115533)

This commit is contained in:
Sid 2024-04-14 07:26:58 +02:00 committed by GitHub
parent c24ae01a43
commit 0200d1aa66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 10 additions and 17 deletions

View file

@ -4,7 +4,7 @@ from __future__ import annotations
from collections.abc import Awaitable, Callable
import logging
from typing import Any, Optional
from typing import Any
import pyaprilaire.client
from pyaprilaire.const import MODELS, Attribute, FunctionalDomain
@ -155,7 +155,7 @@ class AprilaireCoordinator(BaseDataUpdateCoordinatorProtocol):
return self.create_device_name(self.data)
def create_device_name(self, data: Optional[dict[str, Any]]) -> str:
def create_device_name(self, data: dict[str, Any] | None) -> str:
"""Create the name of the thermostat."""
name = data.get(Attribute.NAME) if data else None

View file

@ -5,7 +5,6 @@ from __future__ import annotations
from contextlib import AsyncExitStack
from datetime import timedelta
import logging
from typing import Optional
from aiohttp import CookieJar
from tesla_powerwall import (
@ -244,7 +243,7 @@ async def _call_base_info(power_wall: Powerwall, host: str) -> PowerwallBaseInfo
)
async def get_backup_reserve_percentage(power_wall: Powerwall) -> Optional[float]:
async def get_backup_reserve_percentage(power_wall: Powerwall) -> float | None:
"""Return the backup reserve percentage."""
try:
return await power_wall.get_backup_reserve_percentage()

View file

@ -760,8 +760,6 @@ ignore = [
"SIM115", # Use context handler for opening files
"TRY003", # Avoid specifying long messages outside the exception class
"TRY400", # Use `logging.exception` instead of `logging.error`
"UP006", # keep type annotation style as is
"UP007", # keep type annotation style as is
# Ignored due to performance: https://github.com/charliermarsh/ruff/issues/2923
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
# Ignored due to incompatible with mypy: https://github.com/python/mypy/issues/15238

View file

@ -3,7 +3,6 @@
from __future__ import annotations
from collections.abc import Generator
from typing import Union
from unittest.mock import AsyncMock, MagicMock, patch
from crownstone_cloud.cloud_models.spheres import Spheres
@ -31,7 +30,7 @@ from homeassistant.data_entry_flow import FlowResultType
from tests.common import MockConfigEntry
MockFixture = Generator[Union[MagicMock, AsyncMock], None, None]
MockFixture = Generator[MagicMock | AsyncMock, None, None]
@pytest.fixture(name="crownstone_setup")

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Final, Union
from typing import Final
from unittest.mock import ANY, Mock, call
from async_upnp_client.exceptions import UpnpActionError, UpnpConnectionError, UpnpError
@ -38,7 +38,7 @@ pytestmark = [
]
BrowseResultList = list[Union[didl_lite.DidlObject, didl_lite.Descriptor]]
BrowseResultList = list[didl_lite.DidlObject | didl_lite.Descriptor]
async def async_resolve_media(

View file

@ -1,7 +1,5 @@
"""Tests for the FinTS client."""
from typing import Optional
from fints.client import BankIdentifier, FinTSOperations
import pytest
@ -51,10 +49,10 @@ BANK_INFORMATION = {
],
)
async def test_account_type(
account_number: Optional[str],
iban: Optional[str],
account_number: str | None,
iban: str | None,
product_name: str,
account_type: Optional[int],
account_type: int | None,
expected_balance_result: bool,
expected_holdings_result: bool,
) -> None:

View file

@ -1,7 +1,6 @@
"""Configuration for 17Track tests."""
from collections.abc import Generator
from typing import Optional
from unittest.mock import AsyncMock, patch
from py17track.package import Package
@ -129,7 +128,7 @@ def mock_seventeentrack():
def get_package(
tracking_number: str = "456",
destination_country: int = 206,
friendly_name: Optional[str] = "friendly name 1",
friendly_name: str | None = "friendly name 1",
info_text: str = "info text 1",
location: str = "location 1",
timestamp: str = "2020-08-10 10:32",