From 63f83a0f916ee5030ee0f2dad3ba999b325c167c Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 27 Jul 2023 17:13:41 +0000
Subject: [PATCH] Bump mypy from 0.982 to 1.4.1 (#7427)
Bumps [mypy](https://github.com/python/mypy) from 0.982 to 1.4.1.
Commits
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=mypy&package-manager=pip&previous-version=0.982&new-version=1.4.1)](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 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: dependabot[bot]
Co-authored-by: Sam Bull
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
---
.mypy.ini | 7 +++++--
aiohttp/client.py | 13 +++++--------
aiohttp/client_proto.py | 6 +++---
aiohttp/client_reqrep.py | 9 +++++----
aiohttp/client_ws.py | 5 +++--
aiohttp/connector.py | 4 ++--
aiohttp/helpers.py | 13 ++++++++-----
aiohttp/http_parser.py | 3 ++-
aiohttp/http_websocket.py | 2 +-
aiohttp/multipart.py | 4 ++--
aiohttp/streams.py | 4 +---
aiohttp/web_fileresponse.py | 7 +++----
aiohttp/web_protocol.py | 8 +++++---
aiohttp/web_response.py | 6 ++----
aiohttp/web_ws.py | 7 ++++---
examples/background_tasks.py | 4 ++--
requirements/constraints.txt | 2 +-
requirements/lint.txt | 2 +-
requirements/test.txt | 2 +-
setup.cfg | 3 ++-
tests/test_circular_imports.py | 2 +-
tests/test_cookiejar.py | 2 +-
tests/test_urldispatch.py | 1 +
tests/test_web_log.py | 2 +-
tests/test_web_sendfile.py | 10 +++++-----
25 files changed, 67 insertions(+), 61 deletions(-)
diff --git a/.mypy.ini b/.mypy.ini
index b3e17b9731a..43fcb3c5797 100644
--- a/.mypy.ini
+++ b/.mypy.ini
@@ -4,21 +4,24 @@ check_untyped_defs = True
follow_imports_for_stubs = True
#disallow_any_decorated = True
disallow_any_generics = True
+disallow_any_unimported = True
disallow_incomplete_defs = True
disallow_subclassing_any = True
disallow_untyped_calls = True
disallow_untyped_decorators = True
disallow_untyped_defs = True
+enable_error_code = ignore-without-code, possibly-undefined, redundant-expr, redundant-self, truthy-bool, truthy-iterable, unused-awaitable
implicit_reexport = False
no_implicit_optional = True
+pretty = True
+show_column_numbers = True
show_error_codes = True
strict_equality = True
warn_incomplete_stub = True
warn_redundant_casts = True
+warn_return_any = True
#warn_unreachable = True
warn_unused_ignores = True
-disallow_any_unimported = True
-warn_return_any = True
[mypy-aiodns]
ignore_missing_imports = True
diff --git a/aiohttp/client.py b/aiohttp/client.py
index 9050cc4120c..88b0b2980de 100644
--- a/aiohttp/client.py
+++ b/aiohttp/client.py
@@ -16,6 +16,7 @@
Any,
Awaitable,
Callable,
+ Collection,
Coroutine,
FrozenSet,
Generator,
@@ -450,11 +451,7 @@ async def _request(
auth = self._default_auth
# It would be confusing if we support explicit
# Authorization header with auth argument
- if (
- headers is not None
- and auth is not None
- and hdrs.AUTHORIZATION in headers
- ):
+ if auth is not None and hdrs.AUTHORIZATION in headers:
raise ValueError(
"Cannot combine AUTHORIZATION header "
"with AUTH argument or credentials "
@@ -666,7 +663,7 @@ def ws_connect(
url: StrOrURL,
*,
method: str = hdrs.METH_GET,
- protocols: Iterable[str] = (),
+ protocols: Collection[str] = (),
timeout: Union[ClientWSTimeout, float, _SENTINEL, None] = sentinel,
receive_timeout: Optional[float] = None,
autoclose: bool = True,
@@ -712,7 +709,7 @@ async def _ws_connect(
url: StrOrURL,
*,
method: str = hdrs.METH_GET,
- protocols: Iterable[str] = (),
+ protocols: Collection[str] = (),
timeout: Union[ClientWSTimeout, float, _SENTINEL, None] = sentinel,
receive_timeout: Optional[float] = None,
autoclose: bool = True,
@@ -1103,7 +1100,7 @@ def send(self, arg: None) -> "asyncio.Future[Any]":
return self._coro.send(arg)
def throw(self, arg: BaseException) -> None: # type: ignore[override]
- self._coro.throw(arg)
+ self._coro.throw(arg) # type: ignore[unused-awaitable]
def close(self) -> None:
return self._coro.close()
diff --git a/aiohttp/client_proto.py b/aiohttp/client_proto.py
index bfa9ea84a97..3d42cf5058a 100644
--- a/aiohttp/client_proto.py
+++ b/aiohttp/client_proto.py
@@ -10,7 +10,7 @@
ServerTimeoutError,
)
from .helpers import BaseTimerContext, set_exception, set_result
-from .http import HttpResponseParser, RawResponseMessage
+from .http import HttpResponseParser, RawResponseMessage, WebSocketReader
from .streams import EMPTY_PAYLOAD, DataQueue, StreamReader
@@ -25,7 +25,7 @@ def __init__(self, loop: asyncio.AbstractEventLoop) -> None:
self._payload: Optional[StreamReader] = None
self._skip_payload = False
- self._payload_parser = None
+ self._payload_parser: Optional[WebSocketReader] = None
self._timer = None
@@ -46,7 +46,7 @@ def upgraded(self) -> bool:
@property
def should_close(self) -> bool:
- if self._payload is not None and not self._payload.is_eof() or self._upgraded:
+ if self._payload is not None and not self._payload.is_eof():
return True
return (
diff --git a/aiohttp/client_reqrep.py b/aiohttp/client_reqrep.py
index 3d7a90d6d2d..d479851396d 100644
--- a/aiohttp/client_reqrep.py
+++ b/aiohttp/client_reqrep.py
@@ -76,7 +76,7 @@
try:
import cchardet as chardet
except ImportError: # pragma: no cover
- import charset_normalizer as chardet # type: ignore[no-redef]
+ import charset_normalizer as chardet
__all__ = ("ClientRequest", "ClientResponse", "RequestInfo", "Fingerprint")
@@ -697,7 +697,7 @@ def __init__(
*,
writer: "asyncio.Task[None]",
continue100: Optional["asyncio.Future[bool]"],
- timer: BaseTimerContext,
+ timer: Optional[BaseTimerContext],
request_info: RequestInfo,
traces: List["Trace"],
loop: asyncio.AbstractEventLoop,
@@ -922,7 +922,7 @@ def close(self) -> None:
return
self._closed = True
- if self._loop is None or self._loop.is_closed():
+ if self._loop.is_closed():
return
if self._connection is not None:
@@ -974,7 +974,8 @@ def _cleanup_writer(self) -> None:
def _notify_content(self) -> None:
content = self.content
- if content and content.exception() is None:
+ # content can be None here, but the types are cheated elsewhere.
+ if content and content.exception() is None: # type: ignore[truthy-bool]
content.set_exception(ClientConnectionError("Connection closed"))
self._released = True
diff --git a/aiohttp/client_ws.py b/aiohttp/client_ws.py
index a8986646829..0814d14f5f7 100644
--- a/aiohttp/client_ws.py
+++ b/aiohttp/client_ws.py
@@ -107,7 +107,7 @@ def _send_heartbeat(self) -> None:
# fire-and-forget a task is not perfect but maybe ok for
# sending ping. Otherwise we need a long-living heartbeat
# task in the class.
- self._loop.create_task(self._writer.ping())
+ self._loop.create_task(self._writer.ping()) # type: ignore[unused-awaitable]
if self._pong_response_cb is not None:
self._pong_response_cb.cancel()
@@ -280,7 +280,8 @@ async def receive(self, timeout: Optional[float] = None) -> WSMessage:
if msg.type == WSMsgType.CLOSE:
self._closing = True
self._close_code = msg.data
- if not self._closed and self._autoclose:
+ # Could be closed elsewhere while awaiting reader
+ if not self._closed and self._autoclose: # type: ignore[redundant-expr]
await self.close()
elif msg.type == WSMsgType.CLOSING:
self._closing = True
diff --git a/aiohttp/connector.py b/aiohttp/connector.py
index 3d9f7b59f7b..6d087d26d2b 100644
--- a/aiohttp/connector.py
+++ b/aiohttp/connector.py
@@ -961,7 +961,7 @@ async def _wrap_create_connection(
async with ceil_timeout(
timeout.sock_connect, ceil_threshold=timeout.ceil_threshold
):
- return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
+ return await self._loop.create_connection(*args, **kwargs)
except cert_errors as exc:
raise ClientConnectorCertificateError(req.connection_key, exc) from exc
except ssl_errors as exc:
@@ -1355,7 +1355,7 @@ async def _create_connection(
async with ceil_timeout(
timeout.sock_connect, ceil_threshold=timeout.ceil_threshold
):
- _, proto = await self._loop.create_pipe_connection( # type: ignore[attr-defined] # noqa: E501
+ _, proto = await self._loop.create_pipe_connection( # type: ignore[attr-defined]
self._factory, self._path
)
# the drain is required so that the connection_made is called
diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py
index fa7b8a2ace7..8d12e431c65 100644
--- a/aiohttp/helpers.py
+++ b/aiohttp/helpers.py
@@ -587,7 +587,7 @@ def _weakref_handle(info: "Tuple[weakref.ref[object], str]") -> None:
def weakref_handle(
ob: object,
name: str,
- timeout: float,
+ timeout: Optional[float],
loop: asyncio.AbstractEventLoop,
timeout_ceil_threshold: float = 5,
) -> Optional[asyncio.TimerHandle]:
@@ -602,7 +602,7 @@ def weakref_handle(
def call_later(
cb: Callable[[], Any],
- timeout: float,
+ timeout: Optional[float],
loop: asyncio.AbstractEventLoop,
timeout_ceil_threshold: float = 5,
) -> Optional[asyncio.TimerHandle]:
@@ -716,7 +716,7 @@ def __exit__(
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
- self._tasks.pop()
+ self._tasks.pop() # type: ignore[unused-awaitable]
if exc_type is asyncio.CancelledError and self._cancelled:
raise asyncio.TimeoutError from None
@@ -762,7 +762,7 @@ def _parse_content_type(self, raw: str) -> None:
else:
msg = HeaderParser().parsestr("Content-Type: " + raw)
self._content_type = msg.get_content_type()
- params = msg.get_params()
+ params = msg.get_params(())
self._content_dict = dict(params[1:]) # First element is content type again
@property
@@ -823,8 +823,11 @@ def __init__(self, name: str, t: Optional[Type[_T]] = None):
module: str = frame.f_globals["__name__"]
break
frame = frame.f_back
+ else:
+ raise RuntimeError("Failed to get module name.")
- self._name = module + "." + name
+ # https://github.com/python/mypy/issues/14209
+ self._name = module + "." + name # type: ignore[possibly-undefined]
self._t = t
def __lt__(self, other: object) -> bool:
diff --git a/aiohttp/http_parser.py b/aiohttp/http_parser.py
index e9da4350a95..d09ab5a8aa0 100644
--- a/aiohttp/http_parser.py
+++ b/aiohttp/http_parser.py
@@ -895,7 +895,8 @@ def feed_eof(self) -> None:
if chunk or self.size > 0:
self.out.feed_data(chunk, len(chunk))
- if self.encoding == "deflate" and not self.decompressor.eof: # type: ignore
+ # decompressor is not brotli unless encoding is "br"
+ if self.encoding == "deflate" and not self.decompressor.eof: # type: ignore[union-attr]
raise ContentEncodingError("deflate")
self.out.feed_eof()
diff --git a/aiohttp/http_websocket.py b/aiohttp/http_websocket.py
index f2e348d651b..f99ed8506f4 100644
--- a/aiohttp/http_websocket.py
+++ b/aiohttp/http_websocket.py
@@ -669,7 +669,7 @@ async def _send_frame(
await self.protocol._drain_helper()
def _write(self, data: bytes) -> None:
- if self.transport is None or self.transport.is_closing():
+ if self.transport.is_closing():
raise ConnectionResetError("Cannot write to closing transport")
self.transport.write(data)
diff --git a/aiohttp/multipart.py b/aiohttp/multipart.py
index 0eecb48ddfc..dd56ce08340 100644
--- a/aiohttp/multipart.py
+++ b/aiohttp/multipart.py
@@ -441,8 +441,8 @@ async def release(self) -> None:
async def text(self, *, encoding: Optional[str] = None) -> str:
"""Like read(), but assumes that body part contains text data."""
data = await self.read(decode=True)
- # see https://www.w3.org/TR/html5/forms.html#multipart/form-data-encoding-algorithm # NOQA
- # and https://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-send # NOQA
+ # see https://www.w3.org/TR/html5/forms.html#multipart/form-data-encoding-algorithm
+ # and https://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-send
encoding = encoding or self.get_charset(default="utf-8")
return data.decode(encoding)
diff --git a/aiohttp/streams.py b/aiohttp/streams.py
index 1a2c5147fc3..4ea1022f986 100644
--- a/aiohttp/streams.py
+++ b/aiohttp/streams.py
@@ -66,9 +66,7 @@ def __aiter__(self) -> AsyncStreamIterator[bytes]:
def iter_chunked(self, n: int) -> AsyncStreamIterator[bytes]:
"""Returns an asynchronous iterator that yields chunks of size n."""
- return AsyncStreamIterator(
- lambda: self.read(n) # type: ignore[attr-defined,no-any-return]
- )
+ return AsyncStreamIterator(lambda: self.read(n)) # type: ignore[attr-defined]
def iter_any(self) -> AsyncStreamIterator[bytes]:
"""Yield all available data as soon as it is received."""
diff --git a/aiohttp/web_fileresponse.py b/aiohttp/web_fileresponse.py
index ce85eeb6a69..8770d7dbb5f 100644
--- a/aiohttp/web_fileresponse.py
+++ b/aiohttp/web_fileresponse.py
@@ -167,14 +167,13 @@ async def prepare(self, request: "BaseRequest") -> Optional[AbstractStreamWriter
):
return await self._not_modified(request, etag_value, last_modified)
+ ct = None
if hdrs.CONTENT_TYPE not in self.headers:
ct, encoding = mimetypes.guess_type(str(filepath))
if not ct:
ct = "application/octet-stream"
- should_set_ct = True
else:
encoding = "gzip" if gzip else None
- should_set_ct = False
status = self._status
file_size = st.st_size
@@ -250,8 +249,8 @@ async def prepare(self, request: "BaseRequest") -> Optional[AbstractStreamWriter
# return a HTTP 206 for a Range request.
self.set_status(status)
- if should_set_ct:
- self.content_type = ct # type: ignore[assignment]
+ if ct:
+ self.content_type = ct
if encoding:
self.headers[hdrs.CONTENT_ENCODING] = encoding
if gzip:
diff --git a/aiohttp/web_protocol.py b/aiohttp/web_protocol.py
index 27c815a4461..ae0aaa8d13f 100644
--- a/aiohttp/web_protocol.py
+++ b/aiohttp/web_protocol.py
@@ -186,7 +186,7 @@ def __init__(
tcp_keepalive: bool = True,
logger: Logger = server_logger,
access_log_class: _AnyAbstractAccessLogger = AccessLogger,
- access_log: Logger = access_logger,
+ access_log: Optional[Logger] = access_logger,
access_log_format: str = AccessLogger.LOG_FORMAT,
max_line_size: int = 8190,
max_field_size: int = 8190,
@@ -545,7 +545,8 @@ async def start(self) -> None:
# Drop the processed task from asyncio.Task.all_tasks() early
del task
- if reset:
+ # https://github.com/python/mypy/issues/14309
+ if reset: # type: ignore[possibly-undefined]
self.log_debug("Ignored premature client disconnection 2")
break
@@ -555,7 +556,8 @@ async def start(self) -> None:
# check payload
if not payload.is_eof():
lingering_time = self._lingering_time
- if not self._force_close and lingering_time:
+ # Could be force closed while awaiting above tasks.
+ if not self._force_close and lingering_time: # type: ignore[redundant-expr]
self.log_debug(
"Start lingering close timer for %s sec.", lingering_time
)
diff --git a/aiohttp/web_response.py b/aiohttp/web_response.py
index 1e47454e997..1f2d6239382 100644
--- a/aiohttp/web_response.py
+++ b/aiohttp/web_response.py
@@ -287,7 +287,7 @@ def etag(self, value: Optional[Union[ETag, str]]) -> None:
elif isinstance(value, str):
validate_etag_value(value)
self._headers[hdrs.ETAG] = f'"{value}"'
- elif isinstance(value, ETag) and isinstance(value.value, str):
+ elif isinstance(value, ETag) and isinstance(value.value, str): # type: ignore[redundant-expr]
validate_etag_value(value.value)
hdr_value = f'W/"{value.value}"' if value.is_weak else f'"{value.value}"'
self._headers[hdrs.ETAG] = hdr_value
@@ -605,9 +605,7 @@ def text(self) -> Optional[str]:
@text.setter
def text(self, text: str) -> None:
- assert text is None or isinstance(
- text, str
- ), "text argument must be str (%r)" % type(text)
+ assert isinstance(text, str), "text argument must be str (%r)" % type(text)
if self.content_type == "application/octet-stream":
self.content_type = "text/plain"
diff --git a/aiohttp/web_ws.py b/aiohttp/web_ws.py
index 3c171006271..a184bfa5c7a 100644
--- a/aiohttp/web_ws.py
+++ b/aiohttp/web_ws.py
@@ -138,11 +138,11 @@ def _reset_heartbeat(self) -> None:
def _send_heartbeat(self) -> None:
if self._heartbeat is not None and not self._closed:
- assert self._loop is not None
+ assert self._loop is not None and self._writer is not None
# fire-and-forget a task is not perfect but maybe ok for
# sending ping. Otherwise we need a long-living heartbeat
# task in the class.
- self._loop.create_task(self._writer.ping()) # type: ignore[union-attr]
+ self._loop.create_task(self._writer.ping()) # type: ignore[unused-awaitable]
if self._pong_response_cb is not None:
self._pong_response_cb.cancel()
@@ -469,7 +469,8 @@ async def receive(self, timeout: Optional[float] = None) -> WSMessage:
if msg.type == WSMsgType.CLOSE:
self._closing = True
self._close_code = msg.data
- if not self._closed and self._autoclose:
+ # Could be closed while awaiting reader.
+ if not self._closed and self._autoclose: # type: ignore[redundant-expr]
await self.close()
elif msg.type == WSMsgType.CLOSING:
self._closing = True
diff --git a/examples/background_tasks.py b/examples/background_tasks.py
index 9ee827ff6d6..83110b18b2b 100755
--- a/examples/background_tasks.py
+++ b/examples/background_tasks.py
@@ -30,9 +30,9 @@ async def on_shutdown(app: web.Application) -> None:
async def listen_to_redis(app: web.Application) -> None:
+ sub = await aioredis.Redis(host="localhost", port=6379)
+ ch, *_ = await sub.subscribe("news")
try:
- sub = await aioredis.Redis(host="localhost", port=6379)
- ch, *_ = await sub.subscribe("news")
async for msg in ch.iter(encoding="utf-8"):
# Forward message to all connected websockets:
for ws in app[websockets]:
diff --git a/requirements/constraints.txt b/requirements/constraints.txt
index b09769fd99a..ed60adb832c 100644
--- a/requirements/constraints.txt
+++ b/requirements/constraints.txt
@@ -104,7 +104,7 @@ multidict==6.0.4
# via
# -r requirements/multidict.txt
# yarl
-mypy==0.982 ; implementation_name == "cpython"
+mypy==1.4.1 ; implementation_name == "cpython"
# via
# -r requirements/lint.txt
# -r requirements/test.txt
diff --git a/requirements/lint.txt b/requirements/lint.txt
index 37b387560be..de966d74ad7 100644
--- a/requirements/lint.txt
+++ b/requirements/lint.txt
@@ -1,6 +1,6 @@
-r typing-extensions.txt
aioredis==2.0.1
-mypy==0.982; implementation_name=="cpython"
+mypy==1.4.1; implementation_name=="cpython"
pre-commit==3.3.3
pytest==7.4.0
slotscheck==0.8.0
diff --git a/requirements/test.txt b/requirements/test.txt
index 068a4f7983c..ea220dc8cbe 100644
--- a/requirements/test.txt
+++ b/requirements/test.txt
@@ -2,7 +2,7 @@
Brotli==1.0.9
coverage==6.5.0
freezegun==1.1.0
-mypy==0.982; implementation_name=="cpython"
+mypy==1.4.1; implementation_name=="cpython"
proxy.py ~= 2.4.4rc3
pytest==7.4.0
pytest-cov==4.1.0
diff --git a/setup.cfg b/setup.cfg
index cc2b8b40c91..622788bc5e2 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -83,8 +83,9 @@ max-line-length=79
zip_ok = false
[flake8]
+extend-select = B950
# TODO: don't disable D*, fix up issues instead
-ignore = N801,N802,N803,E203,E226,E305,W504,E252,E301,E302,E704,W503,W504,F811,D1,D4
+ignore = N801,N802,N803,E203,E226,E305,W504,E252,E301,E302,E501,E704,W503,W504,F811,D1,D4
max-line-length = 88
per-file-ignores =
# I900: Shouldn't appear in requirements for examples.
diff --git a/tests/test_circular_imports.py b/tests/test_circular_imports.py
index a3d09811000..2a7de3d9dae 100644
--- a/tests/test_circular_imports.py
+++ b/tests/test_circular_imports.py
@@ -7,7 +7,7 @@
* https://github.com/sanitizers/octomachinery/blob/be18b54/tests/circular_imports_test.py
* https://github.com/pytest-dev/pytest/blob/d18c75b/testing/test_meta.py
* https://twitter.com/codewithanthony/status/1229445110510735361
-""" # noqa: E501
+"""
import os
import pkgutil
import socket
diff --git a/tests/test_cookiejar.py b/tests/test_cookiejar.py
index 3e89ba730a8..163bedaee0d 100644
--- a/tests/test_cookiejar.py
+++ b/tests/test_cookiejar.py
@@ -803,7 +803,7 @@ def test_pickle_format(cookies_to_send) -> None:
with file_path.open("wb") as f:
pickle.dump(cookies, f, pickle.HIGHEST_PROTOCOL)
"""
- pickled = b"\x80\x05\x95\xc5\x07\x00\x00\x00\x00\x00\x00\x8c\x0bcollections\x94\x8c\x0bdefaultdict\x94\x93\x94\x8c\x0chttp.cookies\x94\x8c\x0cSimpleCookie\x94\x93\x94\x85\x94R\x94(\x8c\x00\x94\x8c\x01/\x94\x86\x94h\x05)\x81\x94\x8c\rshared-cookie\x94h\x03\x8c\x06Morsel\x94\x93\x94)\x81\x94(\x8c\x07expires\x94h\x08\x8c\x04path\x94h\t\x8c\x07comment\x94h\x08\x8c\x06domain\x94h\x08\x8c\x07max-age\x94h\x08\x8c\x06secure\x94h\x08\x8c\x08httponly\x94h\x08\x8c\x07version\x94h\x08\x8c\x08samesite\x94h\x08u}\x94(\x8c\x03key\x94h\x0c\x8c\x05value\x94\x8c\x05first\x94\x8c\x0bcoded_value\x94h\x1cubs\x8c\x0bexample.com\x94h\t\x86\x94h\x05)\x81\x94(\x8c\rdomain-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13h\x1eh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah!h\x1b\x8c\x06second\x94h\x1dh$ub\x8c\x14dotted-domain-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13\x8c\x0bexample.com\x94h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah%h\x1b\x8c\x05fifth\x94h\x1dh)ubu\x8c\x11test1.example.com\x94h\t\x86\x94h\x05)\x81\x94\x8c\x11subdomain1-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13h*h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah-h\x1b\x8c\x05third\x94h\x1dh0ubs\x8c\x11test2.example.com\x94h\t\x86\x94h\x05)\x81\x94\x8c\x11subdomain2-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13h1h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah4h\x1b\x8c\x06fourth\x94h\x1dh7ubs\x8c\rdifferent.org\x94h\t\x86\x94h\x05)\x81\x94\x8c\x17different-domain-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13h8h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah;h\x1b\x8c\x05sixth\x94h\x1dh>ubs\x8c\nsecure.com\x94h\t\x86\x94h\x05)\x81\x94\x8c\rsecure-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13h?h\x14h\x08h\x15\x88h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahBh\x1b\x8c\x07seventh\x94h\x1dhEubs\x8c\x0cpathtest.com\x94h\t\x86\x94h\x05)\x81\x94(\x8c\x0eno-path-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13hFh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahIh\x1b\x8c\x06eighth\x94h\x1dhLub\x8c\x0cpath1-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13\x8c\x0cpathtest.com\x94h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahMh\x1b\x8c\x05ninth\x94h\x1dhQubu\x8c\x0cpathtest.com\x94\x8c\x04/one\x94\x86\x94h\x05)\x81\x94\x8c\x0cpath2-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11hSh\x12h\x08h\x13hRh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahVh\x1b\x8c\x05tenth\x94h\x1dhYubs\x8c\x0cpathtest.com\x94\x8c\x08/one/two\x94\x86\x94h\x05)\x81\x94\x8c\x0cpath3-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h[h\x12h\x08h\x13hZh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah^h\x1b\x8c\x08eleventh\x94h\x1dhaubs\x8c\x0cpathtest.com\x94\x8c\t/one/two/\x94\x86\x94h\x05)\x81\x94\x8c\x0cpath4-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11hch\x12h\x08h\x13hbh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahfh\x1b\x8c\x07twelfth\x94h\x1dhiubs\x8c\x0fexpirestest.com\x94h\t\x86\x94h\x05)\x81\x94\x8c\x0eexpires-cookie\x94h\x0e)\x81\x94(h\x10\x8c\x1cTue, 1 Jan 2999 12:00:00 GMT\x94h\x11h\th\x12h\x08h\x13hjh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahmh\x1b\x8c\nthirteenth\x94h\x1dhqubs\x8c\x0emaxagetest.com\x94h\t\x86\x94h\x05)\x81\x94\x8c\x0emax-age-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13hrh\x14\x8c\x0260\x94h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahuh\x1b\x8c\nfourteenth\x94h\x1dhyubs\x8c\x12invalid-values.com\x94h\t\x86\x94h\x05)\x81\x94(\x8c\x16invalid-max-age-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13hzh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah}h\x1b\x8c\tfifteenth\x94h\x1dh\x80ub\x8c\x16invalid-expires-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13\x8c\x12invalid-values.com\x94h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah\x81h\x1b\x8c\tsixteenth\x94h\x1dh\x85ubuu." # noqa: E501
+ pickled = b"\x80\x05\x95\xc5\x07\x00\x00\x00\x00\x00\x00\x8c\x0bcollections\x94\x8c\x0bdefaultdict\x94\x93\x94\x8c\x0chttp.cookies\x94\x8c\x0cSimpleCookie\x94\x93\x94\x85\x94R\x94(\x8c\x00\x94\x8c\x01/\x94\x86\x94h\x05)\x81\x94\x8c\rshared-cookie\x94h\x03\x8c\x06Morsel\x94\x93\x94)\x81\x94(\x8c\x07expires\x94h\x08\x8c\x04path\x94h\t\x8c\x07comment\x94h\x08\x8c\x06domain\x94h\x08\x8c\x07max-age\x94h\x08\x8c\x06secure\x94h\x08\x8c\x08httponly\x94h\x08\x8c\x07version\x94h\x08\x8c\x08samesite\x94h\x08u}\x94(\x8c\x03key\x94h\x0c\x8c\x05value\x94\x8c\x05first\x94\x8c\x0bcoded_value\x94h\x1cubs\x8c\x0bexample.com\x94h\t\x86\x94h\x05)\x81\x94(\x8c\rdomain-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13h\x1eh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah!h\x1b\x8c\x06second\x94h\x1dh$ub\x8c\x14dotted-domain-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13\x8c\x0bexample.com\x94h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah%h\x1b\x8c\x05fifth\x94h\x1dh)ubu\x8c\x11test1.example.com\x94h\t\x86\x94h\x05)\x81\x94\x8c\x11subdomain1-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13h*h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah-h\x1b\x8c\x05third\x94h\x1dh0ubs\x8c\x11test2.example.com\x94h\t\x86\x94h\x05)\x81\x94\x8c\x11subdomain2-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13h1h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah4h\x1b\x8c\x06fourth\x94h\x1dh7ubs\x8c\rdifferent.org\x94h\t\x86\x94h\x05)\x81\x94\x8c\x17different-domain-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13h8h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah;h\x1b\x8c\x05sixth\x94h\x1dh>ubs\x8c\nsecure.com\x94h\t\x86\x94h\x05)\x81\x94\x8c\rsecure-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13h?h\x14h\x08h\x15\x88h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahBh\x1b\x8c\x07seventh\x94h\x1dhEubs\x8c\x0cpathtest.com\x94h\t\x86\x94h\x05)\x81\x94(\x8c\x0eno-path-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13hFh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahIh\x1b\x8c\x06eighth\x94h\x1dhLub\x8c\x0cpath1-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13\x8c\x0cpathtest.com\x94h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahMh\x1b\x8c\x05ninth\x94h\x1dhQubu\x8c\x0cpathtest.com\x94\x8c\x04/one\x94\x86\x94h\x05)\x81\x94\x8c\x0cpath2-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11hSh\x12h\x08h\x13hRh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahVh\x1b\x8c\x05tenth\x94h\x1dhYubs\x8c\x0cpathtest.com\x94\x8c\x08/one/two\x94\x86\x94h\x05)\x81\x94\x8c\x0cpath3-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h[h\x12h\x08h\x13hZh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah^h\x1b\x8c\x08eleventh\x94h\x1dhaubs\x8c\x0cpathtest.com\x94\x8c\t/one/two/\x94\x86\x94h\x05)\x81\x94\x8c\x0cpath4-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11hch\x12h\x08h\x13hbh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahfh\x1b\x8c\x07twelfth\x94h\x1dhiubs\x8c\x0fexpirestest.com\x94h\t\x86\x94h\x05)\x81\x94\x8c\x0eexpires-cookie\x94h\x0e)\x81\x94(h\x10\x8c\x1cTue, 1 Jan 2999 12:00:00 GMT\x94h\x11h\th\x12h\x08h\x13hjh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahmh\x1b\x8c\nthirteenth\x94h\x1dhqubs\x8c\x0emaxagetest.com\x94h\t\x86\x94h\x05)\x81\x94\x8c\x0emax-age-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13hrh\x14\x8c\x0260\x94h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ahuh\x1b\x8c\nfourteenth\x94h\x1dhyubs\x8c\x12invalid-values.com\x94h\t\x86\x94h\x05)\x81\x94(\x8c\x16invalid-max-age-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13hzh\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah}h\x1b\x8c\tfifteenth\x94h\x1dh\x80ub\x8c\x16invalid-expires-cookie\x94h\x0e)\x81\x94(h\x10h\x08h\x11h\th\x12h\x08h\x13\x8c\x12invalid-values.com\x94h\x14h\x08h\x15h\x08h\x16h\x08h\x17h\x08h\x18h\x08u}\x94(h\x1ah\x81h\x1b\x8c\tsixteenth\x94h\x1dh\x85ubuu."
cookies = pickle.loads(pickled)
cj = CookieJar()
diff --git a/tests/test_urldispatch.py b/tests/test_urldispatch.py
index 8055a23c5af..5f5687eacc3 100644
--- a/tests/test_urldispatch.py
+++ b/tests/test_urldispatch.py
@@ -960,6 +960,7 @@ def test_static_route_user_home(router: Any) -> None:
static_dir = pathlib.Path("~") / here.relative_to(pathlib.Path.home())
except ValueError:
pytest.skip("aiohttp folder is not placed in user's HOME")
+ return # TODO: Remove and fix type error
route = router.add_static("/st", str(static_dir))
assert here == route.get_info()["directory"]
diff --git a/tests/test_web_log.py b/tests/test_web_log.py
index 6a09479f4b7..01e43eb5077 100644
--- a/tests/test_web_log.py
+++ b/tests/test_web_log.py
@@ -52,7 +52,7 @@ def test_access_logger_format() -> None:
Ref: https://bitbucket.org/pypy/pypy/issues/1187/call-to-isinstance-in-__sub__-self-other
Ref: https://github.com/celery/celery/issues/811
Ref: https://stackoverflow.com/a/46102240/595220
- """, # noqa: E501
+ """,
)
@pytest.mark.parametrize(
"log_format,expected,extra",
diff --git a/tests/test_web_sendfile.py b/tests/test_web_sendfile.py
index 277ed9d54dd..baf2d1ca6a5 100644
--- a/tests/test_web_sendfile.py
+++ b/tests/test_web_sendfile.py
@@ -23,7 +23,7 @@ def test_using_gzip_if_header_present_and_file_available(loop: Any) -> None:
file_sender = FileResponse(filepath)
file_sender._path = filepath
- file_sender._sendfile = make_mocked_coro(None) # type: ignore[assignment]
+ file_sender._sendfile = make_mocked_coro(None) # type: ignore[method-assign]
loop.run_until_complete(file_sender.prepare(request))
@@ -45,7 +45,7 @@ def test_gzip_if_header_not_present_and_file_available(loop: Any) -> None:
file_sender = FileResponse(filepath)
file_sender._path = filepath
- file_sender._sendfile = make_mocked_coro(None) # type: ignore[assignment]
+ file_sender._sendfile = make_mocked_coro(None) # type: ignore[method-assign]
loop.run_until_complete(file_sender.prepare(request))
@@ -67,7 +67,7 @@ def test_gzip_if_header_not_present_and_file_not_available(loop: Any) -> None:
file_sender = FileResponse(filepath)
file_sender._path = filepath
- file_sender._sendfile = make_mocked_coro(None) # type: ignore[assignment]
+ file_sender._sendfile = make_mocked_coro(None) # type: ignore[method-assign]
loop.run_until_complete(file_sender.prepare(request))
@@ -91,7 +91,7 @@ def test_gzip_if_header_present_and_file_not_available(loop: Any) -> None:
file_sender = FileResponse(filepath)
file_sender._path = filepath
- file_sender._sendfile = make_mocked_coro(None) # type: ignore[assignment]
+ file_sender._sendfile = make_mocked_coro(None) # type: ignore[method-assign]
loop.run_until_complete(file_sender.prepare(request))
@@ -109,7 +109,7 @@ def test_status_controlled_by_user(loop: Any) -> None:
file_sender = FileResponse(filepath, status=203)
file_sender._path = filepath
- file_sender._sendfile = make_mocked_coro(None) # type: ignore[assignment]
+ file_sender._sendfile = make_mocked_coro(None) # type: ignore[method-assign]
loop.run_until_complete(file_sender.prepare(request))