diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2021-11-16 23:09:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 23:09:08 +0100 |
commit | 0951989cc4eaabc2e2bd82adeb38936d145ddec2 (patch) | |
tree | 32cc9473ec28cc3d10be3baff28a74e8a17ac718 /gitlab/v4/objects/notes.py | |
parent | a553ee76affc6e1030ab0464a8bb998168239f4a (diff) | |
parent | 46773a82565cef231dc3391c12f296ac307cb95c (diff) | |
download | gitlab-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/notes.py')
-rw-r--r-- | gitlab/v4/objects/notes.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gitlab/v4/objects/notes.py b/gitlab/v4/objects/notes.py index 9dd05cc..c4055ad 100644 --- a/gitlab/v4/objects/notes.py +++ b/gitlab/v4/objects/notes.py @@ -1,3 +1,5 @@ +from typing import Any, cast, Union + from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import ( CreateMixin, @@ -46,6 +48,11 @@ class ProjectNoteManager(RetrieveMixin, RESTManager): _from_parent_attrs = {"project_id": "id"} _create_attrs = RequiredOptional(required=("body",)) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> ProjectNote: + return cast(ProjectNote, super().get(id=id, lazy=lazy, **kwargs)) + class ProjectCommitDiscussionNote(SaveMixin, ObjectDeleteMixin, RESTObject): pass @@ -69,6 +76,13 @@ class ProjectCommitDiscussionNoteManager( ) _update_attrs = RequiredOptional(required=("body",)) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> ProjectCommitDiscussionNote: + return cast( + ProjectCommitDiscussionNote, super().get(id=id, lazy=lazy, **kwargs) + ) + class ProjectIssueNote(SaveMixin, ObjectDeleteMixin, RESTObject): awardemojis: ProjectIssueNoteAwardEmojiManager @@ -81,6 +95,11 @@ class ProjectIssueNoteManager(CRUDMixin, RESTManager): _create_attrs = RequiredOptional(required=("body",), optional=("created_at",)) _update_attrs = RequiredOptional(required=("body",)) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> ProjectIssueNote: + return cast(ProjectIssueNote, super().get(id=id, lazy=lazy, **kwargs)) + class ProjectIssueDiscussionNote(SaveMixin, ObjectDeleteMixin, RESTObject): pass @@ -101,6 +120,11 @@ class ProjectIssueDiscussionNoteManager( _create_attrs = RequiredOptional(required=("body",), optional=("created_at",)) _update_attrs = RequiredOptional(required=("body",)) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> ProjectIssueDiscussionNote: + return cast(ProjectIssueDiscussionNote, super().get(id=id, lazy=lazy, **kwargs)) + class ProjectMergeRequestNote(SaveMixin, ObjectDeleteMixin, RESTObject): awardemojis: ProjectMergeRequestNoteAwardEmojiManager @@ -113,6 +137,11 @@ class ProjectMergeRequestNoteManager(CRUDMixin, RESTManager): _create_attrs = RequiredOptional(required=("body",)) _update_attrs = RequiredOptional(required=("body",)) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> ProjectMergeRequestNote: + return cast(ProjectMergeRequestNote, super().get(id=id, lazy=lazy, **kwargs)) + class ProjectMergeRequestDiscussionNote(SaveMixin, ObjectDeleteMixin, RESTObject): pass @@ -134,6 +163,13 @@ class ProjectMergeRequestDiscussionNoteManager( _create_attrs = RequiredOptional(required=("body",), optional=("created_at",)) _update_attrs = RequiredOptional(required=("body",)) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> ProjectMergeRequestDiscussionNote: + return cast( + ProjectMergeRequestDiscussionNote, super().get(id=id, lazy=lazy, **kwargs) + ) + class ProjectSnippetNote(SaveMixin, ObjectDeleteMixin, RESTObject): awardemojis: ProjectMergeRequestNoteAwardEmojiManager @@ -146,6 +182,11 @@ class ProjectSnippetNoteManager(CRUDMixin, RESTManager): _create_attrs = RequiredOptional(required=("body",)) _update_attrs = RequiredOptional(required=("body",)) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> ProjectSnippetNote: + return cast(ProjectSnippetNote, super().get(id=id, lazy=lazy, **kwargs)) + class ProjectSnippetDiscussionNote(SaveMixin, ObjectDeleteMixin, RESTObject): pass @@ -166,3 +207,10 @@ class ProjectSnippetDiscussionNoteManager( } _create_attrs = RequiredOptional(required=("body",), optional=("created_at",)) _update_attrs = RequiredOptional(required=("body",)) + + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> ProjectSnippetDiscussionNote: + return cast( + ProjectSnippetDiscussionNote, super().get(id=id, lazy=lazy, **kwargs) + ) |