Skip to content

Commit b0c81d8

Browse files
Bump mypy from 1.15.0 to 1.16.0 (#11093)
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 5fc7f93 commit b0c81d8

20 files changed

+63
-55
lines changed

aiohttp/abc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def http_exception(self) -> Optional[HTTPException]:
8282
"""HTTPException instance raised on router's resolving, or None"""
8383

8484
@abstractmethod # pragma: no branch
85-
def get_info(self) -> Dict[str, Any]: # type: ignore[misc]
85+
def get_info(self) -> Dict[str, Any]:
8686
"""Return a dict with additional info useful for introspection"""
8787

8888
@property # pragma: no branch

aiohttp/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ def skip_auto_headers(self) -> FrozenSet[istr]:
13011301
return self._skip_auto_headers
13021302

13031303
@property
1304-
def auth(self) -> Optional[BasicAuth]: # type: ignore[misc]
1304+
def auth(self) -> Optional[BasicAuth]:
13051305
"""An object that represents HTTP Basic Authorization"""
13061306
return self._default_auth
13071307

@@ -1338,7 +1338,7 @@ def trust_env(self) -> bool:
13381338
return self._trust_env
13391339

13401340
@property
1341-
def trace_configs(self) -> List[TraceConfig[Any]]: # type: ignore[misc]
1341+
def trace_configs(self) -> List[TraceConfig[Any]]:
13421342
"""A list of TraceConfig instances used for client tracing"""
13431343
return self._trace_configs
13441344

aiohttp/client_reqrep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ def ssl(self) -> Union["SSLContext", bool, Fingerprint]:
862862
return self._ssl
863863

864864
@property
865-
def connection_key(self) -> ConnectionKey: # type: ignore[misc]
865+
def connection_key(self) -> ConnectionKey:
866866
if proxy_headers := self.proxy_headers:
867867
h: Optional[int] = hash(tuple(proxy_headers.items()))
868868
else:

aiohttp/formdata.py

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

9090
elif isinstance(rec, (list, tuple)) and len(rec) == 2:
9191
k, fp = rec
92-
self.add_field(k, fp) # type: ignore[arg-type]
92+
self.add_field(k, fp)
9393

9494
else:
9595
raise TypeError(

aiohttp/helpers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def __new__(
145145
return super().__new__(cls, login, password, encoding)
146146

147147
@classmethod
148-
def decode(cls, auth_header: str, encoding: str = "latin1") -> "BasicAuth": # type: ignore[misc]
148+
def decode(cls, auth_header: str, encoding: str = "latin1") -> "BasicAuth":
149149
"""Create a BasicAuth object from an Authorization HTTP header."""
150150
try:
151151
auth_type, encoded_credentials = auth_header.split(" ", 1)
@@ -174,7 +174,7 @@ def decode(cls, auth_header: str, encoding: str = "latin1") -> "BasicAuth": # t
174174
return cls(username, password, encoding=encoding)
175175

176176
@classmethod
177-
def from_url(cls, url: URL, *, encoding: str = "latin1") -> Optional["BasicAuth"]: # type: ignore[misc]
177+
def from_url(cls, url: URL, *, encoding: str = "latin1") -> Optional["BasicAuth"]:
178178
"""Create BasicAuth from url."""
179179
if not isinstance(url, URL):
180180
raise TypeError("url should be yarl.URL instance")
@@ -245,7 +245,7 @@ def netrc_from_env() -> Optional[netrc.netrc]:
245245

246246

247247
@frozen_dataclass_decorator
248-
class ProxyInfo: # type: ignore[misc]
248+
class ProxyInfo:
249249
proxy: URL
250250
proxy_auth: Optional[BasicAuth]
251251

@@ -884,7 +884,7 @@ def __init_subclass__(cls) -> None:
884884
def __getitem__(self, key: AppKey[_T]) -> _T: ...
885885

886886
@overload
887-
def __getitem__(self, key: str) -> Any: ... # type: ignore[misc]
887+
def __getitem__(self, key: str) -> Any: ...
888888

889889
def __getitem__(self, key: Union[str, AppKey[_T]]) -> Any:
890890
for mapping in self._maps:
@@ -901,7 +901,7 @@ def get(self, key: AppKey[_T], default: _S) -> Union[_T, _S]: ...
901901
def get(self, key: AppKey[_T], default: None = ...) -> Optional[_T]: ...
902902

903903
@overload
904-
def get(self, key: str, default: Any = ...) -> Any: ... # type: ignore[misc]
904+
def get(self, key: str, default: Any = ...) -> Any: ...
905905

906906
def get(self, key: Union[str, AppKey[_T]], default: Any = None) -> Any:
907907
try:

aiohttp/http_writer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _write(
100100
transport = self._protocol.transport
101101
if transport is None or transport.is_closing():
102102
raise ClientConnectionResetError("Cannot write to closing transport")
103-
transport.write(chunk) # type: ignore[arg-type]
103+
transport.write(chunk)
104104

105105
def _writelines(
106106
self,
@@ -119,7 +119,7 @@ def _writelines(
119119
if SKIP_WRITELINES or size < MIN_PAYLOAD_FOR_WRITELINES:
120120
transport.write(b"".join(chunks))
121121
else:
122-
transport.writelines(chunks) # type: ignore[arg-type]
122+
transport.writelines(chunks)
123123

124124
def _write_chunked_payload(
125125
self, chunk: Union[bytes, bytearray, "memoryview[int]", "memoryview[bytes]"]

aiohttp/pytest_plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@
4242
class AiohttpClient(Protocol):
4343
# TODO(PY311): Use Unpack to specify ClientSession kwargs.
4444
@overload
45-
async def __call__( # type: ignore[misc]
45+
async def __call__(
4646
self,
4747
__param: Application,
4848
*,
4949
server_kwargs: Optional[Dict[str, Any]] = None,
5050
**kwargs: Any,
5151
) -> TestClient[Request, Application]: ...
5252
@overload
53-
async def __call__( # type: ignore[misc]
53+
async def __call__(
5454
self,
5555
__param: BaseTestServer[_Request],
5656
*,
@@ -400,14 +400,14 @@ def aiohttp_client( # type: ignore[misc]
400400
clients = []
401401

402402
@overload
403-
async def go( # type: ignore[misc]
403+
async def go(
404404
__param: Application,
405405
*,
406406
server_kwargs: Optional[Dict[str, Any]] = None,
407407
**kwargs: Any,
408408
) -> TestClient[Request, Application]: ...
409409
@overload
410-
async def go( # type: ignore[misc]
410+
async def go(
411411
__param: BaseTestServer[_Request],
412412
*,
413413
server_kwargs: Optional[Dict[str, Any]] = None,

aiohttp/test_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def start_server(self, **kwargs: Any) -> None:
155155
self._root = URL(f"{self.scheme}://{absolute_host}:{self.port}")
156156

157157
@abstractmethod
158-
async def _make_runner(self, **kwargs: Any) -> BaseRunner[_Request]: # type: ignore[misc]
158+
async def _make_runner(self, **kwargs: Any) -> BaseRunner[_Request]:
159159
"""Return a new runner for the server."""
160160
# TODO(PY311): Use Unpack to specify Server kwargs.
161161

@@ -265,15 +265,15 @@ class TestClient(Generic[_Request, _ApplicationNone]):
265265
__test__ = False
266266

267267
@overload
268-
def __init__( # type: ignore[misc]
268+
def __init__(
269269
self: "TestClient[Request, Application]",
270270
server: TestServer,
271271
*,
272272
cookie_jar: Optional[AbstractCookieJar] = None,
273273
**kwargs: Any,
274274
) -> None: ...
275275
@overload
276-
def __init__( # type: ignore[misc]
276+
def __init__(
277277
self: "TestClient[_Request, None]",
278278
server: BaseTestServer[_Request],
279279
*,

aiohttp/web_app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def __eq__(self, other: object) -> bool:
164164
def __getitem__(self, key: AppKey[_T]) -> _T: ...
165165

166166
@overload
167-
def __getitem__(self, key: str) -> Any: ... # type: ignore[misc]
167+
def __getitem__(self, key: str) -> Any: ...
168168

169169
def __getitem__(self, key: Union[str, AppKey[_T]]) -> Any:
170170
return self._state[key]
@@ -179,7 +179,7 @@ def _check_frozen(self) -> None:
179179
def __setitem__(self, key: AppKey[_T], value: _T) -> None: ...
180180

181181
@overload
182-
def __setitem__(self, key: str, value: Any) -> None: ... # type: ignore[misc]
182+
def __setitem__(self, key: str, value: Any) -> None: ...
183183

184184
def __setitem__(self, key: Union[str, AppKey[_T]], value: Any) -> None:
185185
self._check_frozen()
@@ -213,7 +213,7 @@ def get(self, key: AppKey[_T], default: None = ...) -> Optional[_T]: ...
213213
def get(self, key: AppKey[_T], default: _U) -> Union[_T, _U]: ...
214214

215215
@overload
216-
def get(self, key: str, default: Any = ...) -> Any: ... # type: ignore[misc]
216+
def get(self, key: str, default: Any = ...) -> Any: ...
217217

218218
def get(self, key: Union[str, AppKey[_T]], default: Any = None) -> Any:
219219
return self._state.get(key, default)

aiohttp/web_fileresponse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ async def _not_modified(
160160
) -> Optional[AbstractStreamWriter]:
161161
self.set_status(HTTPNotModified.status_code)
162162
self._length_check = False
163-
self.etag = etag_value # type: ignore[assignment]
164-
self.last_modified = last_modified # type: ignore[assignment]
163+
self.etag = etag_value
164+
self.last_modified = last_modified
165165
# Delete any Content-Length headers provided by user. HTTP 304
166166
# should always have empty response body
167167
return await super().prepare(request)
@@ -391,8 +391,8 @@ async def _prepare_open_file(
391391
# compress.
392392
self._compression = False
393393

394-
self.etag = f"{st.st_mtime_ns:x}-{st.st_size:x}" # type: ignore[assignment]
395-
self.last_modified = file_mtime # type: ignore[assignment]
394+
self.etag = f"{st.st_mtime_ns:x}-{st.st_size:x}"
395+
self.last_modified = file_mtime
396396
self.content_length = count
397397

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

0 commit comments

Comments
 (0)