Skip to content

Commit fc6cd87

Browse files
Bump mypy from 1.15.0 to 1.16.0 (#11092)
Bumps [mypy](https://github.com/python/mypy) from 1.15.0 to 1.16.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/python/mypy/blob/master/CHANGELOG.md">mypy's changelog</a>.</em></p> <blockquote> <h1>Mypy Release Notes</h1> <h2>Next Release</h2> <h2>Mypy 1.16</h2> <p>We’ve just uploaded mypy 1.16 to the Python Package Index (<a href="https://pypi.org/project/mypy/">PyPI</a>). Mypy is a static type checker for Python. This release includes new features and bug fixes. You can install it as follows:</p> <pre><code>python3 -m pip install -U mypy </code></pre> <p>You can read the full documentation for this release on <a href="http://mypy.readthedocs.io">Read the Docs</a>.</p> <h3>Different Property Getter and Setter Types</h3> <p>Mypy now supports using different types for a property getter and setter:</p> <pre lang="python"><code>class A: _value: int <pre><code>@Property def foo(self) -&amp;gt; int: return self._value @foo.setter def foo(self, x: str | int) -&amp;gt; None: try: self._value = int(x) except ValueError: raise Exception(f&amp;quot;'{x}' is not a valid value for 'foo'&amp;quot;) </code></pre> <p></code></pre></p> <p>This was contributed by Ivan Levkivskyi (PR <a href="https://redirect.github.com/python/mypy/pull/18510">18510</a>).</p> <h3>Flexible Variable Redefinitions (Experimental)</h3> <p>Mypy now allows unannotated variables to be freely redefined with different types when using the experimental <code>--allow-redefinition-new</code> flag. You will also need to enable <code>--local-partial-types</code>. Mypy will now infer a union type when different types are assigned to a variable:</p> <pre lang="py"><code># mypy: allow-redefinition-new, local-partial-types <p>def f(n: int, b: bool) -&gt; int | str: if b: x = n else: &lt;/tr&gt;&lt;/table&gt; </code></pre></p> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/python/mypy/commit/9e72e9601f4c2fb6866cfec98fc40a31c91ccdb0"><code>9e72e96</code></a> Update version to 1.16.0</li> <li><a href="https://github.com/python/mypy/commit/8fe719ff3a8d1e26d3841a48df21ddf7d5b3c94d"><code>8fe719f</code></a> Add changelog for 1.16 (<a href="https://redirect.github.com/python/mypy/issues/19138">#19138</a>)</li> <li><a href="https://github.com/python/mypy/commit/2a036e739f8691576056669371d9f020e95c2603"><code>2a036e7</code></a> Revert &quot;Infer correct types with overloads of <code>Type[Guard | Is]</code> (<a href="https://redirect.github.com/python/mypy/issues/19161">#19161</a>)</li> <li><a href="https://github.com/python/mypy/commit/b6da4fcf97fca9cd28e81a880f818dc364b5a06d"><code>b6da4fc</code></a> Allow enum members to have type objects as values (<a href="https://redirect.github.com/python/mypy/issues/19160">#19160</a>)</li> <li><a href="https://github.com/python/mypy/commit/334469f999c5c777124a123062b4349614447e0d"><code>334469f</code></a> [mypyc] Improve documentation of native and non-native classes (<a href="https://redirect.github.com/python/mypy/issues/19154">#19154</a>)</li> <li><a href="https://github.com/python/mypy/commit/a499d9fdba06732248c07586f2fd95c47a4fa0f7"><code>a499d9f</code></a> Document --allow-redefinition-new (<a href="https://redirect.github.com/python/mypy/issues/19153">#19153</a>)</li> <li><a href="https://github.com/python/mypy/commit/96525a23f0f8a3826d9875fa8b6e8e362cd9525e"><code>96525a2</code></a> Merge commit '9e45dadcf6d8dbab36f83d9df94a706c0b4f9207' into release-1.16</li> <li><a href="https://github.com/python/mypy/commit/9e45dadcf6d8dbab36f83d9df94a706c0b4f9207"><code>9e45dad</code></a> Clear more data in TypeChecker.reset() instead of asserting (<a href="https://redirect.github.com/python/mypy/issues/19087">#19087</a>)</li> <li><a href="https://github.com/python/mypy/commit/772cd0cebed6884636de0019e43caa06dbaa39ba"><code>772cd0c</code></a> Add --strict-bytes to --strict (<a href="https://redirect.github.com/python/mypy/issues/19049">#19049</a>)</li> <li><a href="https://github.com/python/mypy/commit/0b65f215996401264a68a3a06f3fbcd19915a9a5"><code>0b65f21</code></a> Admit that Final variables are never redefined (<a href="https://redirect.github.com/python/mypy/issues/19083">#19083</a>)</li> <li>Additional commits viewable in <a href="https://github.com/python/mypy/compare/v1.15.0...v1.16.0">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=mypy&package-manager=pip&previous-version=1.15.0&new-version=1.16.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) --- <details> <summary>Dependabot commands and options</summary> <br /> 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 <dependency name> 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) </details> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sam Bull <[email protected]>
1 parent fb26481 commit fc6cd87

File tree

8 files changed

+21
-11
lines changed

8 files changed

+21
-11
lines changed

aiohttp/abc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def request(self) -> Request:
120120
return self._request
121121

122122
@abstractmethod
123-
def __await__(self) -> Generator[Any, None, StreamResponse]:
123+
def __await__(self) -> Generator[None, None, StreamResponse]:
124124
"""Execute the view handler."""
125125

126126

aiohttp/formdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def add_fields(self, *fields: Any) -> None:
110110

111111
elif isinstance(rec, (list, tuple)) and len(rec) == 2:
112112
k, fp = rec
113-
self.add_field(k, fp) # type: ignore[arg-type]
113+
self.add_field(k, fp)
114114

115115
else:
116116
raise TypeError(

aiohttp/web_fileresponse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ async def _not_modified(
164164
) -> Optional[AbstractStreamWriter]:
165165
self.set_status(HTTPNotModified.status_code)
166166
self._length_check = False
167-
self.etag = etag_value # type: ignore[assignment]
168-
self.last_modified = last_modified # type: ignore[assignment]
167+
self.etag = etag_value
168+
self.last_modified = last_modified
169169
# Delete any Content-Length headers provided by user. HTTP 304
170170
# should always have empty response body
171171
return await super().prepare(request)
@@ -395,8 +395,8 @@ async def _prepare_open_file(
395395
# compress.
396396
self._compression = False
397397

398-
self.etag = f"{st.st_mtime_ns:x}-{st.st_size:x}" # type: ignore[assignment]
399-
self.last_modified = file_mtime # type: ignore[assignment]
398+
self.etag = f"{st.st_mtime_ns:x}-{st.st_size:x}"
399+
self.last_modified = file_mtime
400400
self.content_length = count
401401

402402
self._headers[hdrs.ACCEPT_RANGES] = "bytes"

aiohttp/web_urldispatcher.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ def __init__(
194194
):
195195
pass
196196
elif inspect.isgeneratorfunction(handler):
197+
if TYPE_CHECKING:
198+
assert False
197199
warnings.warn(
198200
"Bare generators are deprecated, use @coroutine wrapper",
199201
DeprecationWarning,
@@ -978,7 +980,7 @@ async def _iter(self) -> StreamResponse:
978980
assert isinstance(ret, StreamResponse)
979981
return ret
980982

981-
def __await__(self) -> Generator[Any, None, StreamResponse]:
983+
def __await__(self) -> Generator[None, None, StreamResponse]:
982984
return self._iter().__await__()
983985

984986
def _raise_allowed_methods(self) -> NoReturn:

requirements/constraints.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ multidict==6.4.4
120120
# -r requirements/multidict.in
121121
# -r requirements/runtime-deps.in
122122
# yarl
123-
mypy==1.15.0 ; implementation_name == "cpython"
123+
mypy==1.16.0 ; implementation_name == "cpython"
124124
# via
125125
# -r requirements/lint.in
126126
# -r requirements/test.in
@@ -134,6 +134,8 @@ packaging==25.0
134134
# gunicorn
135135
# pytest
136136
# sphinx
137+
pathspec==0.12.1
138+
# via mypy
137139
pip-tools==7.4.1
138140
# via -r requirements/dev.in
139141
pkgconfig==1.5.5

requirements/dev.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ multidict==6.4.4
117117
# via
118118
# -r requirements/runtime-deps.in
119119
# yarl
120-
mypy==1.15.0 ; implementation_name == "cpython"
120+
mypy==1.16.0 ; implementation_name == "cpython"
121121
# via
122122
# -r requirements/lint.in
123123
# -r requirements/test.in
@@ -131,6 +131,8 @@ packaging==25.0
131131
# gunicorn
132132
# pytest
133133
# sphinx
134+
pathspec==0.12.1
135+
# via mypy
134136
pip-tools==7.4.1
135137
# via -r requirements/dev.in
136138
pkgconfig==1.5.5

requirements/lint.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ markdown-it-py==3.0.0
4545
# via rich
4646
mdurl==0.1.2
4747
# via markdown-it-py
48-
mypy==1.15.0 ; implementation_name == "cpython"
48+
mypy==1.16.0 ; implementation_name == "cpython"
4949
# via -r requirements/lint.in
5050
mypy-extensions==1.1.0
5151
# via mypy
5252
nodeenv==1.9.1
5353
# via pre-commit
5454
packaging==25.0
5555
# via pytest
56+
pathspec==0.12.1
57+
# via mypy
5658
platformdirs==4.3.8
5759
# via virtualenv
5860
pluggy==1.6.0

requirements/test.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ multidict==6.4.4
6363
# via
6464
# -r requirements/runtime-deps.in
6565
# yarl
66-
mypy==1.15.0 ; implementation_name == "cpython"
66+
mypy==1.16.0 ; implementation_name == "cpython"
6767
# via -r requirements/test.in
6868
mypy-extensions==1.1.0
6969
# via mypy
7070
packaging==25.0
7171
# via
7272
# gunicorn
7373
# pytest
74+
pathspec==0.12.1
75+
# via mypy
7476
pkgconfig==1.5.5
7577
# via -r requirements/test.in
7678
pluggy==1.6.0

0 commit comments

Comments
 (0)