8000 chore: correct type-hints for per_page attrbute by JohnVillalovos · Pull Request #1880 · python-gitlab/python-gitlab · GitHub
[go: up one dir, main page]

Skip to content

chore: correct type-hints for per_page attrbute #1880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2022
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.
8000 Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gitlab/base.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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