diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f3ef50..1fc54b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,17 +33,26 @@ repos: hooks: - id: prettier - repo: https://github.com/asottile/pyupgrade - rev: v3.19.0 + rev: v3.19.1 hooks: - id: pyupgrade - - repo: https://github.com/PyCQA/isort - rev: 5.13.2 + args: [--py311-plus] + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.8.4 hooks: - - id: isort - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.10.0 + - id: ruff + args: [--fix] + - id: ruff-format + - repo: https://github.com/cdce8p/python-typing-update + rev: v0.7.0 hooks: - - id: black + - id: python-typing-update + stages: [manual] + args: + - --py311-plus + - --force + - --keep-updates + files: ^(switchbot)/.+\.py$ - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: diff --git a/setup.py b/setup.py index 7b0d66f..d99d994 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,7 @@ author="Daniel Hjelseth Hoyer", url="https://github.com/sblibs/pySwitchbot/", license="MIT", + python_requires=">=3.11", classifiers=[ "Development Status :: 3 - Alpha", "Environment :: Other Environment", diff --git a/switchbot/devices/device.py b/switchbot/devices/device.py index 9a6aa25..3a8806f 100644 --- a/switchbot/devices/device.py +++ b/switchbot/devices/device.py @@ -8,7 +8,8 @@ import time from dataclasses import replace from enum import Enum -from typing import Any, Callable, TypeVar, cast +from typing import Any, TypeVar, cast +from collections.abc import Callable from uuid import UUID import aiohttp @@ -509,7 +510,7 @@ async def _execute_command_locked(self, key: str, command: bytes) -> bytes: timeout_expired = False try: notify_msg = await self._notify_future - except asyncio.TimeoutError: + except TimeoutError: timeout_expired = True raise finally: