Skip to content

Commit 532ba5f

Browse files
authored
Merge pull request #3143 from AlexWaygood/update-ruff
2 parents 34e7a2e + 82028f1 commit 532ba5f

File tree

10 files changed

+12
-15
lines changed

10 files changed

+12
-15
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repos:
2222
hooks:
2323
- id: black
2424
- repo: https://github.com/astral-sh/ruff-pre-commit
25-
rev: v0.7.4
25+
rev: v0.8.0
2626
hooks:
2727
- id: ruff
2828
types: [file]

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,13 @@ select = [
125125
"Q", # flake8-quotes
126126
"RUF", # Ruff-specific rules
127127
"SIM", # flake8-simplify
128-
"TCH", # flake8-type-checking
128+
"TC", # flake8-type-checking
129129
"UP", # pyupgrade
130130
"W", # Warning
131131
"YTT", # flake8-2020
132132
]
133133
extend-ignore = [
134134
'A002', # builtin-argument-shadowing
135-
'ANN101', # missing-type-self
136-
'ANN102', # missing-type-cls
137135
'ANN401', # any-type (mypy's `disallow_any_explicit` is better)
138136
'E402', # module-import-not-at-top-of-file (usually OS-specific)
139137
'E501', # line-too-long

src/trio/_dtls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from types import TracebackType
3737

3838
# See DTLSEndpoint.__init__ for why this is imported here
39-
from OpenSSL import SSL # noqa: TCH004
39+
from OpenSSL import SSL # noqa: TC004
4040
from typing_extensions import Self, TypeAlias, TypeVarTuple, Unpack
4141

4242
from trio._socket import AddressFormat

src/trio/_socket.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from typing import (
1313
TYPE_CHECKING,
1414
Any,
15-
Literal,
1615
SupportsIndex,
1716
TypeVar,
1817
Union,
@@ -337,7 +336,7 @@ def fromshare(info: bytes) -> SocketType:
337336
TypeT: TypeAlias = int
338337
FamilyDefault = _stdlib_socket.AF_INET
339338
else:
340-
FamilyDefault: Literal[None] = None
339+
FamilyDefault: None = None
341340
FamilyT: TypeAlias = Union[int, AddressFamily, None]
342341
TypeT: TypeAlias = Union[_stdlib_socket.socket, int]
343342

src/trio/_subprocess_platform/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import trio
99

1010
from .. import _core, _subprocess
11-
from .._abc import ReceiveStream, SendStream # noqa: TCH001
11+
from .._abc import ReceiveStream, SendStream # noqa: TC001
1212

1313
_wait_child_exiting_error: ImportError | None = None
1414
_create_child_pipe_error: ImportError | None = None

src/trio/_tests/test_testing_raisesgroup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,9 @@ def check_errno_is_5(e: OSError) -> bool:
353353
def test_matcher_tostring() -> None:
354354
assert str(Matcher(ValueError)) == "Matcher(ValueError)"
355355
assert str(Matcher(match="[a-z]")) == "Matcher(match='[a-z]')"
356-
pattern_no_flags = re.compile("noflag", 0)
356+
pattern_no_flags = re.compile(r"noflag", 0)
357357
assert str(Matcher(match=pattern_no_flags)) == "Matcher(match='noflag')"
358-
pattern_flags = re.compile("noflag", re.IGNORECASE)
358+
pattern_flags = re.compile(r"noflag", re.IGNORECASE)
359359
assert str(Matcher(match=pattern_flags)) == f"Matcher(match={pattern_flags!r})"
360360
assert (
361361
str(Matcher(ValueError, match="re", check=bool))

src/trio/_tests/test_threads.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def f(name: str) -> Callable[[None], threading.Thread]:
220220
# test that you can set a custom name, and that it's reset afterwards
221221
async def test_thread_name(name: str) -> None:
222222
thread = await to_thread_run_sync(f(name), thread_name=name)
223-
assert re.match("Trio thread [0-9]*", thread.name)
223+
assert re.match(r"Trio thread [0-9]*", thread.name)
224224

225225
await test_thread_name("")
226226
await test_thread_name("fobiedoo")
@@ -301,7 +301,7 @@ async def test_thread_name(name: str, expected: str | None = None) -> None:
301301

302302
os_thread_name = _get_thread_name(thread.ident)
303303
assert os_thread_name is not None, "should skip earlier if this is the case"
304-
assert re.match("Trio thread [0-9]*", os_thread_name)
304+
assert re.match(r"Trio thread [0-9]*", os_thread_name)
305305

306306
await test_thread_name("")
307307
await test_thread_name("fobiedoo")

src/trio/testing/_raises_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def _stringify_exception(exc: BaseException) -> str:
147147

148148

149149
# String patterns default to including the unicode flag.
150-
_regex_no_flags = re.compile("").flags
150+
_regex_no_flags = re.compile(r"").flags
151151

152152

153153
@final

test-requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cryptography>=41.0.0 # cryptography<41 segfaults on pypy3.10
1313
black; implementation_name == "cpython"
1414
mypy # Would use mypy[faster-cache], but orjson has build issues on pypy
1515
orjson; implementation_name == "cpython"
16-
ruff >= 0.6.6
16+
ruff >= 0.8.0
1717
astor # code generation
1818
uv >= 0.2.24
1919
codespell

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pytest==8.3.3
113113
# via -r test-requirements.in
114114
requests==2.32.3
115115
# via sphinx
116-
ruff==0.7.3
116+
ruff==0.8.0
117117
# via -r test-requirements.in
118118
sniffio==1.3.1
119119
# via -r test-requirements.in

0 commit comments

Comments
 (0)