Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump dependencies from commit 8d37eb #3146

Merged
merged 6 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.8.0
rev: v0.8.1
hooks:
- id: ruff
types: [file]
Expand Down
10 changes: 5 additions & 5 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ colorama==0.4.6 ; sys_platform == 'win32' or platform_system == 'Windows'
# via
# click
# sphinx
cryptography==43.0.3
cryptography==44.0.0
# via pyopenssl
docutils==0.21.2
# via
Expand All @@ -49,13 +49,13 @@ markupsafe==3.0.2
# via jinja2
outcome==1.3.0.post0
# via -r docs-requirements.in
packaging==24.1
packaging==24.2
# via sphinx
pycparser==2.22 ; platform_python_implementation != 'PyPy' or os_name == 'nt'
# via cffi
pygments==2.18.0
# via sphinx
pyopenssl==24.2.1
pyopenssl==24.3.0
# via -r docs-requirements.in
requests==2.32.3
# via sphinx
Expand All @@ -77,9 +77,9 @@ sphinx==8.1.3
# sphinxcontrib-trio
sphinx-codeautolink==0.15.2
# via -r docs-requirements.in
sphinx-hoverxref==1.4.1
sphinx-hoverxref==1.4.2
# via -r docs-requirements.in
sphinx-rtd-theme==3.0.1
sphinx-rtd-theme==3.0.2
# via -r docs-requirements.in
sphinxcontrib-applehelp==2.0.0
# via sphinx
Expand Down
6 changes: 4 additions & 2 deletions src/trio/_core/_concat_tb.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from __future__ import annotations

from types import TracebackType
from typing import TYPE_CHECKING, ClassVar, cast

if TYPE_CHECKING:
from types import TracebackType

