Skip to content

Commit 5e19694

Browse files
authored
Merge pull request #1880 from python-gitlab/jlvillal/easy
chore: correct type-hints for per_page attrbute
2 parents 9897c98 + e825653 commit 5e19694

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

gitlab/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def next_page(self) -> Optional[int]:
302302
return self._list.next_page
303303

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

gitlab/client.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1039,11 +1039,9 @@ def next_page(self) -> Optional[int]:
10391039
return int(self._next_page) if self._next_page else None
10401040

10411041
@property
1042-
def per_page(self) -> int:
1042+
def per_page(self) -> Optional[int]:
10431043
"""The number of items per page."""
1044-
if TYPE_CHECKING:
1045-
assert self._per_page is not None
1046-
return int(self._per_page)
1044+
return int(self._per_page) if self._per_page is not None else None
10471045

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

0 commit comments

Comments
 (0)