We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f3688dc + 8b75a77 commit cf801d8Copy full SHA for cf801d8
gitlab/v4/objects/broadcast_messages.py
@@ -1,3 +1,5 @@
1
+from typing import Any, cast, Union
2
+
3
from gitlab.base import RequiredOptional, RESTManager, RESTObject
4
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
5
@@ -21,3 +23,8 @@ class BroadcastMessageManager(CRUDMixin, RESTManager):
21
23
_update_attrs = RequiredOptional(
22
24
optional=("message", "starts_at", "ends_at", "color", "font")
25
)
26
27
+ def get(
28
+ self, id: Union[str, int], lazy: bool = False, **kwargs: Any
29
+ ) -> BroadcastMessage:
30
+ return cast(BroadcastMessage, super().get(id=id, lazy=lazy, **kwargs))
gitlab/v4/objects/keys.py
+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):
15
17
_path = "/keys"
16
18
_obj_cls = Key
19
- def get(self, id=None, **kwargs):
20
+ 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
31
server_data = self.gitlab.http_get(self.path, **kwargs)
- return self._obj_cls(self, server_data)
32
33
+ assert isinstance(server_data, dict)
34
+ return cast(Key, self._obj_cls(self, server_data))
gitlab/v4/objects/merge_trains.py
@@ -15,4 +15,4 @@ class ProjectMergeTrainManager(ListMixin, RESTManager):
_path = "/projects/%(project_id)s/merge_trains"
_obj_cls = ProjectMergeTrain
_from_parent_attrs = {"project_id": "id"}
- _list_filters = "scope"
+ _list_filters = ("scope",)
gitlab/v4/objects/namespaces.py
from gitlab.mixins import RetrieveMixin
@@ -15,3 +17,6 @@ class NamespaceManager(RetrieveMixin, RESTManager):
_path = "/namespaces"
_obj_cls = Namespace
_list_filters = ("search",)
+ def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Namespace:
+ return cast(Namespace, super().get(id=id, lazy=lazy, **kwargs))
gitlab/v4/objects/pages.py
from gitlab.mixins import CRUDMixin, ListMixin, ObjectDeleteMixin, SaveMixin
@@ -30,3 +32,8 @@ class ProjectPagesDomainManager(CRUDMixin, RESTManager):
required=("domain",), optional=("certificate", "key")
_update_attrs = RequiredOptional(optional=("certificate", "key"))
35
36
37
38
+ ) -> ProjectPagesDomain:
39
+ return cast(ProjectPagesDomain, super().get(id=id, lazy=lazy, **kwargs))
gitlab/v4/objects/triggers.py
@@ -17,3 +19,8 @@ class ProjectTriggerManager(CRUDMixin, RESTManager):
_create_attrs = RequiredOptional(required=("description",))
_update_attrs = RequiredOptional(required=("description",))
+ ) -> ProjectTrigger:
+ return cast(ProjectTrigger, super().get(id=id, lazy=lazy, **kwargs))
pyproject.toml
@@ -23,9 +23,22 @@ ignore_errors = true
[[tool.mypy.overrides]] # Overrides to negate above patterns
module = [
+ "gitlab.v4.objects.access_requests",
+ "gitlab.v4.objects.applications",
+ "gitlab.v4.objects.broadcast_messages",
+ "gitlab.v4.objects.deployments",
"gitlab.v4.objects.groups",
+ "gitlab.v4.objects.keys",
"gitlab.v4.objects.merge_requests",
+ "gitlab.v4.objects.merge_trains",
+ "gitlab.v4.objects.namespaces",
+ "gitlab.v4.objects.pages",
+ "gitlab.v4.objects.personal_access_tokens",
+ "gitlab.v4.objects.project_access_tokens",
"gitlab.v4.objects.projects",
+ "gitlab.v4.objects.tags",
40
+ "gitlab.v4.objects.templates",
41
+ "gitlab.v4.objects.triggers",
42
"gitlab.v4.objects.users",
43
]
44
ignore_errors = false
0 commit comments