From 1dc25a5864f13077e9e6f0d4765c02953a04730d Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Thu, 25 Mar 2021 21:09:06 +0100 Subject: [PATCH] Bump python-typing-update to 0.3.2 (#48303) * Bump python-version-update to 0.3.2 * Changes after update * Fix pylint issues --- .pre-commit-config.yaml | 2 +- homeassistant/auth/permissions/models.py | 6 ++++-- homeassistant/components/deconz/fan.py | 5 ++--- homeassistant/components/yeelight/light.py | 6 ++++-- homeassistant/util/async_.py | 4 +++- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2ed5a8bd8d3..254ed637d81 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -69,7 +69,7 @@ repos: - id: prettier stages: [manual] - repo: https://github.com/cdce8p/python-typing-update - rev: v0.3.0 + rev: v0.3.2 hooks: # Run `python-typing-update` hook manually from time to time # to update python typing syntax. diff --git a/homeassistant/auth/permissions/models.py b/homeassistant/auth/permissions/models.py index b2d1955865a..aa1a777ced2 100644 --- a/homeassistant/auth/permissions/models.py +++ b/homeassistant/auth/permissions/models.py @@ -1,4 +1,6 @@ """Models for permissions.""" +from __future__ import annotations + from typing import TYPE_CHECKING import attr @@ -14,5 +16,5 @@ if TYPE_CHECKING: class PermissionLookup: """Class to hold data for permission lookups.""" - entity_registry: "ent_reg.EntityRegistry" = attr.ib() - device_registry: "dev_reg.DeviceRegistry" = attr.ib() + entity_registry: ent_reg.EntityRegistry = attr.ib() + device_registry: dev_reg.DeviceRegistry = attr.ib() diff --git a/homeassistant/components/deconz/fan.py b/homeassistant/components/deconz/fan.py index b8faa95a9b2..aca92f893c7 100644 --- a/homeassistant/components/deconz/fan.py +++ b/homeassistant/components/deconz/fan.py @@ -1,6 +1,5 @@ """Support for deCONZ fans.""" - -from typing import Optional +from __future__ import annotations from homeassistant.components.fan import ( DOMAIN, @@ -76,7 +75,7 @@ class DeconzFan(DeconzDevice, FanEntity): return self._device.speed != 0 @property - def percentage(self) -> Optional[int]: + def percentage(self) -> int | None: """Return the current speed percentage.""" if self._device.speed == 0: return 0 diff --git a/homeassistant/components/yeelight/light.py b/homeassistant/components/yeelight/light.py index 4c1cb9a0e82..218bcbbdb27 100644 --- a/homeassistant/components/yeelight/light.py +++ b/homeassistant/components/yeelight/light.py @@ -1,10 +1,13 @@ """Light platform support for yeelight.""" +from __future__ import annotations + from functools import partial import logging import voluptuous as vol import yeelight from yeelight import ( + Bulb, BulbException, Flow, RGBTransition, @@ -529,9 +532,8 @@ class YeelightGenericLight(YeelightEntity, LightEntity): """Return the current effect.""" return self._effect - # F821: https://github.com/PyCQA/pyflakes/issues/373 @property - def _bulb(self) -> "Bulb": # noqa: F821 + def _bulb(self) -> Bulb: return self.device.bulb @property diff --git a/homeassistant/util/async_.py b/homeassistant/util/async_.py index f61225502ee..0fd1b564f0d 100644 --- a/homeassistant/util/async_.py +++ b/homeassistant/util/async_.py @@ -1,4 +1,6 @@ """Asyncio utilities.""" +from __future__ import annotations + from asyncio import Semaphore, coroutines, ensure_future, gather, get_running_loop from asyncio.events import AbstractEventLoop import concurrent.futures @@ -38,7 +40,7 @@ def fire_coroutine_threadsafe(coro: Coroutine, loop: AbstractEventLoop) -> None: def run_callback_threadsafe( loop: AbstractEventLoop, callback: Callable[..., T], *args: Any -) -> "concurrent.futures.Future[T]": +) -> concurrent.futures.Future[T]: # pylint: disable=unsubscriptable-object """Submit a callback object to a given event loop. Return a concurrent.futures.Future to access the result.