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

Commit8b6078f

Browse files
chore: add type-hints to gitlab/v4/objects/milestones.py
1 parente8884f2 commit8b6078f

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

‎gitlab/v4/objects/milestones.py‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fromtypingimportAny
1+
fromtypingimportAny,cast,TYPE_CHECKING,Union
22

33
fromgitlabimportcli
44
fromgitlabimportexceptionsasexc
@@ -26,7 +26,7 @@ class GroupMilestone(SaveMixin, ObjectDeleteMixin, RESTObject):
2626

2727
@cli.register_custom_action("GroupMilestone")
2828
@exc.on_http_error(exc.GitlabListError)
29-
defissues(self,**kwargs):
29+
defissues(self,**kwargs:Any)->RESTObjectList:
3030
"""List issues related to this milestone.
3131
3232
Args:
@@ -47,13 +47,15 @@ def issues(self, **kwargs):
4747

4848
path=f"{self.manager.path}/{self.get_id()}/issues"
4949
data_list=self.manager.gitlab.http_list(path,as_list=False,**kwargs)
50+
ifTYPE_CHECKING:
51+
assertisinstance(data_list,RESTObjectList)
5052
manager=GroupIssueManager(self.manager.gitlab,parent=self.manager._parent)
5153
# FIXME(gpocentek): the computed manager path is not correct
5254
returnRESTObjectList(manager,GroupIssue,data_list)
5355

5456
@cli.register_custom_action("GroupMilestone")
5557
@exc.on_http_error(exc.GitlabListError)
56-
defmerge_requests(self,**kwargs):
58+
defmerge_requests(self,**kwargs:Any)->RESTObjectList:
5759
"""List the merge requests related to this milestone.
5860
5961
Args:
@@ -73,6 +75,8 @@ def merge_requests(self, **kwargs):
7375
"""
7476
path=f"{self.manager.path}/{self.get_id()}/merge_requests"
7577
data_list=self.manager.gitlab.http_list(path,as_list=False,**kwargs)
78+
ifTYPE_CHECKING:
79+
assertisinstance(data_list,RESTObjectList)
7680
manager=GroupIssueManager(self.manager.gitlab,parent=self.manager._parent)
7781
# FIXME(gpocentek): the computed manager path is not correct
7882
returnRESTObjectList(manager,GroupMergeRequest,data_list)
@@ -91,14 +95,19 @@ class GroupMilestoneManager(CRUDMixin, RESTManager):
9195
_list_filters= ("iids","state","search")
9296
_types= {"iids":types.ListAttribute}
9397

98+
defget(
99+
self,id:Union[str,int],lazy:bool=False,**kwargs:Any
100+
)->GroupMilestone:
101+
returncast(GroupMilestone,super().get(id=id,lazy=lazy,**kwargs))
102+
94103

95104
classProjectMilestone(PromoteMixin,SaveMixin,ObjectDeleteMixin,RESTObject):
96105
_short_print_attr="title"
97106
_update_uses_post=True
98107

99108
@cli.register_custom_action("ProjectMilestone")
100109
@exc.on_http_error(exc.GitlabListError)
101-
defissues(self,**kwargs):
110+
defissues(self,**kwargs:Any)->RESTObjectList:
102111
"""List issues related to this milestone.
103112
104113
Args:
@@ -119,6 +128,8 @@ def issues(self, **kwargs):
119128

120129
path=f"{self.manager.path}/{self.get_id()}/issues"
121130
data_list=self.manager.gitlab.http_list(path,as_list=False,**kwargs)
131+
ifTYPE_CHECKING:
132+
assertisinstance(data_list,RESTObjectList)
122133
manager=ProjectIssueManager(self.manager.gitlab,parent=self.manager._parent)
123134
# FIXME(gpocentek): the computed manager path is not correct
124135
returnRESTObjectList(manager,ProjectIssue,data_list)
@@ -145,6 +156,8 @@ def merge_requests(self, **kwargs: Any) -> RESTObjectList:
145156
"""
146157
path=f"{self.manager.path}/{self.get_id()}/merge_requests"
147158
data_list=self.manager.gitlab.http_list(path,as_list=False,**kwargs)
159+
ifTYPE_CHECKING:
160+
assertisinstance(data_list,RESTObjectList)
148161
manager=ProjectMergeRequestManager(
149162
self.manager.gitlab,parent=self.manager._parent
150163
)
@@ -165,3 +178,8 @@ class ProjectMilestoneManager(CRUDMixin, RESTManager):
165178
)
166179
_list_filters= ("iids","state","search")
167180
_types= {"iids":types.ListAttribute}
181+
182+
defget(
183+
self,id:Union[str,int],lazy:bool=False,**kwargs:Any
184+
)->ProjectMilestone:
185+
returncast(ProjectMilestone,super().get(id=id,lazy=lazy,**kwargs))

‎pyproject.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ module = [
1414
"docs.ext.*",
1515
"gitlab.v4.objects.files",
1616
"gitlab.v4.objects.labels",
17-
"gitlab.v4.objects.milestones",
1817
"gitlab.v4.objects.pipelines",
1918
"gitlab.v4.objects.repositories",
2019
"gitlab.v4.objects.services",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp