Skip to content

Commit

Permalink
add missing type hints for ItemPaged (Azure#24548)
Browse files Browse the repository at this point in the history
* add missing type hints for ItemPaged

* update changelog
  • Loading branch information
kristapratico authored and sarkar-rajarshi committed Jun 9, 2022
1 parent bc9d4c9 commit 4f75bb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions sdk/core/azure-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bugs Fixed

- Fixed type hints for `azure.core.paging.ItemPaged` #24548

### Other Changes

## 1.24.0 (2022-05-06)
Expand Down
5 changes: 2 additions & 3 deletions sdk/core/azure-core/azure/core/paging.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ def __init__(self, *args, **kwargs):
"page_iterator_class", PageIterator
)

def by_page(self, continuation_token=None):
# type: (Optional[str]) -> Iterator[Iterator[ReturnType]]
def by_page(self, continuation_token: Optional[str] = None) -> Iterator[Iterator[ReturnType]]:
"""Get an iterator of pages of objects, instead of an iterator of objects.
:param str continuation_token:
Expand All @@ -123,7 +122,7 @@ def __iter__(self):
"""Return 'self'."""
return self

def __next__(self):
def __next__(self) -> ReturnType:
if self._page_iterator is None:
self._page_iterator = itertools.chain.from_iterable(self.by_page())
return next(self._page_iterator)
Expand Down

0 comments on commit 4f75bb2

Please sign in to comment.