diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 031d0659aad..2ed5a8bd8d3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.10.1 + rev: v2.11.0 hooks: - id: pyupgrade args: [--py38-plus] diff --git a/homeassistant/auth/models.py b/homeassistant/auth/models.py index aaef7e02174..758bbdb78e2 100644 --- a/homeassistant/auth/models.py +++ b/homeassistant/auth/models.py @@ -46,7 +46,7 @@ class User: credentials: list[Credentials] = attr.ib(factory=list, eq=False, order=False) # Tokens associated with a user. - refresh_tokens: dict[str, "RefreshToken"] = attr.ib( + refresh_tokens: dict[str, RefreshToken] = attr.ib( factory=dict, eq=False, order=False ) @@ -109,7 +109,7 @@ class RefreshToken: last_used_at: datetime | None = attr.ib(default=None) last_used_ip: str | None = attr.ib(default=None) - credential: "Credentials" | None = attr.ib(default=None) + credential: Credentials | None = attr.ib(default=None) version: str | None = attr.ib(default=__version__) diff --git a/homeassistant/components/esphome/entry_data.py b/homeassistant/components/esphome/entry_data.py index 4fada10a3d1..34ed6ffee46 100644 --- a/homeassistant/components/esphome/entry_data.py +++ b/homeassistant/components/esphome/entry_data.py @@ -63,7 +63,7 @@ class RuntimeEntryData: # If an entity can't find anything in the info array, it will look for info here. old_info: dict[str, dict[str, Any]] = attr.ib(factory=dict) - services: dict[int, "UserService"] = attr.ib(factory=dict) + services: dict[int, UserService] = attr.ib(factory=dict) available: bool = attr.ib(default=False) device_info: DeviceInfo | None = attr.ib(default=None) cleanup_callbacks: list[Callable[[], None]] = attr.ib(factory=list) diff --git a/homeassistant/components/http/web_runner.py b/homeassistant/components/http/web_runner.py index 74410026f94..87468d40954 100644 --- a/homeassistant/components/http/web_runner.py +++ b/homeassistant/components/http/web_runner.py @@ -25,7 +25,7 @@ class HomeAssistantTCPSite(web.BaseSite): def __init__( self, - runner: "web.BaseRunner", + runner: web.BaseRunner, host: None | str | list[str], port: int, *, diff --git a/homeassistant/components/wunderground/sensor.py b/homeassistant/components/wunderground/sensor.py index 9e4b764f34c..38d6bba0b1f 100644 --- a/homeassistant/components/wunderground/sensor.py +++ b/homeassistant/components/wunderground/sensor.py @@ -68,7 +68,7 @@ class WUSensorConfig: self, friendly_name: str | Callable, feature: str, - value: Callable[["WUndergroundData"], Any], + value: Callable[[WUndergroundData], Any], unit_of_measurement: str | None = None, entity_picture=None, icon: str = "mdi:gauge", diff --git a/homeassistant/components/zha/core/store.py b/homeassistant/components/zha/core/store.py index 43b41153657..9381c529187 100644 --- a/homeassistant/components/zha/core/store.py +++ b/homeassistant/components/zha/core/store.py @@ -93,7 +93,7 @@ class ZhaStorage: """Load the registry of zha device entries.""" data = await self._store.async_load() - devices: "OrderedDict[str, ZhaDeviceEntry]" = OrderedDict() + devices: OrderedDict[str, ZhaDeviceEntry] = OrderedDict() if data is not None: for device in data["devices"]: diff --git a/homeassistant/exceptions.py b/homeassistant/exceptions.py index 499d4052849..375db789618 100644 --- a/homeassistant/exceptions.py +++ b/homeassistant/exceptions.py @@ -115,7 +115,7 @@ class Unauthorized(HomeAssistantError): def __init__( self, - context: "Context" | None = None, + context: Context | None = None, user_id: str | None = None, entity_id: str | None = None, config_entry_id: str | None = None, diff --git a/homeassistant/helpers/device_registry.py b/homeassistant/helpers/device_registry.py index fac937c4afb..bfa04706d60 100644 --- a/homeassistant/helpers/device_registry.py +++ b/homeassistant/helpers/device_registry.py @@ -688,7 +688,7 @@ def async_config_entry_disabled_by_changed( def async_cleanup( hass: HomeAssistantType, dev_reg: DeviceRegistry, - ent_reg: "entity_registry.EntityRegistry", + ent_reg: entity_registry.EntityRegistry, ) -> None: """Clean up device registry.""" # Find all devices that are referenced by a config_entry. diff --git a/homeassistant/helpers/entity_registry.py b/homeassistant/helpers/entity_registry.py index 265dcd9d878..832838798ca 100644 --- a/homeassistant/helpers/entity_registry.py +++ b/homeassistant/helpers/entity_registry.py @@ -222,7 +222,7 @@ class EntityRegistry: # To disable an entity if it gets created disabled_by: str | None = None, # Data that we want entry to have - config_entry: "ConfigEntry" | None = None, + config_entry: ConfigEntry | None = None, device_id: str | None = None, area_id: str | None = None, capabilities: dict[str, Any] | None = None, diff --git a/homeassistant/helpers/sun.py b/homeassistant/helpers/sun.py index ded1b3a7123..5b23b3d0251 100644 --- a/homeassistant/helpers/sun.py +++ b/homeassistant/helpers/sun.py @@ -54,7 +54,7 @@ def get_astral_event_next( @callback def get_location_astral_event_next( - location: "astral.Location", + location: astral.Location, event: str, utc_point_in_time: datetime.datetime | None = None, offset: datetime.timedelta | None = None, diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index be881f09f7c..b8fabc685b1 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -9,5 +9,5 @@ flake8==3.8.4 isort==5.7.0 pydocstyle==5.1.1 python-typing-update==0.3.0 -pyupgrade==2.10.1 +pyupgrade==2.11.0 yamllint==1.24.2