summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/variables.py
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2021-11-06 21:33:07 -0700
committerJohn L. Villalovos <john@sodarock.com>2021-11-08 07:21:17 -0800
commit7828ba2fd13c833c118a673bac09b215587ba33b (patch)
tree71312fe159fcc62ace0aeb24be94072ee4cf33cf /gitlab/v4/objects/variables.py
parent9a2f54cf044929dfc3fd89714ce657fa839e35d0 (diff)
downloadgitlab-7828ba2fd13c833c118a673bac09b215587ba33b.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/variables.py')
-rw-r--r--gitlab/v4/objects/variables.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/gitlab/v4/objects/variables.py b/gitlab/v4/objects/variables.py
index 2e5e483..d5f32e3 100644
--- a/gitlab/v4/objects/variables.py
+++ b/gitlab/v4/objects/variables.py
@@ -4,6 +4,8 @@ https://docs.gitlab.com/ee/api/instance_level_ci_variables.html
https://docs.gitlab.com/ee/api/project_level_variables.html
https://docs.gitlab.com/ee/api/group_level_variables.html
"""
+from typing import Any, cast, Union
+
from gitlab.base import RequiredOptional, RESTManager, RESTObject
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
@@ -31,6 +33,9 @@ class VariableManager(CRUDMixin, RESTManager):
required=("key", "value"), optional=("protected", "variable_type", "masked")
)
+ def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Variable:
+ return cast(Variable, super().get(id=id, lazy=lazy, **kwargs))
+
class GroupVariable(SaveMixin, ObjectDeleteMixin, RESTObject):
_id_attr = "key"
@@ -47,6 +52,11 @@ class GroupVariableManager(CRUDMixin, RESTManager):
required=("key", "value"), optional=("protected", "variable_type", "masked")
)
+ def get(
+ self, id: Union[str, int], lazy: bool = False, **kwargs: Any
+ ) -> GroupVariable:
+ return cast(GroupVariable, super().get(id=id, lazy=lazy, **kwargs))
+
class ProjectVariable(SaveMixin, ObjectDeleteMixin, RESTObject):
_id_attr = "key"
@@ -64,3 +74,8 @@ class ProjectVariableManager(CRUDMixin, RESTManager):
required=("key", "value"),
optional=("protected", "variable_type", "masked", "environment_scope"),
)
+
+ def get(
+ self, id: Union[str, int], lazy: bool = False, **kwargs: Any
+ ) -> ProjectVariable:
+ return cast(ProjectVariable, super().get(id=id, lazy=lazy, **kwargs))