From 8811c1cdf8c09b4064d4704038bcf89b00fa438c Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Sun, 16 Jul 2023 20:11:53 +0200 Subject: [PATCH] Types: Fix last errors --- pyproject.toml | 1 + starlette/_compat.py | 2 +- starlette/testclient.py | 18 +++++++++--------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 408a8fb616..c1fd933fe2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,6 +60,7 @@ combine-as-imports = true [tool.mypy] strict = true ignore_missing_imports = true +python_version = "3.8" [[tool.mypy.overrides]] module = "starlette.testclient.*" diff --git a/starlette/_compat.py b/starlette/_compat.py index 3501b5e565..eac24dcda9 100644 --- a/starlette/_compat.py +++ b/starlette/_compat.py @@ -13,7 +13,7 @@ # check if the Python version supports the parameter # using usedforsecurity=False to avoid an exception on FIPS systems # that reject usedforsecurity=True - hashlib.md5(b"data", usedforsecurity=False) + hashlib.md5(b"data", usedforsecurity=False) # type: ignore[call-arg] def md5_hexdigest( data: bytes, *, usedforsecurity: bool = True diff --git a/starlette/testclient.py b/starlette/testclient.py index 196cd4f8da..177a05b647 100644 --- a/starlette/testclient.py +++ b/starlette/testclient.py @@ -380,7 +380,7 @@ def __init__( root_path: str = "", backend: str = "asyncio", backend_options: typing.Optional[typing.Dict[str, typing.Any]] = None, - cookies: httpx._client.CookieTypes = None, + cookies: httpx._types.CookieTypes = None, headers: typing.Dict[str, str] = None, ) -> None: self.async_backend = _AsyncBackend( @@ -464,7 +464,7 @@ def request( # type: ignore[override] follow_redirects: typing.Optional[bool] = None, allow_redirects: typing.Optional[bool] = None, timeout: typing.Union[ - httpx._client.TimeoutTypes, httpx._client.UseClientDefault + httpx._types.TimeoutTypes, httpx._client.UseClientDefault ] = httpx._client.USE_CLIENT_DEFAULT, extensions: typing.Optional[typing.Dict[str, typing.Any]] = None, ) -> httpx.Response: @@ -499,7 +499,7 @@ def get( # type: ignore[override] follow_redirects: typing.Optional[bool] = None, allow_redirects: typing.Optional[bool] = None, timeout: typing.Union[ - httpx._client.TimeoutTypes, httpx._client.UseClientDefault + httpx._types.TimeoutTypes, httpx._client.UseClientDefault ] = httpx._client.USE_CLIENT_DEFAULT, extensions: typing.Optional[typing.Dict[str, typing.Any]] = None, ) -> httpx.Response: @@ -528,7 +528,7 @@ def options( # type: ignore[override] follow_redirects: typing.Optional[bool] = None, allow_redirects: typing.Optional[bool] = None, timeout: typing.Union[ - httpx._client.TimeoutTypes, httpx._client.UseClientDefault + httpx._types.TimeoutTypes, httpx._client.UseClientDefault ] = httpx._client.USE_CLIENT_DEFAULT, extensions: typing.Optional[typing.Dict[str, typing.Any]] = None, ) -> httpx.Response: @@ -557,7 +557,7 @@ def head( # type: ignore[override] follow_redirects: typing.Optional[bool] = None, allow_redirects: typing.Optional[bool] = None, timeout: typing.Union[ - httpx._client.TimeoutTypes, httpx._client.UseClientDefault + httpx._types.TimeoutTypes, httpx._client.UseClientDefault ] = httpx._client.USE_CLIENT_DEFAULT, extensions: typing.Optional[typing.Dict[str, typing.Any]] = None, ) -> httpx.Response: @@ -590,7 +590,7 @@ def post( # type: ignore[override] follow_redirects: typing.Optional[bool] = None, allow_redirects: typing.Optional[bool] = None, timeout: typing.Union[ - httpx._client.TimeoutTypes, httpx._client.UseClientDefault + httpx._types.TimeoutTypes, httpx._client.UseClientDefault ] = httpx._client.USE_CLIENT_DEFAULT, extensions: typing.Optional[typing.Dict[str, typing.Any]] = None, ) -> httpx.Response: @@ -627,7 +627,7 @@ def put( # type: ignore[override] follow_redirects: typing.Optional[bool] = None, allow_redirects: typing.Optional[bool] = None, timeout: typing.Union[ - httpx._client.TimeoutTypes, httpx._client.UseClientDefault + httpx._types.TimeoutTypes, httpx._client.UseClientDefault ] = httpx._client.USE_CLIENT_DEFAULT, extensions: typing.Optional[typing.Dict[str, typing.Any]] = None, ) -> httpx.Response: @@ -664,7 +664,7 @@ def patch( # type: ignore[override] follow_redirects: typing.Optional[bool] = None, allow_redirects: typing.Optional[bool] = None, timeout: typing.Union[ - httpx._client.TimeoutTypes, httpx._client.UseClientDefault + httpx._types.TimeoutTypes, httpx._client.UseClientDefault ] = httpx._client.USE_CLIENT_DEFAULT, extensions: typing.Optional[typing.Dict[str, typing.Any]] = None, ) -> httpx.Response: @@ -697,7 +697,7 @@ def delete( # type: ignore[override] follow_redirects: typing.Optional[bool] = None, allow_redirects: typing.Optional[bool] = None, timeout: typing.Union[ - httpx._client.TimeoutTypes, httpx._client.UseClientDefault + httpx._types.TimeoutTypes, httpx._client.UseClientDefault ] = httpx._client.USE_CLIENT_DEFAULT, extensions: typing.Optional[typing.Dict[str, typing.Any]] = None, ) -> httpx.Response: