Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aiohttp/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def http_exception(self) -> Optional[HTTPException]:
"""HTTPException instance raised on router's resolving, or None"""

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

@property # pragma: no branch
Expand Down
4 changes: 2 additions & 2 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ def skip_auto_headers(self) -> FrozenSet[istr]:
return self._skip_auto_headers

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

Expand Down Expand Up @@ -1338,7 +1338,7 @@ def trust_env(self) -> bool:
return self._trust_env

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

Expand Down
2 changes: 1 addition & 1 deletion aiohttp/client_reqrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ def ssl(self) -> Union["SSLContext", bool, Fingerprint]:
return self._ssl

@property
def connection_key(self) -> ConnectionKey: # type: ignore[misc]
def connection_key(self) -> ConnectionKey:
if proxy_headers := self.proxy_headers:
h: Optional[int] = hash(tuple(proxy_headers.items()))
else:
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/formdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def add_fields(self, *fields: Any) -> None:

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

else:
raise TypeError(
Expand Down
10 changes: 5 additions & 5 deletions aiohttp/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def __new__(
return super().__new__(cls, login, password, encoding)

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

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


@frozen_dataclass_decorator
class ProxyInfo: # type: ignore[misc]
class ProxyInfo:
proxy: URL
proxy_auth: Optional[BasicAuth]

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

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

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

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

def get(self, key: Union[str, AppKey[_T]], default: Any = None) -> Any:
try:
Expand Down
4 changes: 2 additions & 2 deletions aiohttp/http_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _write(
transport = self._protocol.transport
if transport is None or transport.is_closing():
raise ClientConnectionResetError("Cannot write to closing transport")
transport.write(chunk) # type: ignore[arg-type]
transport.write(chunk)

def _writelines(
self,
Expand All @@ -119,7 +119,7 @@ def _writelines(
if SKIP_WRITELINES or size < MIN_PAYLOAD_FOR_WRITELINES:
transport.write(b"".join(chunks))
else:
transport.writelines(chunks) # type: ignore[arg-type]
transport.writelines(chunks)

def _write_chunked_payload(
self, chunk: Union[bytes, bytearray, "memoryview[int]", "memoryview[bytes]"]
Expand Down
8 changes: 4 additions & 4 deletions aiohttp/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
class AiohttpClient(Protocol):
# TODO(PY311): Use Unpack to specify ClientSession kwargs.
@overload
async def __call__( # type: ignore[misc]
async def __call__(
self,
__param: Application,
*,
server_kwargs: Optional[Dict[str, Any]] = None,
**kwargs: Any,
) -> TestClient[Request, Application]: ...
@overload
async def __call__( # type: ignore[misc]
async def __call__(
self,
__param: BaseTestServer[_Request],
*,
Expand Down Expand Up @@ -400,14 +400,14 @@ def aiohttp_client( # type: ignore[misc]
clients = []

@overload
async def go( # type: ignore[misc]
async def go(
__param: Application,
*,
server_kwargs: Optional[Dict[str, Any]] = None,
**kwargs: Any,
) -> TestClient[Request, Application]: ...
@overload
async def go( # type: ignore[misc]
async def go(
__param: BaseTestServer[_Request],
*,
server_kwargs: Optional[Dict[str, Any]] = None,
Expand Down
6 changes: 3 additions & 3 deletions aiohttp/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ async def start_server(self, **kwargs: Any) -> None:
self._root = URL(f"{self.scheme}://{absolute_host}:{self.port}")

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

Expand Down Expand Up @@ -265,15 +265,15 @@ class TestClient(Generic[_Request, _ApplicationNone]):
__test__ = False

@overload
def __init__( # type: ignore[misc]
def __init__(
self: "TestClient[Request, Application]",
server: TestServer,
*,
cookie_jar: Optional[AbstractCookieJar] = None,
**kwargs: Any,
) -> None: ...
@overload
def __init__( # type: ignore[misc]
def __init__(
self: "TestClient[_Request, None]",
server: BaseTestServer[_Request],
*,
Expand Down
6 changes: 3 additions & 3 deletions aiohttp/web_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def __eq__(self, other: object) -> bool:
def __getitem__(self, key: AppKey[_T]) -> _T: ...

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

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

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

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

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

def get(self, key: Union[str, AppKey[_T]], default: Any = None) -> Any:
return self._state.get(key, default)
Expand Down
8 changes: 4 additions & 4 deletions aiohttp/web_fileresponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ async def _not_modified(
) -> Optional[AbstractStreamWriter]:
self.set_status(HTTPNotModified.status_code)
self._length_check = False
self.etag = etag_value # type: ignore[assignment]
self.last_modified = last_modified # type: ignore[assignment]
self.etag = etag_value
self.last_modified = last_modified
# Delete any Content-Length headers provided by user. HTTP 304
# should always have empty response body
return await super().prepare(request)
Expand Down Expand Up @@ -391,8 +391,8 @@ async def _prepare_open_file(
# compress.
self._compression = False

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

self._headers[hdrs.ACCEPT_RANGES] = "bytes"
Expand Down
4 changes: 2 additions & 2 deletions aiohttp/web_routedef.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def register(self, router: UrlDispatcher) -> List[AbstractRoute]:


@dataclasses.dataclass(frozen=True, repr=False)
class RouteDef(AbstractRouteDef): # type: ignore[misc]
class RouteDef(AbstractRouteDef):
method: str
path: str
handler: _HandlerType
Expand All @@ -79,7 +79,7 @@ def register(self, router: UrlDispatcher) -> List[AbstractRoute]:


@dataclasses.dataclass(frozen=True, repr=False)
class StaticDef(AbstractRouteDef): # type: ignore[misc]
class StaticDef(AbstractRouteDef):
prefix: str
path: PathLike
kwargs: Dict[str, Any]
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/web_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def server(self) -> Optional[Server[_Request]]:
return self._server

@property
def addresses(self) -> List[Any]: # type: ignore[misc]
def addresses(self) -> List[Any]:
ret: List[Any] = []
for site in self._sites:
server = site._server
Expand Down
4 changes: 2 additions & 2 deletions aiohttp/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Server(Generic[_Request]):
request_factory: _RequestFactory[_Request]

@overload
def __init__( # type: ignore[misc]
def __init__(
self: "Server[BaseRequest]",
handler: Callable[[_Request], Awaitable[StreamResponse]],
*,
Expand All @@ -49,7 +49,7 @@ def __init__( # type: ignore[misc]
**kwargs: Any, # TODO(PY311): Use Unpack to define kwargs from RequestHandler
) -> None: ...
@overload
def __init__( # type: ignore[misc]
def __init__(
self,
handler: Callable[[_Request], Awaitable[StreamResponse]],
*,
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def handle_abort(self, sig: int, frame: Optional[FrameType]) -> None:
sys.exit(1)

@staticmethod
def _create_ssl_context(cfg: Any) -> "SSLContext": # type: ignore[misc]
def _create_ssl_context(cfg: Any) -> "SSLContext":
"""Creates SSLContext instance for usage in asyncio.create_server.

See ssl.SSLSocket.__init__ for more details.
Expand Down
4 changes: 3 additions & 1 deletion requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ multidict==6.4.4
# -r requirements/multidict.in
# -r requirements/runtime-deps.in
# yarl
mypy==1.15.0 ; implementation_name == "cpython"
mypy==1.16.1 ; implementation_name == "cpython"
# via
# -r requirements/lint.in
# -r requirements/test.in
Expand All @@ -133,6 +133,8 @@ packaging==25.0
# pytest
# sphinx
# wheel
pathspec==0.12.1
# via mypy
pip-tools==7.4.1
# via -r requirements/dev.in
pkgconfig==1.5.5
Expand Down
4 changes: 3 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ multidict==6.4.4
# via
# -r requirements/runtime-deps.in
# yarl
mypy==1.15.0 ; implementation_name == "cpython"
mypy==1.16.1 ; implementation_name == "cpython"
# via
# -r requirements/lint.in
# -r requirements/test.in
Expand All @@ -130,6 +130,8 @@ packaging==25.0
# pytest
# sphinx
# wheel
pathspec==0.12.1
# via mypy
pip-tools==7.4.1
# via -r requirements/dev.in
pkgconfig==1.5.5
Expand Down
4 changes: 3 additions & 1 deletion requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
mypy==1.15.0 ; implementation_name == "cpython"
mypy==1.16.1 ; implementation_name == "cpython"
# via -r requirements/lint.in
mypy-extensions==1.1.0
# via mypy
nodeenv==1.9.1
# via pre-commit
packaging==25.0
# via pytest
pathspec==0.12.1
# via mypy
platformdirs==4.3.8
# via virtualenv
pluggy==1.6.0
Expand Down
4 changes: 3 additions & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ multidict==6.4.4
# via
# -r requirements/runtime-deps.in
# yarl
mypy==1.15.0 ; implementation_name == "cpython"
mypy==1.16.1 ; implementation_name == "cpython"
# via -r requirements/test.in
mypy-extensions==1.1.0
# via mypy
packaging==25.0
# via
# gunicorn
# pytest
pathspec==0.12.1
# via mypy
pkgconfig==1.5.5
# via -r requirements/test.in
pluggy==1.6.0
Expand Down
Loading
Loading