Skip to content

Commit

Permalink
Merge pull request #1880 from python-gitlab/jlvillal/easy
Browse files Browse the repository at this point in the history
chore: correct type-hints for per_page attrbute
  • Loading branch information
nejch committed Feb 5, 2022
2 parents 9897c98 + e825653 commit 5e19694
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gitlab/base.py
Expand Up @@ -302,7 +302,7 @@ def next_page(self) -> Optional[int]:
return self._list.next_page

@property
def per_page(self) -> int:
def per_page(self) -> Optional[int]:
"""The number of items per page."""
return self._list.per_page

Expand Down
6 changes: 2 additions & 4 deletions gitlab/client.py
Expand Up @@ -1039,11 +1039,9 @@ def next_page(self) -> Optional[int]:
return int(self._next_page) if self._next_page else None

@property
def per_page(self) -> int:
def per_page(self) -> Optional[int]:
"""The number of items per page."""
if TYPE_CHECKING:
assert self._per_page is not None
return int(self._per_page)
return int(self._per_page) if self._per_page is not None else None

# NOTE(jlvillal): When a query returns more than 10,000 items, GitLab doesn't return
# the headers 'x-total-pages' and 'x-total'. In those cases we return None.
Expand Down

0 comments on commit 5e19694

Please sign in to comment.