Skip to content

Commit

Permalink
Bump Ruff to 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Nov 22, 2024
1 parent 34e7a2e commit 8559f4f
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
rev: v0.8.0
hooks:
- id: ruff
types: [file]
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,13 @@ select = [
"Q", # flake8-quotes
"RUF", # Ruff-specific rules
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"TC", # flake8-type-checking
"UP", # pyupgrade
"W", # Warning
"YTT", # flake8-2020
]
extend-ignore = [
'A002', # builtin-argument-shadowing
'ANN101', # missing-type-self
'ANN102', # missing-type-cls
'ANN401', # any-type (mypy's `disallow_any_explicit` is better)
'E402', # module-import-not-at-top-of-file (usually OS-specific)
'E501', # line-too-long
Expand Down
2 changes: 1 addition & 1 deletion src/trio/_dtls.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from types import TracebackType

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

from trio._socket import AddressFormat
Expand Down
3 changes: 1 addition & 2 deletions src/trio/_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from typing import (
TYPE_CHECKING,
Any,
Literal,
SupportsIndex,
TypeVar,
Union,
Expand Down Expand Up @@ -337,7 +336,7 @@ def fromshare(info: bytes) -> SocketType:
TypeT: TypeAlias = int
FamilyDefault = _stdlib_socket.AF_INET
else:
FamilyDefault: Literal[None] = None
FamilyDefault: None = None
FamilyT: TypeAlias = Union[int, AddressFamily, None]
TypeT: TypeAlias = Union[_stdlib_socket.socket, int]

Expand Down
2 changes: 1 addition & 1 deletion src/trio/_subprocess_platform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import trio

from .. import _core, _subprocess
from .._abc import ReceiveStream, SendStream # noqa: TCH001
from .._abc import ReceiveStream, SendStream # noqa: TC001

_wait_child_exiting_error: ImportError | None = None
_create_child_pipe_error: ImportError | None = None
Expand Down
4 changes: 2 additions & 2 deletions src/trio/_tests/test_testing_raisesgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ def check_errno_is_5(e: OSError) -> bool:
def test_matcher_tostring() -> None:
assert str(Matcher(ValueError)) == "Matcher(ValueError)"
assert str(Matcher(match="[a-z]")) == "Matcher(match='[a-z]')"
pattern_no_flags = re.compile("noflag", 0)
pattern_no_flags = re.compile(r"noflag", 0)
assert str(Matcher(match=pattern_no_flags)) == "Matcher(match='noflag')"
pattern_flags = re.compile("noflag", re.IGNORECASE)
pattern_flags = re.compile(r"noflag", re.IGNORECASE)
assert str(Matcher(match=pattern_flags)) == f"Matcher(match={pattern_flags!r})"
assert (
str(Matcher(ValueError, match="re", check=bool))
Expand Down
4 changes: 2 additions & 2 deletions src/trio/_tests/test_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def f(name: str) -> Callable[[None], threading.Thread]:
# test that you can set a custom name, and that it's reset afterwards
async def test_thread_name(name: str) -> None:
thread = await to_thread_run_sync(f(name), thread_name=name)
assert re.match("Trio thread [0-9]*", thread.name)
assert re.match(r"Trio thread [0-9]*", thread.name)

await test_thread_name("")
await test_thread_name("fobiedoo")
Expand Down Expand Up @@ -301,7 +301,7 @@ async def test_thread_name(name: str, expected: str | None = None) -> None:

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

await test_thread_name("")
await test_thread_name("fobiedoo")
Expand Down
2 changes: 1 addition & 1 deletion src/trio/testing/_raises_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _stringify_exception(exc: BaseException) -> str:


# String patterns default to including the unicode flag.
_regex_no_flags = re.compile("").flags
_regex_no_flags = re.compile(r"").flags


@final
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pytest==8.3.3
# via -r test-requirements.in
requests==2.32.3
# via sphinx
ruff==0.7.3
ruff==0.8.0
# via -r test-requirements.in
sniffio==1.3.1
# via -r test-requirements.in
Expand Down

0 comments on commit 8559f4f

Please sign in to comment.