Skip to content

Commit d792bc2

Browse files
committed
chore: switch to ruff, set minimum python version
1 parent 1ebac33 commit d792bc2

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

.pre-commit-config.yaml

+16-7
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,26 @@ repos:
3333
hooks:
3434
- id: prettier
3535
- repo: https://github.com/asottile/pyupgrade
36-
rev: v3.19.0
36+
rev: v3.19.1
3737
hooks:
3838
- id: pyupgrade
39-
- repo: https://github.com/PyCQA/isort
40-
rev: 5.13.2
39+
args: [--py311-plus]
40+
- repo: https://github.com/astral-sh/ruff-pre-commit
41+
rev: v0.8.4
4142
hooks:
42-
- id: isort
43-
- repo: https://github.com/psf/black-pre-commit-mirror
44-
rev: 24.10.0
43+
- id: ruff
44+
args: [--fix]
45+
- id: ruff-format
46+
- repo: https://github.com/cdce8p/python-typing-update
47+
rev: v0.7.0
4548
hooks:
46-
- id: black
49+
- id: python-typing-update
50+
stages: [manual]
51+
args:
52+
- --py311-plus
53+
- --force
54+
- --keep-updates
55+
files: ^(switchbot)/.+\.py$
4756
- repo: https://github.com/codespell-project/codespell
4857
rev: v2.3.0
4958
hooks:

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
author="Daniel Hjelseth Hoyer",
2323
url="https://github.com/sblibs/pySwitchbot/",
2424
license="MIT",
25+
python_requires=">=3.11",
2526
classifiers=[
2627
"Development Status :: 3 - Alpha",
2728
"Environment :: Other Environment",

switchbot/devices/device.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
import time
99
from dataclasses import replace
1010
from enum import Enum
11-
from typing import Any, Callable, TypeVar, cast
11+
from typing import Any, TypeVar, cast
12+
from collections.abc import Callable
1213
from uuid import UUID
1314

1415
from bleak.backends.device import BLEDevice
@@ -470,7 +471,7 @@ async def _execute_command_locked(self, key: str, command: bytes) -> bytes:
470471
timeout_expired = False
471472
try:
472473
notify_msg = await self._notify_future
473-
except asyncio.TimeoutError:
474+
except TimeoutError:
474475
timeout_expired = True
475476
raise
476477
finally:

switchbot/devices/relay_switch.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import asyncio
21
import logging
32
import time
43
from typing import Any

0 commit comments

Comments
 (0)