| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 500895a commit bb1a454
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + from typing import Any, cast, Dict, Optional, TYPE_CHECKING, Union | ||
| 2 | + | ||
| 1 | 3 | from gitlab import exceptions as exc | |
| 2 | 4 | from gitlab import types | |
| 3 | 5 | from gitlab.base import RequiredOptional, RESTManager, RESTObject | |
@@ -42,11 +44,17 @@ class GroupEpicManager(CRUDMixin, RESTManager): | |||
| 42 | 44 | ) | |
| 43 | 45 | _types = {"labels": types.ListAttribute} | |
| 44 | 46 | ||
| 47 | + def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> GroupEpic: | ||
| 48 | + return cast(GroupEpic, super().get(id=id, lazy=lazy, **kwargs)) | ||
| 49 | + | ||
| 45 | 50 | ||
| 46 | 51 | class GroupEpicIssue(ObjectDeleteMixin, SaveMixin, RESTObject): | |
| 47 | 52 | _id_attr = "epic_issue_id" | |
| 53 | + # Define type for 'manager' here So mypy won't complain about | ||
| 54 | + # 'self.manager.update()' call in the 'save' method. | ||
| 55 | + manager: "GroupEpicIssueManager" | ||
| 48 | 56 | ||
| 49 | - def save(self, **kwargs): | ||
| 57 | + def save(self, **kwargs: Any) -> None: | ||
| 50 | 58 | """Save the changes made to the object to the server. | |
| 51 | 59 | ||
| 52 | 60 | The object is updated to match what the server returns. | |
@@ -78,7 +86,9 @@ class GroupEpicIssueManager( | |||
| 78 | 86 | _update_attrs = RequiredOptional(optional=("move_before_id", "move_after_id")) | |
| 79 | 87 | ||
| 80 | 88 | @exc.on_http_error(exc.GitlabCreateError) | |
| 81 | - def create(self, data, **kwargs): | ||
| 89 | + def create( | ||
| 90 | + self, data: Optional[Dict[str, Any]] = None, **kwargs: Any | ||
| 91 | + ) -> GroupEpicIssue: | ||
| 82 | 92 | """Create a new object. | |
| 83 | 93 | ||
| 84 | 94 | Args: | |
@@ -94,9 +104,13 @@ def create(self, data, **kwargs): | |||
| 94 | 104 | RESTObject: A new instance of the manage object class build with | |
| 95 | 105 | the data sent by the server | |
| 96 | 106 | """ | |
| 107 | + if TYPE_CHECKING: | ||
| 108 | + assert data is not None | ||
| 97 | 109 | CreateMixin._check_missing_create_attrs(self, data) | |
| 98 | 110 | path = f"{self.path}/{data.pop('issue_id')}" | |
| 99 | 111 | server_data = self.gitlab.http_post(path, **kwargs) | |
| 112 | + if TYPE_CHECKING: | ||
| 113 | + assert isinstance(server_data, dict) | ||
| 100 | 114 | # The epic_issue_id attribute doesn't exist when creating the resource, | |
| 101 | 115 | # but is used everywhere elese. Let's create it to be consistent client | |
| 102 | 116 | # side | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,6 @@ files = "." | |||
| 12 | 12 | module = [ | |
| 13 | 13 | "docs.*", | |
| 14 | 14 | "docs.ext.*", | |
| 15 | - "gitlab.v4.objects.epics", | ||
| 16 | 15 | "gitlab.v4.objects.files", | |
| 17 | 16 | "gitlab.v4.objects.geo_nodes", | |
| 18 | 17 | "gitlab.v4.objects.issues", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments