From c2c23ffa2caa435e675b2cb999c664594f367efa Mon Sep 17 00:00:00 2001 From: T-256 Date: Wed, 9 Oct 2024 18:54:44 +0330 Subject: [PATCH 1/2] Move benchmark to scripts. --- requirements.txt | 8 -------- {tests/benchmark => scripts/bench}/client.py | 0 {tests/benchmark => scripts/bench}/server.py | 0 scripts/benchmark | 4 ++-- 4 files changed, 2 insertions(+), 10 deletions(-) rename {tests/benchmark => scripts/bench}/client.py (100%) rename {tests/benchmark => scripts/bench}/server.py (100%) diff --git a/requirements.txt b/requirements.txt index ba9471708..9df235dea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,15 +16,7 @@ twine==5.1.1 coverage[toml]==7.5.4 ruff==0.5.0 mypy==1.10.1 -trio-typing==0.10.0 pytest==8.2.2 pytest-httpbin==2.0.0 pytest-trio==0.8.0 werkzeug<3.1 # See: https://github.com/psf/httpbin/issues/35 - -# Benchmarking and profiling -uvicorn==0.30.1 -aiohttp==3.10.2 -urllib3==2.2.2 -matplotlib==3.7.5 -pyinstrument==4.6.2 diff --git a/tests/benchmark/client.py b/scripts/bench/client.py similarity index 100% rename from tests/benchmark/client.py rename to scripts/bench/client.py diff --git a/tests/benchmark/server.py b/scripts/bench/server.py similarity index 100% rename from tests/benchmark/server.py rename to scripts/bench/server.py diff --git a/scripts/benchmark b/scripts/benchmark index c6cfff210..8b59ab2f8 100755 --- a/scripts/benchmark +++ b/scripts/benchmark @@ -9,9 +9,9 @@ fi set -x -${PREFIX}python tests/benchmark/server.py & +${PREFIX}python scripts/bench/server.py & SERVER_PID=$! EXIT_CODE=0 -${PREFIX}python tests/benchmark/client.py "$@" || EXIT_CODE=$? +${PREFIX}python scripts/bench/client.py "$@" || EXIT_CODE=$? kill $SERVER_PID exit $EXIT_CODE From 86939e3b517a06295a5229b4fe4d8fc7895a1af4 Mon Sep 17 00:00:00 2001 From: T-256 Date: Wed, 9 Oct 2024 19:01:27 +0330 Subject: [PATCH 2/2] mypy --- httpcore/_backends/trio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpcore/_backends/trio.py b/httpcore/_backends/trio.py index b1626d28e..2a3685e27 100644 --- a/httpcore/_backends/trio.py +++ b/httpcore/_backends/trio.py @@ -84,7 +84,7 @@ def get_extra_info(self, info: str) -> typing.Any: if info == "ssl_object" and isinstance(self._stream, trio.SSLStream): # Type checkers cannot see `_ssl_object` attribute because trio._ssl.SSLStream uses __getattr__/__setattr__. # Tracked at https://github.com/python-trio/trio/issues/542 - return self._stream._ssl_object # type: ignore[attr-defined] + return self._stream._ssl_object if info == "client_addr": return self._get_socket_stream().socket.getsockname() if info == "server_addr":