| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e8884f2 commit 8b6078f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - from typing import Any | ||
| 1 | + from typing import Any, cast, TYPE_CHECKING, Union | ||
| 2 | 2 | ||
| 3 | 3 | from gitlab import cli | |
| 4 | 4 | from gitlab import exceptions as exc | |
@@ -26,7 +26,7 @@ class GroupMilestone(SaveMixin, ObjectDeleteMixin, RESTObject): | |||
| 26 | 26 | ||
| 27 | 27 | @cli.register_custom_action("GroupMilestone") | |
| 28 | 28 | @exc.on_http_error(exc.GitlabListError) | |
| 29 | - def issues(self, **kwargs): | ||
| 29 | + def issues(self, **kwargs: Any) -> RESTObjectList: | ||
| 30 | 30 | """List issues related to this milestone. | |
| 31 | 31 | ||
| 32 | 32 | Args: | |
@@ -47,13 +47,15 @@ def issues(self, **kwargs): | |||
| 47 | 47 | ||
| 48 | 48 | path = f"{self.manager.path}/{self.get_id()}/issues" | |
| 49 | 49 | data_list = self.manager.gitlab.http_list(path, as_list=False, **kwargs) | |
| 50 | + if TYPE_CHECKING: | ||
| 51 | + assert isinstance(data_list, RESTObjectList) | ||
| 50 | 52 | manager = GroupIssueManager(self.manager.gitlab, parent=self.manager._parent) | |
| 51 | 53 | # FIXME(gpocentek): the computed manager path is not correct | |
| 52 | 54 | return RESTObjectList(manager, GroupIssue, data_list) | |
| 53 | 55 | ||
| 54 | 56 | @cli.register_custom_action("GroupMilestone") | |
| 55 | 57 | @exc.on_http_error(exc.GitlabListError) | |
| 56 | - def merge_requests(self, **kwargs): | ||
| 58 | + def merge_requests(self, **kwargs: Any) -> RESTObjectList: | ||
| 57 | 59 | """List the merge requests related to this milestone. | |
| 58 | 60 | ||
| 59 | 61 | Args: | |
@@ -73,6 +75,8 @@ def merge_requests(self, **kwargs): | |||
| 73 | 75 | """ | |
| 74 | 76 | path = f"{self.manager.path}/{self.get_id()}/merge_requests" | |
| 75 | 77 | data_list = self.manager.gitlab.http_list(path, as_list=False, **kwargs) | |
| 78 | + if TYPE_CHECKING: | ||
| 79 | + assert isinstance(data_list, RESTObjectList) | ||
| 76 | 80 | manager = GroupIssueManager(self.manager.gitlab, parent=self.manager._parent) | |
| 77 | 81 | # FIXME(gpocentek): the computed manager path is not correct | |
| 78 | 82 | return RESTObjectList(manager, GroupMergeRequest, data_list) | |
@@ -91,14 +95,19 @@ class GroupMilestoneManager(CRUDMixin, RESTManager): | |||
| 91 | 95 | _list_filters = ("iids", "state", "search") | |
| 92 | 96 | _types = {"iids": types.ListAttribute} | |
| 93 | 97 | ||
| 98 | + def get( | ||
| 99 | + self, id: Union[str, int], lazy: bool = False, **kwargs: Any | ||
| 100 | + ) -> GroupMilestone: | ||
| 101 | + return cast(GroupMilestone, super().get(id=id, lazy=lazy, **kwargs)) | ||
| 102 | + | ||
| 94 | 103 | ||
| 95 | 104 | class ProjectMilestone(PromoteMixin, SaveMixin, ObjectDeleteMixin, RESTObject): | |
| 96 | 105 | _short_print_attr = "title" | |
| 97 | 106 | _update_uses_post = True | |
| 98 | 107 | ||
| 99 | 108 | @cli.register_custom_action("ProjectMilestone") | |
| 100 | 109 | @exc.on_http_error(exc.GitlabListError) | |
| 101 | - def issues(self, **kwargs): | ||
| 110 | + def issues(self, **kwargs: Any) -> RESTObjectList: | ||
| 102 | 111 | """List issues related to this milestone. | |
| 103 | 112 | ||
| 104 | 113 | Args: | |
@@ -119,6 +128,8 @@ def issues(self, **kwargs): | |||
| 119 | 128 | ||
| 120 | 129 | path = f"{self.manager.path}/{self.get_id()}/issues" | |
| 121 | 130 | data_list = self.manager.gitlab.http_list(path, as_list=False, **kwargs) | |
| 131 | + if TYPE_CHECKING: | ||
| 132 | + assert isinstance(data_list, RESTObjectList) | ||
| 122 | 133 | manager = ProjectIssueManager(self.manager.gitlab, parent=self.manager._parent) | |
| 123 | 134 | # FIXME(gpocentek): the computed manager path is not correct | |
| 124 | 135 | return RESTObjectList(manager, ProjectIssue, data_list) | |
@@ -145,6 +156,8 @@ def merge_requests(self, **kwargs: Any) -> RESTObjectList: | |||
| 145 | 156 | """ | |
| 146 | 157 | path = f"{self.manager.path}/{self.get_id()}/merge_requests" | |
| 147 | 158 | data_list = self.manager.gitlab.http_list(path, as_list=False, **kwargs) | |
| 159 | + if TYPE_CHECKING: | ||
| 160 | + assert isinstance(data_list, RESTObjectList) | ||
| 148 | 161 | manager = ProjectMergeRequestManager( | |
| 149 | 162 | self.manager.gitlab, parent=self.manager._parent | |
| 150 | 163 | ) | |
@@ -165,3 +178,8 @@ class ProjectMilestoneManager(CRUDMixin, RESTManager): | |||
| 165 | 178 | ) | |
| 166 | 179 | _list_filters = ("iids", "state", "search") | |
| 167 | 180 | _types = {"iids": types.ListAttribute} | |
| 181 | + | ||
| 182 | + def get( | ||
| 183 | + self, id: Union[str, int], lazy: bool = False, **kwargs: Any | ||
| 184 | + ) -> ProjectMilestone: | ||
| 185 | + return cast(ProjectMilestone, super().get(id=id, lazy=lazy, **kwargs)) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,6 @@ module = [ | |||
| 14 | 14 | "docs.ext.*", | |
| 15 | 15 | "gitlab.v4.objects.files", | |
| 16 | 16 | "gitlab.v4.objects.labels", | |
| 17 | - "gitlab.v4.objects.milestones", | ||
| 18 | 17 | "gitlab.v4.objects.pipelines", | |
| 19 | 18 | "gitlab.v4.objects.repositories", | |
| 20 | 19 | "gitlab.v4.objects.services", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments