Skip to content

Commit

Permalink
Fix __iter__ return type to Iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
altescy committed Dec 12, 2023
1 parent 09459ef commit a5d866f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions elastic_transport/_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __setstate__(self, state: Tuple[_BodyType, ApiResponseMeta]) -> None:
def __len__(self) -> int:
return len(self._body)

def __iter__(self) -> Iterable[Any]:
def __iter__(self) -> Iterator[Any]:
return iter(self._body) # type: ignore[no-any-return]

def __str__(self) -> str:
Expand All @@ -134,7 +134,7 @@ def raw(self) -> _BodyType:
class TextApiResponse(ApiResponse[str]):
"""API responses which are text such as 'text/plain' or 'text/csv'"""

def __iter__(self) -> Iterable[str]:
def __iter__(self) -> Iterator[str]:
return iter(self.body)

def __getitem__(self, item: Union[int, slice]) -> str:
Expand All @@ -148,7 +148,7 @@ def body(self) -> str:
class BinaryApiResponse(ApiResponse[bytes]):
"""API responses which are a binary response such as Mapbox vector tiles"""

def __iter__(self) -> Iterable[int]:
def __iter__(self) -> Iterator[int]:
return iter(self.body)

@overload
Expand Down Expand Up @@ -214,7 +214,7 @@ def __getitem__(
) -> Union[_ListItemBodyType, List[_ListItemBodyType]]:
return self.body[item]

def __iter__(self) -> Iterable[_ListItemBodyType]:
def __iter__(self) -> Iterator[_ListItemBodyType]:
return iter(self.body)

@property
Expand Down

0 comments on commit a5d866f

Please sign in to comment.