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

Commitde2e4dd

Browse files
JohnVillalovosnejch
authored andcommitted
fix: issuesclosed_by()/related_merge_requests() usehttp_list
The `closed_by()` and `related_merge_requests()` API calls returnlists. So use the `http_list()` method.This will also warn the user if only a subset of the data is returned.
1 parentd065275 commitde2e4dd

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

‎gitlab/v4/objects/issues.py‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
fromtypingimportAny,cast,Dict,Optional,Tuple,TYPE_CHECKING,Union
1+
fromtypingimportAny,cast,Dict,List,Optional,Tuple,TYPE_CHECKING,Union
22

3-
fromgitlabimportcli
3+
importrequests
4+
5+
fromgitlabimportcli,client
46
fromgitlabimportexceptionsasexc
57
fromgitlabimporttypes
68
fromgitlab.baseimportRESTManager,RESTObject
@@ -182,7 +184,9 @@ def reorder(
182184

183185
@cli.register_custom_action(cls_names="ProjectIssue")
184186
@exc.on_http_error(exc.GitlabGetError)
185-
defrelated_merge_requests(self,**kwargs:Any)->Dict[str,Any]:
187+
defrelated_merge_requests(
188+
self,**kwargs:Any
189+
)->Union[client.GitlabList,List[Dict[str,Any]]]:
186190
"""List merge requests related to the issue.
187191
188192
Args:
@@ -196,14 +200,16 @@ def related_merge_requests(self, **kwargs: Any) -> Dict[str, Any]:
196200
The list of merge requests.
197201
"""
198202
path=f"{self.manager.path}/{self.encoded_id}/related_merge_requests"
199-
result=self.manager.gitlab.http_get(path,**kwargs)
203+
result=self.manager.gitlab.http_list(path,**kwargs)
200204
ifTYPE_CHECKING:
201-
assertisinstance(result,dict)
205+
assertnotisinstance(result,requests.Response)
202206
returnresult
203207

204208
@cli.register_custom_action(cls_names="ProjectIssue")
205209
@exc.on_http_error(exc.GitlabGetError)
206-
defclosed_by(self,**kwargs:Any)->Dict[str,Any]:
210+
defclosed_by(
211+
self,**kwargs:Any
212+
)->Union[client.GitlabList,List[Dict[str,Any]]]:
207213
"""List merge requests that will close the issue when merged.
208214
209215
Args:
@@ -217,9 +223,9 @@ def closed_by(self, **kwargs: Any) -> Dict[str, Any]:
217223
The list of merge requests.
218224
"""
219225
path=f"{self.manager.path}/{self.encoded_id}/closed_by"
220-
result=self.manager.gitlab.http_get(path,**kwargs)
226+
result=self.manager.gitlab.http_list(path,**kwargs)
221227
ifTYPE_CHECKING:
222-
assertisinstance(result,dict)
228+
assertnotisinstance(result,requests.Response)
223229
returnresult
224230

225231

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp