summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/keys.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/v4/objects/keys.py')
-rw-r--r--gitlab/v4/objects/keys.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/gitlab/v4/objects/keys.py b/gitlab/v4/objects/keys.py
index 7f8fa0e..46f6894 100644
--- a/gitlab/v4/objects/keys.py
+++ b/gitlab/v4/objects/keys.py
@@ -1,3 +1,5 @@
+from typing import Any, cast, Optional, TYPE_CHECKING, Union
+
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import GetMixin
@@ -15,12 +17,18 @@ class KeyManager(GetMixin, RESTManager):
_path = "/keys"
_obj_cls = Key
- def get(self, id=None, **kwargs):
+ def get(
+ self, id: Optional[Union[int, str]] = None, lazy: bool = False, **kwargs: Any
+ ) -> Key:
if id is not None:
- return super(KeyManager, self).get(id, **kwargs)
+ return cast(Key, super(KeyManager, self).get(id, lazy=lazy, **kwargs))
if "fingerprint" not in kwargs:
raise AttributeError("Missing attribute: id or fingerprint")
+ if TYPE_CHECKING:
+ assert self.path is not None
server_data = self.gitlab.http_get(self.path, **kwargs)
- return self._obj_cls(self, server_data)
+ if TYPE_CHECKING:
+ assert isinstance(server_data, dict)
+ return cast(Key, self._obj_cls(self, server_data))