diff options
author | John L. Villalovos <john@sodarock.com> | 2021-11-06 21:33:07 -0700 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2021-11-08 07:21:17 -0800 |
commit | 7828ba2fd13c833c118a673bac09b215587ba33b (patch) | |
tree | 71312fe159fcc62ace0aeb24be94072ee4cf33cf /gitlab/v4/objects/features.py | |
parent | 9a2f54cf044929dfc3fd89714ce657fa839e35d0 (diff) | |
download | gitlab-jlvillal/mypy_small_files_1.tar.gz |
chore: enforce type-hints on most files in gitlab/v4/objects/jlvillal/mypy_small_files_1
* Add type-hints to some of the files in gitlab/v4/objects/
* Fix issues detected when adding type-hints
* Changed mypy exclusion to explicitly list the 13 files that have
not yet had type-hints added.
Diffstat (limited to 'gitlab/v4/objects/features.py')
-rw-r--r-- | gitlab/v4/objects/features.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/gitlab/v4/objects/features.py b/gitlab/v4/objects/features.py index 65144a7..4aaa185 100644 --- a/gitlab/v4/objects/features.py +++ b/gitlab/v4/objects/features.py @@ -1,3 +1,9 @@ +""" +GitLab API: +https://docs.gitlab.com/ee/api/features.html +""" +from typing import Any, Optional, TYPE_CHECKING, Union + from gitlab import exceptions as exc from gitlab import utils from gitlab.base import RESTManager, RESTObject @@ -20,14 +26,14 @@ class FeatureManager(ListMixin, DeleteMixin, RESTManager): @exc.on_http_error(exc.GitlabSetError) def set( self, - name, - value, - feature_group=None, - user=None, - group=None, - project=None, - **kwargs, - ): + name: str, + value: Union[bool, int], + feature_group: Optional[str] = None, + user: Optional[str] = None, + group: Optional[str] = None, + project: Optional[str] = None, + **kwargs: Any, + ) -> Feature: """Create or update the object. Args: @@ -56,4 +62,6 @@ class FeatureManager(ListMixin, DeleteMixin, RESTManager): } data = utils.remove_none_from_dict(data) server_data = self.gitlab.http_post(path, post_data=data, **kwargs) + if TYPE_CHECKING: + assert isinstance(server_data, dict) return self._obj_cls(self, server_data) |