From 4f87c1f30f974e4b31ebce27025784f5d07e6ecf Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 23 Jan 2023 09:59:44 +0100 Subject: [PATCH] Update pre-commit-config [Py310] (#86415) --- .pre-commit-config.yaml | 4 ++-- homeassistant/helpers/service.py | 3 +-- tests/components/bluetooth/test_wrappers.py | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 088bbdac6ac..0bc71b75912 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: rev: v3.3.1 hooks: - id: pyupgrade - args: [--py39-plus] + args: [--py310-plus] - repo: https://github.com/PyCQA/autoflake rev: v2.0.0 hooks: @@ -84,7 +84,7 @@ repos: - id: python-typing-update stages: [manual] args: - - --py39-plus + - --py310-plus - --force - --keep-updates files: ^(homeassistant|tests|script)/.+\.py$ diff --git a/homeassistant/helpers/service.py b/homeassistant/helpers/service.py index 368b8dc253f..ef8bee1fc7e 100644 --- a/homeassistant/helpers/service.py +++ b/homeassistant/helpers/service.py @@ -6,9 +6,8 @@ from collections.abc import Awaitable, Callable, Iterable import dataclasses from functools import partial, wraps import logging -from typing import TYPE_CHECKING, Any, TypedDict, TypeVar +from typing import TYPE_CHECKING, Any, TypedDict, TypeGuard, TypeVar -from typing_extensions import TypeGuard import voluptuous as vol from homeassistant.auth.permissions.const import CAT_ENTITIES, POLICY_CONTROL diff --git a/tests/components/bluetooth/test_wrappers.py b/tests/components/bluetooth/test_wrappers.py index be3ec1f8b8e..b2be6bf7280 100644 --- a/tests/components/bluetooth/test_wrappers.py +++ b/tests/components/bluetooth/test_wrappers.py @@ -1,8 +1,7 @@ """Tests for the Bluetooth integration.""" - +from __future__ import annotations from collections.abc import Callable -from typing import Union from unittest.mock import patch import bleak @@ -66,7 +65,7 @@ class FakeScanner(BaseHaRemoteScanner): class BaseFakeBleakClient: """Base class for fake bleak clients.""" - def __init__(self, address_or_ble_device: Union[BLEDevice, str], **kwargs): + def __init__(self, address_or_ble_device: BLEDevice | str, **kwargs): """Initialize the fake bleak client.""" self._device_path = "/dev/test" self._device = address_or_ble_device