From 9d712f2f9c06f71d48e98374938813643503bc34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:32:42 +0000 Subject: [PATCH] Bump mypy from 1.6.1 to 1.7.0 (#7833) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [mypy](https://github.com/python/mypy) from 1.6.1 to 1.7.0.
Changelog

Sourced from mypy's changelog.

Mypy Release Notes

Next release

Stubgen will now include __all__ in its output if it is in the input file (PR 16356).

Mypy 1.7

We’ve just uploaded mypy 1.7 to the Python Package Index (PyPI). Mypy is a static type checker for Python. This release includes new features, performance improvements and bug fixes. You can install it as follows:

python3 -m pip install -U mypy

You can read the full documentation for this release on Read the Docs.

Using TypedDict for **kwargs Typing

Mypy now has support for using Unpack[...] with a TypedDict type to annotate **kwargs arguments enabled by default. Example:

# Or 'from typing_extensions import ...'
from typing import TypedDict, Unpack

class Person(TypedDict): name: str age: int

def foo(**kwargs: Unpack[Person]) -> None: ...

foo(name="x", age=1) # Ok foo(name=1) # Error

The definition of foo above is equivalent to the one below, with keyword-only arguments name and age:

def foo(*, name: str, age: int) -> None:
    ...

Refer to PEP 692 for more information. Note that unlike in the current version of the PEP, mypy always treats signatures with Unpack[SomeTypedDict] as equivalent to their expanded forms with explicit keyword arguments, and there aren't special type checking rules for TypedDict arguments.

This was contributed by Ivan Levkivskyi back in 2022 (PR 13471).

TypeVarTuple Support Enabled (Experimental)

Mypy now has support for variadic generics (TypeVarTuple) enabled by default, as an experimental feature. Refer to PEP 646 for the details.

TypeVarTuple was implemented by Jared Hance and Ivan Levkivskyi over several mypy releases, with help from Jukka Lehtosalo.

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=mypy&package-manager=pip&previous-version=1.6.1&new-version=1.7.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sam Bull Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- aiohttp/client_reqrep.py | 4 ++-- aiohttp/connector.py | 2 +- aiohttp/cookiejar.py | 10 ++++------ aiohttp/resolver.py | 2 +- aiohttp/web_request.py | 2 +- aiohttp/web_response.py | 4 ++-- requirements/constraints.txt | 2 +- requirements/dev.txt | 2 +- requirements/lint.txt | 2 +- requirements/test.txt | 2 +- 10 files changed, 15 insertions(+), 17 deletions(-) diff --git a/aiohttp/client_reqrep.py b/aiohttp/client_reqrep.py index 7f1f244639a..851ab220b8a 100644 --- a/aiohttp/client_reqrep.py +++ b/aiohttp/client_reqrep.py @@ -462,7 +462,7 @@ def update_cookies(self, cookies: Optional[LooseCookies]) -> None: if not cookies: return - c: SimpleCookie[str] = SimpleCookie() + c = SimpleCookie() if hdrs.COOKIE in self.headers: c.load(self.headers.get(hdrs.COOKIE, "")) del self.headers[hdrs.COOKIE] @@ -789,7 +789,7 @@ def __init__( assert isinstance(url, URL) self.method = method - self.cookies: SimpleCookie[str] = SimpleCookie() + self.cookies = SimpleCookie() self._real_url = url self._url = url.with_fragment(None) diff --git a/aiohttp/connector.py b/aiohttp/connector.py index 7683b748e44..d85679f8bca 100644 --- a/aiohttp/connector.py +++ b/aiohttp/connector.py @@ -248,7 +248,7 @@ def __init__( self._loop = loop self._factory = functools.partial(ResponseHandler, loop=loop) - self.cookies: SimpleCookie[str] = SimpleCookie() + self.cookies = SimpleCookie() # start keep-alive connection cleanup task self._cleanup_handle: Optional[asyncio.TimerHandle] = None diff --git a/aiohttp/cookiejar.py b/aiohttp/cookiejar.py index 372a0e7b723..389f4bf1c2b 100644 --- a/aiohttp/cookiejar.py +++ b/aiohttp/cookiejar.py @@ -65,7 +65,7 @@ def __init__( loop: Optional[asyncio.AbstractEventLoop] = None, ) -> None: super().__init__(loop=loop) - self._cookies: DefaultDict[Tuple[str, str], SimpleCookie[str]] = defaultdict( + self._cookies: DefaultDict[Tuple[str, str], SimpleCookie] = defaultdict( SimpleCookie ) self._host_only_cookies: Set[Tuple[str, str]] = set() @@ -168,7 +168,7 @@ def update_cookies(self, cookies: LooseCookies, response_url: URL = URL()) -> No for name, cookie in cookies: if not isinstance(cookie, Morsel): - tmp: SimpleCookie[str] = SimpleCookie() + tmp = SimpleCookie() tmp[name] = cookie # type: ignore[assignment] cookie = tmp[name] @@ -232,11 +232,9 @@ def update_cookies(self, cookies: LooseCookies, response_url: URL = URL()) -> No self._do_expiration() - def filter_cookies( - self, request_url: URL = URL() - ) -> Union["BaseCookie[str]", "SimpleCookie[str]"]: + def filter_cookies(self, request_url: URL = URL()) -> "BaseCookie[str]": """Returns this jar's cookies filtered by their attributes.""" - filtered: Union["SimpleCookie[str]", "BaseCookie[str]"] = ( + filtered: Union[SimpleCookie, "BaseCookie[str]"] = ( SimpleCookie() if self._quote_cookie else BaseCookie() ) if not self._cookies: diff --git a/aiohttp/resolver.py b/aiohttp/resolver.py index 531ce93fccc..6c17b1e7e89 100644 --- a/aiohttp/resolver.py +++ b/aiohttp/resolver.py @@ -45,7 +45,7 @@ async def resolve( # IPv6 is not supported by Python build, # or IPv6 is not enabled in the host continue - if address[3]: # type: ignore[misc] + if address[3]: # This is essential for link-local IPv6 addresses. # LL IPv6 is a VERY rare case. Strictly speaking, we should use # getnameinfo() unconditionally, but performance makes sense. diff --git a/aiohttp/web_request.py b/aiohttp/web_request.py index b4fc9cb0481..a7e32ca6c79 100644 --- a/aiohttp/web_request.py +++ b/aiohttp/web_request.py @@ -582,7 +582,7 @@ def cookies(self) -> Mapping[str, str]: A read-only dictionary-like object. """ raw = self.headers.get(hdrs.COOKIE, "") - parsed: SimpleCookie[str] = SimpleCookie(raw) + parsed = SimpleCookie(raw) return MappingProxyType({key: val.value for key, val in parsed.items()}) @reify diff --git a/aiohttp/web_response.py b/aiohttp/web_response.py index aaf430a509d..e089c60ee4c 100644 --- a/aiohttp/web_response.py +++ b/aiohttp/web_response.py @@ -83,7 +83,7 @@ def __init__( self._chunked = False self._compression = False self._compression_force: Optional[ContentCoding] = None - self._cookies: SimpleCookie[str] = SimpleCookie() + self._cookies = SimpleCookie() self._req: Optional[BaseRequest] = None self._payload_writer: Optional[AbstractStreamWriter] = None @@ -193,7 +193,7 @@ def headers(self) -> "CIMultiDict[str]": return self._headers @property - def cookies(self) -> "SimpleCookie[str]": + def cookies(self) -> SimpleCookie: return self._cookies def set_cookie( diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 16a634c19e7..df021579ea0 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -108,7 +108,7 @@ multidict==6.0.4 # -r requirements/multidict.in # -r requirements/runtime-deps.in # yarl -mypy==1.6.1 ; implementation_name == "cpython" +mypy==1.7.0 ; implementation_name == "cpython" # via # -r requirements/lint.in # -r requirements/test.in diff --git a/requirements/dev.txt b/requirements/dev.txt index e296118e922..605327c4e94 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -103,7 +103,7 @@ multidict==6.0.4 # via # -r requirements/runtime-deps.in # yarl -mypy==1.6.1 ; implementation_name == "cpython" +mypy==1.7.0 ; implementation_name == "cpython" # via # -r requirements/lint.in # -r requirements/test.in diff --git a/requirements/lint.txt b/requirements/lint.txt index 3a1070a1644..e90f801862d 100644 --- a/requirements/lint.txt +++ b/requirements/lint.txt @@ -22,7 +22,7 @@ identify==2.5.26 # via pre-commit iniconfig==2.0.0 # via pytest -mypy==1.6.1 ; implementation_name == "cpython" +mypy==1.7.0 ; implementation_name == "cpython" # via -r requirements/lint.in mypy-extensions==1.0.0 # via mypy diff --git a/requirements/test.txt b/requirements/test.txt index 7a9e6f1c50a..0f8a7ef8ee1 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -53,7 +53,7 @@ multidict==6.0.4 # via # -r requirements/runtime-deps.in # yarl -mypy==1.6.1 ; implementation_name == "cpython" +mypy==1.7.0 ; implementation_name == "cpython" # via -r requirements/test.in mypy-extensions==1.0.0 # via mypy