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 fe961939484..3f1b4a7e837 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 @@ -188,16 +188,16 @@ setuptools-git==1.2 six==1.16.0 # via # python-dateutil + # sphinx # virtualenv slotscheck==0.17.1 # via -r requirements/lint.in snowballstemmer==2.1.0 # via sphinx -sphinx==7.2.6 +sphinx==7.1.2 # via # -r requirements/doc.in # sphinxcontrib-blockdiag - # sphinxcontrib-serializinghtml # sphinxcontrib-spelling # sphinxcontrib-towncrier sphinxcontrib-applehelp==1.0.2 @@ -212,7 +212,7 @@ sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-qthelp==1.0.3 # via sphinx -sphinxcontrib-serializinghtml==1.1.9 +sphinxcontrib-serializinghtml==1.1.5 # via sphinx sphinxcontrib-spelling==8.0.0 ; platform_system != "Windows" # via -r requirements/doc-spelling.in @@ -280,3 +280,4 @@ setuptools==68.0.0 # via # blockdiag # pip-tools + # sphinx diff --git a/requirements/dev.txt b/requirements/dev.txt index fb7bd011352..66502c928c8 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 @@ -177,16 +177,17 @@ requests==2.31.0 setuptools-git==1.2 # via -r requirements/test.in six==1.16.0 - # via python-dateutil + # via + # python-dateutil + # sphinx slotscheck==0.17.1 # via -r requirements/lint.in snowballstemmer==2.2.0 # via sphinx -sphinx==7.2.6 +sphinx==7.1.2 # via # -r requirements/doc.in # sphinxcontrib-blockdiag - # sphinxcontrib-serializinghtml # sphinxcontrib-towncrier sphinxcontrib-applehelp==1.0.4 # via sphinx @@ -200,7 +201,7 @@ sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-qthelp==1.0.3 # via sphinx -sphinxcontrib-serializinghtml==1.1.9 +sphinxcontrib-serializinghtml==1.1.5 # via sphinx sphinxcontrib-towncrier==0.4.0a0 # via -r requirements/doc.in @@ -268,3 +269,4 @@ setuptools==68.0.0 # blockdiag # nodeenv # pip-tools + # sphinx 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 0bb559cd969..b91fd584b35 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