From c9b5d3bac8f7c1f779dd57653f718dd0fac4db4b Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Sat, 12 Jun 2021 15:05:36 -0700 Subject: chore: improve type-hinting for managers The 'managers' are dynamically created. This unfortunately means that we don't have any type-hints for them and so editors which understand type-hints won't know that they are valid attributes. * Add the type-hints for the managers we define. * Add a unit test that makes sure that the type-hints and the '_managers' attribute are kept in sync with each other. * Add unit test that makes sure specified managers in '_managers' have a name ending in 'Managers' to keep with current convention. * Make RESTObject._managers always present with a default value of None. * Fix a type-issue revealed now that mypy knows what the type is --- gitlab/v4/objects/notes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gitlab/v4/objects/notes.py') diff --git a/gitlab/v4/objects/notes.py b/gitlab/v4/objects/notes.py index d85fea7..b8a3215 100644 --- a/gitlab/v4/objects/notes.py +++ b/gitlab/v4/objects/notes.py @@ -71,6 +71,7 @@ class ProjectCommitDiscussionNoteManager( class ProjectIssueNote(SaveMixin, ObjectDeleteMixin, RESTObject): + awardemojis: ProjectIssueNoteAwardEmojiManager _managers = (("awardemojis", "ProjectIssueNoteAwardEmojiManager"),) @@ -104,6 +105,7 @@ class ProjectIssueDiscussionNoteManager( class ProjectMergeRequestNote(SaveMixin, ObjectDeleteMixin, RESTObject): + awardemojis: ProjectMergeRequestNoteAwardEmojiManager _managers = (("awardemojis", "ProjectMergeRequestNoteAwardEmojiManager"),) @@ -137,7 +139,8 @@ class ProjectMergeRequestDiscussionNoteManager( class ProjectSnippetNote(SaveMixin, ObjectDeleteMixin, RESTObject): - _managers = (("awardemojis", "ProjectSnippetNoteAwardEmojiManager"),) + awardemojis: ProjectMergeRequestNoteAwardEmojiManager + _managers = (("awardemojis", "ProjectMergeRequestNoteAwardEmojiManager"),) class ProjectSnippetNoteManager(CRUDMixin, RESTManager): -- cgit v1.2.1