From d28d491a344069d2a8772fbea647fb292e2894cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 08:49:23 +0000 Subject: [PATCH] Bump ruff from 0.1.6 to 0.1.9 (#2396) * Bump ruff from 0.1.6 to 0.1.9 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.6 to 0.1.9. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.1.6...v0.1.9) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix code --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Marcelo Trylesinski --- requirements.txt | 2 +- starlette/authentication.py | 2 +- starlette/routing.py | 6 ++++-- tests/middleware/test_base.py | 18 +++++++++--------- tests/test_background.py | 2 +- tests/test_routing.py | 2 +- tests/test_websockets.py | 2 +- 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/requirements.txt b/requirements.txt index f021f3abe..e29047328 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ coverage==7.4.0 importlib-metadata==7.0.1 mypy==1.7.1 -ruff==0.1.6 +ruff==0.1.9 typing_extensions==4.9.0 types-contextvars==2.4.7.3 types-PyYAML==6.0.12.12 diff --git a/starlette/authentication.py b/starlette/authentication.py index 494c50a57..07f271c49 100644 --- a/starlette/authentication.py +++ b/starlette/authentication.py @@ -35,7 +35,7 @@ def requires( scopes_list = [scopes] if isinstance(scopes, str) else list(scopes) def decorator( - func: typing.Callable[_P, typing.Any] + func: typing.Callable[_P, typing.Any], ) -> typing.Callable[_P, typing.Any]: sig = inspect.signature(func) for idx, parameter in enumerate(sig.parameters.values()): diff --git a/starlette/routing.py b/starlette/routing.py index c8c854d2c..0ced9e667 100644 --- a/starlette/routing.py +++ b/starlette/routing.py @@ -55,7 +55,9 @@ def iscoroutinefunction_or_partial(obj: typing.Any) -> bool: # pragma: no cover def request_response( - func: typing.Callable[[Request], typing.Union[typing.Awaitable[Response], Response]] + func: typing.Callable[ + [Request], typing.Union[typing.Awaitable[Response], Response] + ], ) -> ASGIApp: """ Takes a function or coroutine `func(request) -> response`, @@ -78,7 +80,7 @@ async def app(scope: Scope, receive: Receive, send: Send) -> None: def websocket_session( - func: typing.Callable[[WebSocket], typing.Awaitable[None]] + func: typing.Callable[[WebSocket], typing.Awaitable[None]], ) -> ASGIApp: """ Takes a coroutine `func(session)`, and returns an ASGI application. diff --git a/tests/middleware/test_base.py b/tests/middleware/test_base.py index 4d51f34bf..012e2c1ff 100644 --- a/tests/middleware/test_base.py +++ b/tests/middleware/test_base.py @@ -499,7 +499,7 @@ async def downstream_app(scope, receive, send): def test_read_request_stream_in_app_after_middleware_calls_stream( - test_client_factory: Callable[[ASGIApp], TestClient] + test_client_factory: Callable[[ASGIApp], TestClient], ) -> None: async def homepage(request: Request): expected = [b""] @@ -527,7 +527,7 @@ async def dispatch(self, request: Request, call_next: RequestResponseEndpoint): def test_read_request_stream_in_app_after_middleware_calls_body( - test_client_factory: Callable[[ASGIApp], TestClient] + test_client_factory: Callable[[ASGIApp], TestClient], ) -> None: async def homepage(request: Request): expected = [b"a", b""] @@ -552,7 +552,7 @@ async def dispatch(self, request: Request, call_next: RequestResponseEndpoint): def test_read_request_body_in_app_after_middleware_calls_stream( - test_client_factory: Callable[[ASGIApp], TestClient] + test_client_factory: Callable[[ASGIApp], TestClient], ) -> None: async def homepage(request: Request): assert await request.body() == b"" @@ -577,7 +577,7 @@ async def dispatch(self, request: Request, call_next: RequestResponseEndpoint): def test_read_request_body_in_app_after_middleware_calls_body( - test_client_factory: Callable[[ASGIApp], TestClient] + test_client_factory: Callable[[ASGIApp], TestClient], ) -> None: async def homepage(request: Request): assert await request.body() == b"a" @@ -599,7 +599,7 @@ async def dispatch(self, request: Request, call_next: RequestResponseEndpoint): def test_read_request_stream_in_dispatch_after_app_calls_stream( - test_client_factory: Callable[[ASGIApp], TestClient] + test_client_factory: Callable[[ASGIApp], TestClient], ) -> None: async def homepage(request: Request): expected = [b"a", b""] @@ -627,7 +627,7 @@ async def dispatch(self, request: Request, call_next: RequestResponseEndpoint): def test_read_request_stream_in_dispatch_after_app_calls_body( - test_client_factory: Callable[[ASGIApp], TestClient] + test_client_factory: Callable[[ASGIApp], TestClient], ) -> None: async def homepage(request: Request): assert await request.body() == b"a" @@ -705,7 +705,7 @@ async def send(msg: Message) -> None: def test_read_request_stream_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next( # noqa: E501 - test_client_factory: Callable[[ASGIApp], TestClient] + test_client_factory: Callable[[ASGIApp], TestClient], ) -> None: async def homepage(request: Request): assert await request.body() == b"a" @@ -733,7 +733,7 @@ async def dispatch(self, request: Request, call_next: RequestResponseEndpoint): def test_read_request_body_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next( # noqa: E501 - test_client_factory: Callable[[ASGIApp], TestClient] + test_client_factory: Callable[[ASGIApp], TestClient], ) -> None: async def homepage(request: Request): assert await request.body() == b"a" @@ -837,7 +837,7 @@ async def send(msg: Message): def test_downstream_middleware_modifies_receive( - test_client_factory: Callable[[ASGIApp], TestClient] + test_client_factory: Callable[[ASGIApp], TestClient], ) -> None: """If a downstream middleware modifies receive() the final ASGI app should see the modified version. diff --git a/tests/test_background.py b/tests/test_background.py index fbe9dbf1b..39a126dc9 100644 --- a/tests/test_background.py +++ b/tests/test_background.py @@ -69,7 +69,7 @@ async def app(scope, receive, send): def test_multi_tasks_failure_avoids_next_execution( - test_client_factory: Callable[..., TestClient] + test_client_factory: Callable[..., TestClient], ) -> None: TASK_COUNTER = 0 diff --git a/tests/test_routing.py b/tests/test_routing.py index 5c12ebabe..cd6f37880 100644 --- a/tests/test_routing.py +++ b/tests/test_routing.py @@ -1110,7 +1110,7 @@ async def modified_send(msg: Message) -> None: def test_websocket_route_middleware( - test_client_factory: typing.Callable[..., TestClient] + test_client_factory: typing.Callable[..., TestClient], ): async def websocket_endpoint(session: WebSocket): await session.accept() diff --git a/tests/test_websockets.py b/tests/test_websockets.py index 2b487633e..41ab82e18 100644 --- a/tests/test_websockets.py +++ b/tests/test_websockets.py @@ -40,7 +40,7 @@ async def app(scope: Scope, receive: Receive, send: Send) -> None: def test_websocket_ensure_unicode_on_send_json( - test_client_factory: Callable[..., TestClient] + test_client_factory: Callable[..., TestClient], ): async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send)