Skip to content

Commit 716a905

Browse files
Draft: ListMixin.list typing overload
Overload `ListMixin.list` method typing to return either `RESTObjectList` or `list` based on the passed options.
1 parent f62dda7 commit 716a905

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎gitlab/mixins.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,20 @@ def refresh(self, **kwargs: Any) -> None:
161161
class ListMixin(HeadMixin[base.TObjCls]):
162162
_list_filters: tuple[str, ...] = ()
163163

164+
@overload
165+
def list(
166+
self,
167+
*,
168+
iterator: Literal[False] = False,
169+
page: int | None = None,
170+
**kwargs: Any,
171+
) -> list[base.TObjCls]: ...
172+
173+
@overload
174+
def list(
175+
self, *, iterator: Literal[True] = True, page: None = None, **kwargs: Any
176+
) -> base.RESTObjectList[base.TObjCls]: ...
177+
164178
@exc.on_http_error(exc.GitlabListError)
165179
def list(
166180
self, **kwargs: Any

0 commit comments

Comments
 (0)