summaryrefslogtreecommitdiff
path: root/gitlab
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2022-05-30 22:58:12 +0200
committerJohn Villalovos <john@sodarock.com>2022-06-25 18:23:48 -0700
commit0f2a602d3a9d6579f5fdfdf945a236ae44e93a12 (patch)
tree57ceaafb384e11231b22890e4fc8a3fd4187c3a6 /gitlab
parent22ae1016f39256b8e2ca02daae8b3c7130aeb8e6 (diff)
downloadgitlab-0f2a602d3a9d6579f5fdfdf945a236ae44e93a12.tar.gz
refactor: remove no-op id argument in GetWithoutIdMixin
Diffstat (limited to 'gitlab')
-rw-r--r--gitlab/mixins.py4
-rw-r--r--gitlab/v4/objects/appearance.py6
-rw-r--r--gitlab/v4/objects/export_import.py18
-rw-r--r--gitlab/v4/objects/merge_request_approvals.py20
-rw-r--r--gitlab/v4/objects/notification_settings.py16
-rw-r--r--gitlab/v4/objects/pipelines.py12
-rw-r--r--gitlab/v4/objects/projects.py6
-rw-r--r--gitlab/v4/objects/push_rules.py8
-rw-r--r--gitlab/v4/objects/settings.py6
-rw-r--r--gitlab/v4/objects/statistics.py26
-rw-r--r--gitlab/v4/objects/users.py16
11 files changed, 51 insertions, 87 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py
index 71ba821..f2df27d 100644
--- a/gitlab/mixins.py
+++ b/gitlab/mixins.py
@@ -152,9 +152,7 @@ class GetWithoutIdMixin(HeadMixin, _RestManagerBase):
gitlab: gitlab.Gitlab
@exc.on_http_error(exc.GitlabGetError)
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> base.RESTObject:
+ def get(self, **kwargs: Any) -> base.RESTObject:
"""Retrieve a single object.
Args:
diff --git a/gitlab/v4/objects/appearance.py b/gitlab/v4/objects/appearance.py
index db4b551..88ab621 100644
--- a/gitlab/v4/objects/appearance.py
+++ b/gitlab/v4/objects/appearance.py
@@ -59,7 +59,5 @@ class ApplicationAppearanceManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
data = new_data.copy()
return super().update(id, data, **kwargs)
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ApplicationAppearance:
- return cast(ApplicationAppearance, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ApplicationAppearance:
+ return cast(ApplicationAppearance, super().get(**kwargs))
diff --git a/gitlab/v4/objects/export_import.py b/gitlab/v4/objects/export_import.py
index a275164..5e07661 100644
--- a/gitlab/v4/objects/export_import.py
+++ b/gitlab/v4/objects/export_import.py
@@ -1,4 +1,4 @@
-from typing import Any, cast, Optional, Union
+from typing import Any, cast
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CreateMixin, DownloadMixin, GetWithoutIdMixin, RefreshMixin
@@ -25,8 +25,8 @@ class GroupExportManager(GetWithoutIdMixin, CreateMixin, RESTManager):
_obj_cls = GroupExport
_from_parent_attrs = {"group_id": "id"}
- def get(self, id: Optional[Union[int, str]] = None, **kwargs: Any) -> GroupExport:
- return cast(GroupExport, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> GroupExport:
+ return cast(GroupExport, super().get(**kwargs))
class GroupImport(RESTObject):
@@ -38,8 +38,8 @@ class GroupImportManager(GetWithoutIdMixin, RESTManager):
_obj_cls = GroupImport
_from_parent_attrs = {"group_id": "id"}
- def get(self, id: Optional[Union[int, str]] = None, **kwargs: Any) -> GroupImport:
- return cast(GroupImport, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> GroupImport:
+ return cast(GroupImport, super().get(**kwargs))
class ProjectExport(DownloadMixin, RefreshMixin, RESTObject):
@@ -52,8 +52,8 @@ class ProjectExportManager(GetWithoutIdMixin, CreateMixin, RESTManager):
_from_parent_attrs = {"project_id": "id"}
_create_attrs = RequiredOptional(optional=("description",))
- def get(self, id: Optional[Union[int, str]] = None, **kwargs: Any) -> ProjectExport:
- return cast(ProjectExport, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ProjectExport:
+ return cast(ProjectExport, super().get(**kwargs))
class ProjectImport(RefreshMixin, RESTObject):
@@ -65,5 +65,5 @@ class ProjectImportManager(GetWithoutIdMixin, RESTManager):
_obj_cls = ProjectImport
_from_parent_attrs = {"project_id": "id"}
- def get(self, id: Optional[Union[int, str]] = None, **kwargs: Any) -> ProjectImport:
- return cast(ProjectImport, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ProjectImport:
+ return cast(ProjectImport, super().get(**kwargs))
diff --git a/gitlab/v4/objects/merge_request_approvals.py b/gitlab/v4/objects/merge_request_approvals.py
index eb243c7..8df6cd7 100644
--- a/gitlab/v4/objects/merge_request_approvals.py
+++ b/gitlab/v4/objects/merge_request_approvals.py
@@ -1,4 +1,4 @@
-from typing import Any, cast, Dict, List, Optional, TYPE_CHECKING, Union
+from typing import Any, cast, Dict, List, Optional, TYPE_CHECKING
from gitlab import exceptions as exc
from gitlab.base import RESTManager, RESTObject
@@ -46,10 +46,8 @@ class ProjectApprovalManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
)
_update_uses_post = True
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ProjectApproval:
- return cast(ProjectApproval, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ProjectApproval:
+ return cast(ProjectApproval, super().get(**kwargs))
@exc.on_http_error(exc.GitlabUpdateError)
def set_approvers(
@@ -111,10 +109,8 @@ class ProjectMergeRequestApprovalManager(GetWithoutIdMixin, UpdateMixin, RESTMan
_update_attrs = RequiredOptional(required=("approvals_required",))
_update_uses_post = True
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ProjectMergeRequestApproval:
- return cast(ProjectMergeRequestApproval, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ProjectMergeRequestApproval:
+ return cast(ProjectMergeRequestApproval, super().get(**kwargs))
@exc.on_http_error(exc.GitlabUpdateError)
def set_approvers(
@@ -254,7 +250,5 @@ class ProjectMergeRequestApprovalStateManager(GetWithoutIdMixin, RESTManager):
_obj_cls = ProjectMergeRequestApprovalState
_from_parent_attrs = {"project_id": "project_id", "mr_iid": "iid"}
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ProjectMergeRequestApprovalState:
- return cast(ProjectMergeRequestApprovalState, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ProjectMergeRequestApprovalState:
+ return cast(ProjectMergeRequestApprovalState, super().get(**kwargs))
diff --git a/gitlab/v4/objects/notification_settings.py b/gitlab/v4/objects/notification_settings.py
index d3cd4cb..4b38549 100644
--- a/gitlab/v4/objects/notification_settings.py
+++ b/gitlab/v4/objects/notification_settings.py
@@ -1,4 +1,4 @@
-from typing import Any, cast, Optional, Union
+from typing import Any, cast
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin
@@ -39,10 +39,8 @@ class NotificationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
),
)
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> NotificationSettings:
- return cast(NotificationSettings, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> NotificationSettings:
+ return cast(NotificationSettings, super().get(**kwargs))
class GroupNotificationSettings(NotificationSettings):
@@ -54,9 +52,7 @@ class GroupNotificationSettingsManager(NotificationSettingsManager):
_obj_cls = GroupNotificationSettings
_from_parent_attrs = {"group_id": "id"}
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> GroupNotificationSettings:
+ def get(self, **kwargs: Any) -> GroupNotificationSettings:
return cast(GroupNotificationSettings, super().get(id=id, **kwargs))
@@ -69,7 +65,5 @@ class ProjectNotificationSettingsManager(NotificationSettingsManager):
_obj_cls = ProjectNotificationSettings
_from_parent_attrs = {"project_id": "id"}
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ProjectNotificationSettings:
+ def get(self, **kwargs: Any) -> ProjectNotificationSettings:
return cast(ProjectNotificationSettings, super().get(id=id, **kwargs))
diff --git a/gitlab/v4/objects/pipelines.py b/gitlab/v4/objects/pipelines.py
index 0db82a3..80a45fe 100644
--- a/gitlab/v4/objects/pipelines.py
+++ b/gitlab/v4/objects/pipelines.py
@@ -251,10 +251,8 @@ class ProjectPipelineTestReportManager(GetWithoutIdMixin, RESTManager):
_obj_cls = ProjectPipelineTestReport
_from_parent_attrs = {"project_id": "project_id", "pipeline_id": "id"}
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ProjectPipelineTestReport:
- return cast(ProjectPipelineTestReport, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ProjectPipelineTestReport:
+ return cast(ProjectPipelineTestReport, super().get(**kwargs))
class ProjectPipelineTestReportSummary(RESTObject):
@@ -266,7 +264,5 @@ class ProjectPipelineTestReportSummaryManager(GetWithoutIdMixin, RESTManager):
_obj_cls = ProjectPipelineTestReportSummary
_from_parent_attrs = {"project_id": "project_id", "pipeline_id": "id"}
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ProjectPipelineTestReportSummary:
- return cast(ProjectPipelineTestReportSummary, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ProjectPipelineTestReportSummary:
+ return cast(ProjectPipelineTestReportSummary, super().get(**kwargs))
diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py
index f32cf22..4893788 100644
--- a/gitlab/v4/objects/projects.py
+++ b/gitlab/v4/objects/projects.py
@@ -1033,7 +1033,5 @@ class ProjectStorageManager(GetWithoutIdMixin, RESTManager):
_obj_cls = ProjectStorage
_from_parent_attrs = {"project_id": "id"}
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ProjectStorage:
- return cast(ProjectStorage, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ProjectStorage:
+ return cast(ProjectStorage, super().get(**kwargs))
diff --git a/gitlab/v4/objects/push_rules.py b/gitlab/v4/objects/push_rules.py
index ce75eac..d1fe81c 100644
--- a/gitlab/v4/objects/push_rules.py
+++ b/gitlab/v4/objects/push_rules.py
@@ -1,4 +1,4 @@
-from typing import Any, cast, Optional, Union
+from typing import Any, cast
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import (
@@ -52,7 +52,5 @@ class ProjectPushRulesManager(
),
)
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ProjectPushRules:
- return cast(ProjectPushRules, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ProjectPushRules:
+ return cast(ProjectPushRules, super().get(**kwargs))
diff --git a/gitlab/v4/objects/settings.py b/gitlab/v4/objects/settings.py
index 6171833..16b1041 100644
--- a/gitlab/v4/objects/settings.py
+++ b/gitlab/v4/objects/settings.py
@@ -116,7 +116,5 @@ class ApplicationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
data.pop("domain_whitelist")
return super().update(id, data, **kwargs)
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ApplicationSettings:
- return cast(ApplicationSettings, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ApplicationSettings:
+ return cast(ApplicationSettings, super().get(**kwargs))
diff --git a/gitlab/v4/objects/statistics.py b/gitlab/v4/objects/statistics.py
index 24c17a5..3176674 100644
--- a/gitlab/v4/objects/statistics.py
+++ b/gitlab/v4/objects/statistics.py
@@ -1,4 +1,4 @@
-from typing import Any, cast, Optional, Union
+from typing import Any, cast
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import GetWithoutIdMixin, RefreshMixin
@@ -24,10 +24,8 @@ class ProjectAdditionalStatisticsManager(GetWithoutIdMixin, RESTManager):
_obj_cls = ProjectAdditionalStatistics
_from_parent_attrs = {"project_id": "id"}
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ProjectAdditionalStatistics:
- return cast(ProjectAdditionalStatistics, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ProjectAdditionalStatistics:
+ return cast(ProjectAdditionalStatistics, super().get(**kwargs))
class IssuesStatistics(RefreshMixin, RESTObject):
@@ -38,10 +36,8 @@ class IssuesStatisticsManager(GetWithoutIdMixin, RESTManager):
_path = "/issues_statistics"
_obj_cls = IssuesStatistics
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> IssuesStatistics:
- return cast(IssuesStatistics, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> IssuesStatistics:
+ return cast(IssuesStatistics, super().get(**kwargs))
class GroupIssuesStatistics(RefreshMixin, RESTObject):
@@ -53,10 +49,8 @@ class GroupIssuesStatisticsManager(GetWithoutIdMixin, RESTManager):
_obj_cls = GroupIssuesStatistics
_from_parent_attrs = {"group_id": "id"}
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> GroupIssuesStatistics:
- return cast(GroupIssuesStatistics, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> GroupIssuesStatistics:
+ return cast(GroupIssuesStatistics, super().get(**kwargs))
class ProjectIssuesStatistics(RefreshMixin, RESTObject):
@@ -68,7 +62,5 @@ class ProjectIssuesStatisticsManager(GetWithoutIdMixin, RESTManager):
_obj_cls = ProjectIssuesStatistics
_from_parent_attrs = {"project_id": "id"}
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> ProjectIssuesStatistics:
- return cast(ProjectIssuesStatistics, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> ProjectIssuesStatistics:
+ return cast(ProjectIssuesStatistics, super().get(**kwargs))
diff --git a/gitlab/v4/objects/users.py b/gitlab/v4/objects/users.py
index bef9fbe..69d72e9 100644
--- a/gitlab/v4/objects/users.py
+++ b/gitlab/v4/objects/users.py
@@ -3,7 +3,7 @@ GitLab API:
https://docs.gitlab.com/ee/api/users.html
https://docs.gitlab.com/ee/api/projects.html#list-projects-starred-by-a-user
"""
-from typing import Any, cast, Dict, List, Optional, Union
+from typing import Any, cast, Dict, List, Union
import requests
@@ -121,10 +121,8 @@ class CurrentUserStatusManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
_obj_cls = CurrentUserStatus
_update_attrs = RequiredOptional(optional=("emoji", "message"))
- def get(
- self, id: Optional[Union[int, str]] = None, **kwargs: Any
- ) -> CurrentUserStatus:
- return cast(CurrentUserStatus, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> CurrentUserStatus:
+ return cast(CurrentUserStatus, super().get(**kwargs))
class CurrentUser(RESTObject):
@@ -141,8 +139,8 @@ class CurrentUserManager(GetWithoutIdMixin, RESTManager):
_path = "/user"
_obj_cls = CurrentUser
- def get(self, id: Optional[Union[int, str]] = None, **kwargs: Any) -> CurrentUser:
- return cast(CurrentUser, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> CurrentUser:
+ return cast(CurrentUser, super().get(**kwargs))
class User(SaveMixin, ObjectDeleteMixin, RESTObject):
@@ -477,8 +475,8 @@ class UserStatusManager(GetWithoutIdMixin, RESTManager):
_obj_cls = UserStatus
_from_parent_attrs = {"user_id": "id"}
- def get(self, id: Optional[Union[int, str]] = None, **kwargs: Any) -> UserStatus:
- return cast(UserStatus, super().get(id=id, **kwargs))
+ def get(self, **kwargs: Any) -> UserStatus:
+ return cast(UserStatus, super().get(**kwargs))
class UserActivitiesManager(ListMixin, RESTManager):