From 0bf109195427b9f91c2ac47c3de378b0829de296 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 13 Nov 2023 18:25:41 +0000
Subject: [PATCH] Bump mypy from 1.6.1 to 1.7.0 (#7831)
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/helpers.py | 8 +++-----
aiohttp/resolver.py | 2 +-
aiohttp/web_request.py | 2 +-
requirements/constraints.txt | 2 +-
requirements/dev.txt | 2 +-
requirements/lint.txt | 2 +-
requirements/test.txt | 2 +-
10 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/aiohttp/client_reqrep.py b/aiohttp/client_reqrep.py
index 8e9e080585a..ad480a86c7a 100644
--- a/aiohttp/client_reqrep.py
+++ b/aiohttp/client_reqrep.py
@@ -395,7 +395,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]
@@ -727,7 +727,7 @@ def __init__(
super().__init__()
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 01a1ca8501c..2460ca46705 100644
--- a/aiohttp/connector.py
+++ b/aiohttp/connector.py
@@ -225,7 +225,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 73bf2f3a66a..29fa865a3a7 100644
--- a/aiohttp/cookiejar.py
+++ b/aiohttp/cookiejar.py
@@ -63,7 +63,7 @@ def __init__(
quote_cookie: bool = True,
treat_as_secure_origin: Union[StrOrURL, List[StrOrURL], None] = None
) -> None:
- 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()
@@ -166,7 +166,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]
@@ -230,9 +230,7 @@ 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."""
if not isinstance(request_url, URL):
warnings.warn(
@@ -242,7 +240,7 @@ def filter_cookies(
DeprecationWarning,
)
request_url = URL(request_url)
- 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/helpers.py b/aiohttp/helpers.py
index de2f538927d..8da0159fa2b 100644
--- a/aiohttp/helpers.py
+++ b/aiohttp/helpers.py
@@ -939,10 +939,10 @@ def __init__(self) -> None:
super().__init__()
# Mypy doesn't like that _cookies isn't in __slots__.
# See the comment on this class's __slots__ for why this is OK.
- self._cookies: SimpleCookie[str] = SimpleCookie() # type: ignore[misc]
+ self._cookies = SimpleCookie() # type: ignore[misc]
@property
- def cookies(self) -> "SimpleCookie[str]":
+ def cookies(self) -> SimpleCookie:
return self._cookies
def set_cookie(
@@ -1024,9 +1024,7 @@ def del_cookie(
)
-def populate_with_cookies(
- headers: "CIMultiDict[str]", cookies: "SimpleCookie[str]"
-) -> None:
+def populate_with_cookies(headers: "CIMultiDict[str]", cookies: SimpleCookie) -> None:
for cookie in cookies.values():
value = cookie.output(header="")[1:]
headers.add(hdrs.SET_COOKIE, value)
diff --git a/aiohttp/resolver.py b/aiohttp/resolver.py
index d20c9194da1..fe83ad27fd0 100644
--- a/aiohttp/resolver.py
+++ b/aiohttp/resolver.py
@@ -44,7 +44,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 5181bd1abf6..1d9cf4637c9 100644
--- a/aiohttp/web_request.py
+++ b/aiohttp/web_request.py
@@ -571,7 +571,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/requirements/constraints.txt b/requirements/constraints.txt
index 94ac3e391c1..2d816a7c41e 100644
--- a/requirements/constraints.txt
+++ b/requirements/constraints.txt
@@ -102,7 +102,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 5198d29c0f2..5d1c93ec7bc 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -99,7 +99,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 eee5a5411f5..c51bbddf375 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 3b235d63de7..809d24a9356 100644
--- a/requirements/test.txt
+++ b/requirements/test.txt
@@ -49,7 +49,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