| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f3688dc commit 8b75a77
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + from typing import Any, cast, Union | ||
| 2 | + | ||
| 1 | 3 | from gitlab.base import RequiredOptional, RESTManager, RESTObject | |
| 2 | 4 | from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin | |
| 3 | 5 | ||
@@ -21,3 +23,8 @@ class BroadcastMessageManager(CRUDMixin, RESTManager): | |||
| 21 | 23 | _update_attrs = RequiredOptional( | |
| 22 | 24 | optional=("message", "starts_at", "ends_at", "color", "font") | |
| 23 | 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)) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + from typing import Any, cast, Optional, TYPE_CHECKING, Union | ||
| 2 | + | ||
| 1 | 3 | from gitlab.base import RESTManager, RESTObject | |
| 2 | 4 | from gitlab.mixins import GetMixin | |
| 3 | 5 | ||
@@ -15,12 +17,18 @@ class KeyManager(GetMixin, RESTManager): | |||
| 15 | 17 | _path = "/keys" | |
| 16 | 18 | _obj_cls = Key | |
| 17 | 19 | ||
| 18 | - def get(self, id=None, **kwargs): | ||
| 20 | + def get( | ||
| 21 | + self, id: Optional[Union[int, str]] = None, lazy: bool = False, **kwargs: Any | ||
| 22 | + ) -> Key: | ||
| 19 | 23 | if id is not None: | |
| 20 | - return super(KeyManager, self).get(id, **kwargs) | ||
| 24 | + return cast(Key, super(KeyManager, self).get(id, lazy=lazy, **kwargs)) | ||
| 21 | 25 | ||
| 22 | 26 | if "fingerprint" not in kwargs: | |
| 23 | 27 | raise AttributeError("Missing attribute: id or fingerprint") | |
| 24 | 28 | ||
| 29 | + if TYPE_CHECKING: | ||
| 30 | + assert self.path is not None | ||
| 25 | 31 | server_data = self.gitlab.http_get(self.path, **kwargs) | |
| 26 | - return self._obj_cls(self, server_data) | ||
| 32 | + if TYPE_CHECKING: | ||
| 33 | + assert isinstance(server_data, dict) | ||
| 34 | + return cast(Key, self._obj_cls(self, server_data)) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,4 +15,4 @@ class ProjectMergeTrainManager(ListMixin, RESTManager): | |||
| 15 | 15 | _path = "/projects/%(project_id)s/merge_trains" | |
| 16 | 16 | _obj_cls = ProjectMergeTrain | |
| 17 | 17 | _from_parent_attrs = {"project_id": "id"} | |
| 18 | - _list_filters = "scope" | ||
| 18 | + _list_filters = ("scope",) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + from typing import Any, cast, Union | ||
| 2 | + | ||
| 1 | 3 | from gitlab.base import RESTManager, RESTObject | |
| 2 | 4 | from gitlab.mixins import RetrieveMixin | |
| 3 | 5 | ||
@@ -15,3 +17,6 @@ class NamespaceManager(RetrieveMixin, RESTManager): | |||
| 15 | 17 | _path = "/namespaces" | |
| 16 | 18 | _obj_cls = Namespace | |
| 17 | 19 | _list_filters = ("search",) | |
| 20 | + | ||
| 21 | + def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Namespace: | ||
| 22 | + return cast(Namespace, super().get(id=id, lazy=lazy, **kwargs)) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + from typing import Any, cast, Union | ||
| 2 | + | ||
| 1 | 3 | from gitlab.base import RequiredOptional, RESTManager, RESTObject | |
| 2 | 4 | from gitlab.mixins import CRUDMixin, ListMixin, ObjectDeleteMixin, SaveMixin | |
| 3 | 5 | ||
@@ -30,3 +32,8 @@ class ProjectPagesDomainManager(CRUDMixin, RESTManager): | |||
| 30 | 32 | required=("domain",), optional=("certificate", "key") | |
| 31 | 33 | ) | |
| 32 | 34 | _update_attrs = RequiredOptional(optional=("certificate", "key")) | |
| 35 | + | ||
| 36 | + def get( | ||
| 37 | + self, id: Union[str, int], lazy: bool = False, **kwargs: Any | ||
| 38 | + ) -> ProjectPagesDomain: | ||
| 39 | + return cast(ProjectPagesDomain, super().get(id=id, lazy=lazy, **kwargs)) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + from typing import Any, cast, Union | ||
| 2 | + | ||
| 1 | 3 | from gitlab.base import RequiredOptional, RESTManager, RESTObject | |
| 2 | 4 | from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin | |
| 3 | 5 | ||
@@ -17,3 +19,8 @@ class ProjectTriggerManager(CRUDMixin, RESTManager): | |||
| 17 | 19 | _from_parent_attrs = {"project_id": "id"} | |
| 18 | 20 | _create_attrs = RequiredOptional(required=("description",)) | |
| 19 | 21 | _update_attrs = RequiredOptional(required=("description",)) | |
| 22 | + | ||
| 23 | + def get( | ||
| 24 | + self, id: Union[str, int], lazy: bool = False, **kwargs: Any | ||
| 25 | + ) -> ProjectTrigger: | ||
| 26 | + return cast(ProjectTrigger, super().get(id=id, lazy=lazy, **kwargs)) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,9 +23,22 @@ ignore_errors = true | |||
| 23 | 23 | ||
| 24 | 24 | [[tool.mypy.overrides]] # Overrides to negate above patterns | |
| 25 | 25 | module = [ | |
| 26 | + "gitlab.v4.objects.access_requests", | ||
| 27 | + "gitlab.v4.objects.applications", | ||
| 28 | + "gitlab.v4.objects.broadcast_messages", | ||
| 29 | + "gitlab.v4.objects.deployments", | ||
| 26 | 30 | "gitlab.v4.objects.groups", | |
| 31 | + "gitlab.v4.objects.keys", | ||
| 27 | 32 | "gitlab.v4.objects.merge_requests", | |
| 33 | + "gitlab.v4.objects.merge_trains", | ||
| 34 | + "gitlab.v4.objects.namespaces", | ||
| 35 | + "gitlab.v4.objects.pages", | ||
| 36 | + "gitlab.v4.objects.personal_access_tokens", | ||
| 37 | + "gitlab.v4.objects.project_access_tokens", | ||
| 28 | 38 | "gitlab.v4.objects.projects", | |
| 39 | + "gitlab.v4.objects.tags", | ||
| 40 | + "gitlab.v4.objects.templates", | ||
| 41 | + "gitlab.v4.objects.triggers", | ||
| 29 | 42 | "gitlab.v4.objects.users", | |
| 30 | 43 | ] | |
| 31 | 44 | ignore_errors = false | |
| Back | FazBrowse Home | New Git URL |
0 commit comments