Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite825653

Browse files
chore: correct type-hints for per_page attrbute
There are occasions where a GitLab `list()` call does not return the`x-per-page` header. For example the listing of custom attributes.Update the type-hints to reflect that.
1 parent9897c98 commite825653

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

‎gitlab/base.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def next_page(self) -> Optional[int]:
302302
returnself._list.next_page
303303

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

‎gitlab/client.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,11 +1039,9 @@ def next_page(self) -> Optional[int]:
10391039
returnint(self._next_page)ifself._next_pageelseNone
10401040

10411041
@property
1042-
defper_page(self)->int:
1042+
defper_page(self)->Optional[int]:
10431043
"""The number of items per page."""
1044-
ifTYPE_CHECKING:
1045-
assertself._per_pageisnotNone
1046-
returnint(self._per_page)
1044+
returnint(self._per_page)ifself._per_pageisnotNoneelseNone
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)

[8]ページ先頭

©2009-2025 Movatter.jp