summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/statistics.py
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2021-12-01 16:04:16 -0800
committerJohn L. Villalovos <john@sodarock.com>2021-12-08 07:36:35 -0800
commitd27c50ab9d55dd715a7bee5b0c61317f8565c8bf (patch)
tree48173d761de29daf78fb9573ff693a74edf601f1 /gitlab/v4/objects/statistics.py
parent494535337b71592effeca57bb1ff2e735ebeb58a (diff)
downloadgitlab-d27c50ab9d55dd715a7bee5b0c61317f8565c8bf.tar.gz
chore: add get() methods for GetWithoutIdMixin based classesjlvillal/get_without_id
Add the get() methods for the GetWithoutIdMixin based classes. Update the tests/meta/test_ensure_type_hints.py tests to check to ensure that the get methods are defined with the correct return type.
Diffstat (limited to 'gitlab/v4/objects/statistics.py')
-rw-r--r--gitlab/v4/objects/statistics.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/gitlab/v4/objects/statistics.py b/gitlab/v4/objects/statistics.py
index 18b2be8..2941f91 100644
--- a/gitlab/v4/objects/statistics.py
+++ b/gitlab/v4/objects/statistics.py
@@ -1,3 +1,5 @@
+from typing import Any, cast, Optional, Union
+
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import GetWithoutIdMixin, RefreshMixin
@@ -22,6 +24,11 @@ class ProjectAdditionalStatisticsManager(GetWithoutIdMixin, RESTManager):
_obj_cls = ProjectAdditionalStatistics
_from_parent_attrs = {"project_id": "id"}
+ def get(
+ self, id: Optional[Union[int, str]] = None, **kwargs: Any
+ ) -> Optional[ProjectAdditionalStatistics]:
+ return cast(Optional[ProjectAdditionalStatistics], super().get(id=id, **kwargs))
+
class IssuesStatistics(RefreshMixin, RESTObject):
_id_attr = None
@@ -31,6 +38,11 @@ class IssuesStatisticsManager(GetWithoutIdMixin, RESTManager):
_path = "/issues_statistics"
_obj_cls = IssuesStatistics
+ def get(
+ self, id: Optional[Union[int, str]] = None, **kwargs: Any
+ ) -> Optional[IssuesStatistics]:
+ return cast(Optional[IssuesStatistics], super().get(id=id, **kwargs))
+
class GroupIssuesStatistics(RefreshMixin, RESTObject):
_id_attr = None
@@ -41,6 +53,11 @@ class GroupIssuesStatisticsManager(GetWithoutIdMixin, RESTManager):
_obj_cls = GroupIssuesStatistics
_from_parent_attrs = {"group_id": "id"}
+ def get(
+ self, id: Optional[Union[int, str]] = None, **kwargs: Any
+ ) -> Optional[GroupIssuesStatistics]:
+ return cast(Optional[GroupIssuesStatistics], super().get(id=id, **kwargs))
+
class ProjectIssuesStatistics(RefreshMixin, RESTObject):
_id_attr = None
@@ -50,3 +67,8 @@ class ProjectIssuesStatisticsManager(GetWithoutIdMixin, RESTManager):
_path = "/projects/{project_id}/issues_statistics"
_obj_cls = ProjectIssuesStatistics
_from_parent_attrs = {"project_id": "id"}
+
+ def get(
+ self, id: Optional[Union[int, str]] = None, **kwargs: Any
+ ) -> Optional[ProjectIssuesStatistics]:
+ return cast(Optional[ProjectIssuesStatistics], super().get(id=id, **kwargs))