diff options
author | John L. Villalovos <john@sodarock.com> | 2021-06-12 15:05:36 -0700 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2021-09-07 08:19:39 -0700 |
commit | c9b5d3bac8f7c1f779dd57653f718dd0fac4db4b (patch) | |
tree | 925700991c94a5a71797d6992b97c5b90ed74089 /gitlab/v4/objects/discussions.py | |
parent | b8a47bae3342400a411fb9bf4bef3c15ba91c98e (diff) | |
download | gitlab-c9b5d3bac8f7c1f779dd57653f718dd0fac4db4b.tar.gz |
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
Diffstat (limited to 'gitlab/v4/objects/discussions.py')
-rw-r--r-- | gitlab/v4/objects/discussions.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gitlab/v4/objects/discussions.py b/gitlab/v4/objects/discussions.py index f91d8fb..19d1a06 100644 --- a/gitlab/v4/objects/discussions.py +++ b/gitlab/v4/objects/discussions.py @@ -21,6 +21,7 @@ __all__ = [ class ProjectCommitDiscussion(RESTObject): + notes: ProjectCommitDiscussionNoteManager _managers = (("notes", "ProjectCommitDiscussionNoteManager"),) @@ -32,6 +33,7 @@ class ProjectCommitDiscussionManager(RetrieveMixin, CreateMixin, RESTManager): class ProjectIssueDiscussion(RESTObject): + notes: ProjectIssueDiscussionNoteManager _managers = (("notes", "ProjectIssueDiscussionNoteManager"),) @@ -43,6 +45,7 @@ class ProjectIssueDiscussionManager(RetrieveMixin, CreateMixin, RESTManager): class ProjectMergeRequestDiscussion(SaveMixin, RESTObject): + notes: ProjectMergeRequestDiscussionNoteManager _managers = (("notes", "ProjectMergeRequestDiscussionNoteManager"),) @@ -59,6 +62,7 @@ class ProjectMergeRequestDiscussionManager( class ProjectSnippetDiscussion(RESTObject): + notes: ProjectSnippetDiscussionNoteManager _managers = (("notes", "ProjectSnippetDiscussionNoteManager"),) |