Skip to content

Commit 283b5b2

Browse files
Enable the UP (pyupgrade) Ruff rules and use Python 3.8+ code, including in docs (#73)
Signed-off-by: Edgar Ramírez-Mondragón <[email protected]>
1 parent d3b8a69 commit 283b5b2

26 files changed

+38
-53
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ repos:
3030
rev: v2025.12.8.5
3131
hooks:
3232
- id: doccmd
33+
name: Ruff format docs
34+
alias: ruff-format-docs
3335
args: ["--language", "python", "--no-pad-file", "--no-pad-groups", "--command", "ruff format", "docs/"]
3436
additional_dependencies:
3537
- ruff==0.14.8
38+
- id: doccmd
39+
name: Ruff check fix docs
40+
alias: ruff-check-fix-docs
41+
args: ["--language", "python", "--no-pad-file", "--no-pad-groups", "--command", "ruff check --fix", "docs/"]
42+
additional_dependencies:
43+
- ruff==0.14.8

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
### Internal
1717

1818
- Use Ruff to give the codebase a consistent format [#66](https://github.com/python-backoff/backoff/pull/66) (from [@edgarrmondragon](https://github.com/edgarrmondragon))
19+
- Enable the `UP` (pyupgrade) Ruff rules and use Python 3.8+ code, including in docs [#73](https://github.com/python-backoff/backoff/pull/73) (from [@edgarrmondragon](https://github.com/edgarrmondragon))
1920

2021
## [v2.3.0] - 2025-11-28
2122

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ asynchronous HTTP client/server library.
374374
max_time=60,
375375
)
376376
async def get_url(url):
377-
async with aiohttp.ClientSession(raise_for_status=True) as session:
377+
async with aiohttp.ClientSession(raise_for_status=True) as session: # noqa: SIM117
378378
async with session.get(url) as response:
379379
return await response.text()
380380

backoff/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# coding:utf-8
21
"""
32
Function decoration for backoff and retry
43

backoff/_async.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# coding:utf-8
21
import asyncio
32
import functools
43
import inspect

backoff/_common.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# coding:utf-8
2-
31
import functools
42
import logging
53
import sys

backoff/_decorator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# coding:utf-8
21
import inspect
32
import logging
43
import operator

backoff/_jitter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# coding:utf-8
2-
31
import random
42

53

backoff/_sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# coding:utf-8
21
import functools
32
import time
43

backoff/_typing.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# coding:utf-8
21
import logging
3-
import sys
42
from types import FunctionType
53
from typing import (
64
Any,
@@ -10,22 +8,11 @@
108
Generator,
119
Sequence,
1210
Tuple,
11+
TypedDict,
1312
TypeVar,
1413
Union,
1514
)
1615

17-
if sys.version_info >= (3, 8): # pragma: no cover
18-
from typing import TypedDict
19-
else: # pragma: no cover
20-
# use typing_extensions if installed but don't require it
21-
try:
22-
from typing_extensions import TypedDict
23-
except ImportError:
24-
25-
class TypedDict(dict):
26-
def __init_subclass__(cls, **kwargs: Any) -> None:
27-
return super().__init_subclass__()
28-
2916

3017
class _Details(TypedDict):
3118
target: FunctionType

0 commit comments

Comments
 (0)