summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/discussions.py
diff options
context:
space:
mode:
authorNejc Habjan <hab.nejc@gmail.com>2021-11-16 23:09:08 +0100
committerGitHub <noreply@github.com>2021-11-16 23:09:08 +0100
commit0951989cc4eaabc2e2bd82adeb38936d145ddec2 (patch)
tree32cc9473ec28cc3d10be3baff28a74e8a17ac718 /gitlab/v4/objects/discussions.py
parenta553ee76affc6e1030ab0464a8bb998168239f4a (diff)
parent46773a82565cef231dc3391c12f296ac307cb95c (diff)
downloadgitlab-0951989cc4eaabc2e2bd82adeb38936d145ddec2.tar.gz
Merge pull request #1681 from python-gitlab/jlvillal/mypy_ensure_type_hints
Ensure get() methods have correct type-hints
Diffstat (limited to 'gitlab/v4/objects/discussions.py')
-rw-r--r--gitlab/v4/objects/discussions.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/gitlab/v4/objects/discussions.py b/gitlab/v4/objects/discussions.py
index 94f0a39..fa874c4 100644
--- a/gitlab/v4/objects/discussions.py
+++ b/gitlab/v4/objects/discussions.py
@@ -1,3 +1,5 @@
+from typing import Any, cast, Union
+
from gitlab.base import RequiredOptional, RESTManager, RESTObject
from gitlab.mixins import CreateMixin, RetrieveMixin, SaveMixin, UpdateMixin
@@ -30,6 +32,11 @@ class ProjectCommitDiscussionManager(RetrieveMixin, CreateMixin, RESTManager):
_from_parent_attrs = {"project_id": "project_id", "commit_id": "id"}
_create_attrs = RequiredOptional(required=("body",), optional=("created_at",))
+ def get(
+ self, id: Union[str, int], lazy: bool = False, **kwargs: Any
+ ) -> ProjectCommitDiscussion:
+ return cast(ProjectCommitDiscussion, super().get(id=id, lazy=lazy, **kwargs))
+
class ProjectIssueDiscussion(RESTObject):
notes: ProjectIssueDiscussionNoteManager
@@ -41,6 +48,11 @@ class ProjectIssueDiscussionManager(RetrieveMixin, CreateMixin, RESTManager):
_from_parent_attrs = {"project_id": "project_id", "issue_iid": "iid"}
_create_attrs = RequiredOptional(required=("body",), optional=("created_at",))
+ def get(
+ self, id: Union[str, int], lazy: bool = False, **kwargs: Any
+ ) -> ProjectIssueDiscussion:
+ return cast(ProjectIssueDiscussion, super().get(id=id, lazy=lazy, **kwargs))
+
class ProjectMergeRequestDiscussion(SaveMixin, RESTObject):
notes: ProjectMergeRequestDiscussionNoteManager
@@ -57,6 +69,13 @@ class ProjectMergeRequestDiscussionManager(
)
_update_attrs = RequiredOptional(required=("resolved",))
+ def get(
+ self, id: Union[str, int], lazy: bool = False, **kwargs: Any
+ ) -> ProjectMergeRequestDiscussion:
+ return cast(
+ ProjectMergeRequestDiscussion, super().get(id=id, lazy=lazy, **kwargs)
+ )
+
class ProjectSnippetDiscussion(RESTObject):
notes: ProjectSnippetDiscussionNoteManager
@@ -67,3 +86,8 @@ class ProjectSnippetDiscussionManager(RetrieveMixin, CreateMixin, RESTManager):
_obj_cls = ProjectSnippetDiscussion
_from_parent_attrs = {"project_id": "project_id", "snippet_id": "id"}
_create_attrs = RequiredOptional(required=("body",), optional=("created_at",))
+
+ def get(
+ self, id: Union[str, int], lazy: bool = False, **kwargs: Any
+ ) -> ProjectSnippetDiscussion:
+ return cast(ProjectSnippetDiscussion, super().get(id=id, lazy=lazy, **kwargs))