diff --git a/httpx/_content.py b/httpx/_content.py index 1c450b75..b16e12d9 100644 --- a/httpx/_content.py +++ b/httpx/_content.py @@ -54,10 +54,10 @@ class IteratorByteStream(SyncByteStream): self._is_stream_consumed = True if hasattr(self._stream, "read"): # File-like interfaces should use 'read' directly. - chunk = self._stream.read(self.CHUNK_SIZE) # type: ignore + chunk = self._stream.read(self.CHUNK_SIZE) while chunk: yield chunk - chunk = self._stream.read(self.CHUNK_SIZE) # type: ignore + chunk = self._stream.read(self.CHUNK_SIZE) else: # Otherwise iterate. for part in self._stream: @@ -79,10 +79,10 @@ class AsyncIteratorByteStream(AsyncByteStream): self._is_stream_consumed = True if hasattr(self._stream, "aread"): # File-like interfaces should use 'aread' directly. - chunk = await self._stream.aread(self.CHUNK_SIZE) # type: ignore + chunk = await self._stream.aread(self.CHUNK_SIZE) while chunk: yield chunk - chunk = await self._stream.aread(self.CHUNK_SIZE) # type: ignore + chunk = await self._stream.aread(self.CHUNK_SIZE) else: # Otherwise iterate. async for part in self._stream: @@ -107,7 +107,6 @@ class UnattachedStream(AsyncByteStream, SyncByteStream): def encode_content( content: Union[str, bytes, Iterable[bytes], AsyncIterable[bytes]] ) -> Tuple[Dict[str, str], Union[SyncByteStream, AsyncByteStream]]: - if isinstance(content, (bytes, str)): body = content.encode("utf-8") if isinstance(content, str) else content content_length = len(body) diff --git a/httpx/_transports/default.py b/httpx/_transports/default.py index dfd274e7..fca7de98 100644 --- a/httpx/_transports/default.py +++ b/httpx/_transports/default.py @@ -106,7 +106,7 @@ class ResponseStream(SyncByteStream): def close(self) -> None: if hasattr(self._httpcore_stream, "close"): - self._httpcore_stream.close() # type: ignore + self._httpcore_stream.close() class HTTPTransport(BaseTransport): @@ -241,7 +241,7 @@ class AsyncResponseStream(AsyncByteStream): async def aclose(self) -> None: if hasattr(self._httpcore_stream, "aclose"): - await self._httpcore_stream.aclose() # type: ignore + await self._httpcore_stream.aclose() class AsyncHTTPTransport(AsyncBaseTransport): diff --git a/requirements.txt b/requirements.txt index ea096679..0dff922f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,7 +29,7 @@ flake8-pie==0.16.0; python_version>='3.7' importlib-metadata==4.13.0; python_version>='3.7' isort==5.11.4; python_version<'3.8' isort==5.12.0; python_version>='3.8' -mypy==0.982 +mypy==1.0.1 types-certifi==2021.10.8.2 pytest==7.2.1 trio==0.22.0