################################################################
# concat_tb
################################################################
Expand Down Expand Up @@ -107,7 +109,7 @@ def controller( # type: ignore[no-any-unimported]
return operation.delegate() # type: ignore[no-any-return]

return cast(
TracebackType,
"TracebackType",
tputil.make_proxy(controller, type(base_tb), base_tb),
) # Returns proxy to traceback

Expand Down
10 changes: 5 additions & 5 deletions src/trio/_core/_io_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@

lpOverlapped = ffi.new("LPOVERLAPPED")

poll_info = cast(_AFDPollInfo, ffi.new("AFD_POLL_INFO *"))
poll_info = cast("_AFDPollInfo", ffi.new("AFD_POLL_INFO *"))

Check warning on line 703 in src/trio/_core/_io_windows.py

View check run for this annotation

Codecov / codecov/patch

src/trio/_core/_io_windows.py#L703

Added line #L703 was not covered by tests
poll_info.Timeout = 2**63 - 1 # INT64_MAX
poll_info.NumberOfHandles = 1
poll_info.Exclusive = 0
Expand All @@ -713,9 +713,9 @@
kernel32.DeviceIoControl(
afd_group.handle,
IoControlCodes.IOCTL_AFD_POLL,
cast(CType, poll_info),
cast("CType", poll_info),
ffi.sizeof("AFD_POLL_INFO"),
cast(CType, poll_info),
cast("CType", poll_info),
ffi.sizeof("AFD_POLL_INFO"),
ffi.NULL,
lpOverlapped,
Expand Down Expand Up @@ -937,13 +937,13 @@
# operation will not be cancellable, depending on how Windows is
# feeling today. So we need to check for cancellation manually.
await _core.checkpoint_if_cancelled()
lpOverlapped = cast(_Overlapped, ffi.new("LPOVERLAPPED"))
lpOverlapped = cast("_Overlapped", ffi.new("LPOVERLAPPED"))

Check warning on line 940 in src/trio/_core/_io_windows.py

View check run for this annotation

Codecov / codecov/patch

src/trio/_core/_io_windows.py#L940

Added line #L940 was not covered by tests
try:
submit_fn(lpOverlapped)
except OSError as exc:
if exc.winerror != ErrorCodes.ERROR_IO_PENDING:
raise
await self.wait_overlapped(handle, cast(CData, lpOverlapped))
await self.wait_overlapped(handle, cast("CData", lpOverlapped))

Check warning on line 946 in src/trio/_core/_io_windows.py

View check run for this annotation

Codecov / codecov/patch

src/trio/_core/_io_windows.py#L946

Added line #L946 was not covered by tests
return lpOverlapped

@_public
Expand Down
2 changes: 1 addition & 1 deletion src/trio/_core/_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class RunVar(Generic[T]):
def get(self, default: T | type[_NoValue] = _NoValue) -> T:
"""Gets the value of this :class:`RunVar` for the current run call."""
try:
return cast(T, _run.GLOBAL_RUN_CONTEXT.runner._locals[self])
return cast("T", _run.GLOBAL_RUN_CONTEXT.runner._locals[self])
except AttributeError:
raise RuntimeError("Cannot be used outside of a run context") from None
except KeyError:
Expand Down
6 changes: 3 additions & 3 deletions src/trio/_core/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ def started(self: _TaskStatus[StatusT], value: StatusT) -> None: ...
def started(self, value: StatusT | None = None) -> None:
if self._value is not _NoStatus:
raise RuntimeError("called 'started' twice on the same task status")
self._value = cast(StatusT, value) # If None, StatusT == None
self._value = cast("StatusT", value) # If None, StatusT == None

# If the old nursery is cancelled, then quietly quit now; the child
# will eventually exit on its own, and we don't want to risk moving
Expand Down Expand Up @@ -2407,7 +2407,7 @@ def run(
# Inlined copy of runner.main_task_outcome.unwrap() to avoid
# cluttering every single Trio traceback with an extra frame.
if isinstance(runner.main_task_outcome, Value):
return cast(RetT, runner.main_task_outcome.value)
return cast("RetT", runner.main_task_outcome.value)
elif isinstance(runner.main_task_outcome, Error):
raise runner.main_task_outcome.error
else: # pragma: no cover
Expand Down Expand Up @@ -2531,7 +2531,7 @@ def my_done_callback(run_outcome):
# this time, so it shouldn't be possible to get an exception here,
# except for a TrioInternalError.
next_send = cast(
EventResult,
"EventResult",
None,
) # First iteration must be `None`, every iteration after that is EventResult
for _tick in range(5): # expected need is 2 iterations + leave some wiggle room
Expand Down
2 changes: 1 addition & 1 deletion src/trio/_core/_tests/test_guest_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def trio_done_callback(main_outcome: Outcome[T]) -> None:
trio_done_fut.set_result(main_outcome)

if pass_not_threadsafe:
run_sync_soon_not_threadsafe = cast(InHost, loop.call_soon)
run_sync_soon_not_threadsafe = cast("InHost", loop.call_soon)

trio.lowlevel.start_guest_run(
trio_fn,
Expand Down
5 changes: 2 additions & 3 deletions src/trio/_core/_traps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import enum
import types
from collections.abc import Awaitable

# Jedi gets mad in test_static_tool_sees_class_members if we use collections Callable
from typing import TYPE_CHECKING, Any, Callable, NoReturn, Union, cast
Expand All @@ -15,7 +14,7 @@
from . import _run

if TYPE_CHECKING:
from collections.abc import Generator
from collections.abc import Awaitable, Generator

from typing_extensions import TypeAlias

Expand Down Expand Up @@ -67,7 +66,7 @@ def _real_async_yield(
# Real yield value is from trio's main loop, but type checkers can't
# understand that, so we cast it to make type checkers understand.
_async_yield = cast(
Callable[[MessageType], Awaitable[outcome.Outcome[object]]],
"Callable[[MessageType], Awaitable[outcome.Outcome[object]]]",
_real_async_yield,
)

Expand Down
6 changes: 3 additions & 3 deletions src/trio/_core/_windows_cffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@
hEvent: Handle


kernel32 = cast(_Kernel32, ffi.dlopen("kernel32.dll"))
ntdll = cast(_Nt, ffi.dlopen("ntdll.dll"))
ws2_32 = cast(_Ws2, ffi.dlopen("ws2_32.dll"))
kernel32 = cast("_Kernel32", ffi.dlopen("kernel32.dll"))
ntdll = cast("_Nt", ffi.dlopen("ntdll.dll"))
ws2_32 = cast("_Ws2", ffi.dlopen("ws2_32.dll"))

Check warning on line 400 in src/trio/_core/_windows_cffi.py

View check run for this annotation

Codecov / codecov/patch

src/trio/_core/_windows_cffi.py#L398-L400

Added lines #L398 - L400 were not covered by tests

################################################################
# Magic numbers
Expand Down
2 changes: 1 addition & 1 deletion src/trio/_tests/test_highlevel_open_tcp_listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ async def handler(stream: SendStream) -> None:
# nursery.start is incorrectly typed, awaiting #2773
value = await nursery.start(serve_tcp, handler, 0)
assert isinstance(value, list)
listeners = cast(list[SocketListener], value)
listeners = cast("list[SocketListener]", value)
stream = await open_stream_to_socket_listener(listeners[0])
async with stream:
assert await stream.receive_some(1) == b"x"
Expand Down
2 changes: 1 addition & 1 deletion src/trio/_tests/test_highlevel_serve_listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def do_tests(parent_nursery: Nursery) -> None:
listeners,
)
assert isinstance(value, list)
l2 = cast(list[MemoryListener], value)
l2 = cast("list[MemoryListener]", value)
assert l2 == listeners
# This is just split into another function because gh-136 isn't
# implemented yet
Expand Down
7 changes: 4 additions & 3 deletions src/trio/_tests/test_highlevel_ssl_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
import trio.testing
from trio.socket import AF_INET, IPPROTO_TCP, SOCK_STREAM

from .._highlevel_socket import SocketListener
from .._highlevel_ssl_helpers import (
open_ssl_over_tcp_listeners,
open_ssl_over_tcp_stream,
serve_ssl_over_tcp,
)
from .._ssl import SSLListener

# using noqa because linters don't understand how pytest fixtures work.
from .test_ssl import SERVER_CTX, client_ctx # noqa: F401
Expand All @@ -27,6 +25,9 @@

from trio.abc import Stream

from .._highlevel_socket import SocketListener
from .._ssl import SSLListener


async def echo_handler(stream: Stream) -> None:
async with stream:
Expand Down Expand Up @@ -92,7 +93,7 @@ async def test_open_ssl_over_tcp_stream_and_everything_else(
),
)
assert isinstance(value, list)
res = cast(list[SSLListener[SocketListener]], value) # type: ignore[type-var]
res = cast("list[SSLListener[SocketListener]]", value) # type: ignore[type-var]
(listener,) = res
async with listener:
# listener.transport_listener is of type Listener[Stream]
Expand Down
2 changes: 1 addition & 1 deletion src/trio/_tests/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ async def res(
local=local, # noqa: B023 # local is not bound in function definition
)
assert isinstance(value, tuple)
return cast(tuple[Union[str, int], ...], value)
return cast("tuple[Union[str, int], ...]", value)

assert_eq(await res((addrs.arbitrary, "http")), (addrs.arbitrary, 80))
if v6:
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 @@ -242,7 +242,7 @@ def matches(self, exception: BaseException) -> TypeGuard[MatchE]:
return False
# If exception_type is None check() accepts BaseException.
# If non-none, we have done an isinstance check above.
return self.check is None or self.check(cast(MatchE, exception))
return self.check is None or self.check(cast("MatchE", exception))

def __str__(self) -> str:
reqs = []
Expand Down
22 changes: 11 additions & 11 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ colorama==0.4.6 ; (implementation_name != 'cpython' and sys_platform == 'win32')
# pylint
# pytest
# sphinx
coverage==7.6.4
coverage==7.6.8
# via -r test-requirements.in
cryptography==43.0.3
# via
Expand Down Expand Up @@ -63,7 +63,7 @@ iniconfig==2.0.0
# via pytest
isort==5.13.2
# via pylint
jedi==0.19.1 ; implementation_name == 'cpython'
jedi==0.19.2 ; implementation_name == 'cpython'
# via -r test-requirements.in
jinja2==3.1.4
# via sphinx
Expand All @@ -80,11 +80,11 @@ mypy-extensions==1.0.0
# mypy
nodeenv==1.9.1
# via pyright
orjson==3.10.10 ; implementation_name == 'cpython'
orjson==3.10.12 ; implementation_name == 'cpython'
# via -r test-requirements.in
outcome==1.3.0.post0
# via -r test-requirements.in
packaging==24.1
packaging==24.2
# via
# black
# pytest
Expand All @@ -107,13 +107,13 @@ pylint==3.3.1
# via -r test-requirements.in
pyopenssl==24.2.1
# via -r test-requirements.in
pyright==1.1.387
pyright==1.1.389
# via -r test-requirements.in
pytest==8.3.3
# via -r test-requirements.in
requests==2.32.3
# via sphinx
ruff==0.8.0
ruff==0.8.1
# via -r test-requirements.in
sniffio==1.3.1
# via -r test-requirements.in
Expand All @@ -135,7 +135,7 @@ sphinxcontrib-qthelp==2.0.0
# via sphinx
sphinxcontrib-serializinghtml==2.0.0
# via sphinx
tomli==2.0.2 ; python_full_version < '3.11'
tomli==2.2.1 ; python_full_version < '3.11'
# via
# black
# mypy
Expand All @@ -150,11 +150,11 @@ types-cffi==1.16.0.20240331
# via
# -r test-requirements.in
# types-pyopenssl
types-docutils==0.21.0.20241005
types-docutils==0.21.0.20241128
# via -r test-requirements.in
types-pyopenssl==24.1.0.20240722
# via -r test-requirements.in
types-setuptools==75.2.0.20241025
types-setuptools==75.6.0.20241126
# via types-cffi
typing-extensions==4.12.2
# via
Expand All @@ -166,7 +166,7 @@ typing-extensions==4.12.2
# pyright
urllib3==2.2.3
# via requests
uv==0.4.29
uv==0.5.5
# via -r test-requirements.in
zipp==3.20.2 ; python_full_version < '3.10'
zipp==3.21.0 ; python_full_version < '3.10'
# via importlib-metadata