Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0f2a602

Browse files
nejchJohnVillalovos
authored andcommitted
refactor: remove no-op id argument in GetWithoutIdMixin
1 parent22ae101 commit0f2a602

12 files changed

+54
-92
lines changed

‎gitlab/mixins.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ class GetWithoutIdMixin(HeadMixin, _RestManagerBase):
152152
gitlab:gitlab.Gitlab
153153

154154
@exc.on_http_error(exc.GitlabGetError)
155-
defget(
156-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
157-
)->base.RESTObject:
155+
defget(self,**kwargs:Any)->base.RESTObject:
158156
"""Retrieve a single object.
159157
160158
Args:

‎gitlab/v4/objects/appearance.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,5 @@ def update(
5959
data=new_data.copy()
6060
returnsuper().update(id,data,**kwargs)
6161

62-
defget(
63-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
64-
)->ApplicationAppearance:
65-
returncast(ApplicationAppearance,super().get(id=id,**kwargs))
62+
defget(self,**kwargs:Any)->ApplicationAppearance:
63+
returncast(ApplicationAppearance,super().get(**kwargs))

‎gitlab/v4/objects/export_import.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fromtypingimportAny,cast,Optional,Union
1+
fromtypingimportAny,cast
22

33
fromgitlab.baseimportRESTManager,RESTObject
44
fromgitlab.mixinsimportCreateMixin,DownloadMixin,GetWithoutIdMixin,RefreshMixin
@@ -25,8 +25,8 @@ class GroupExportManager(GetWithoutIdMixin, CreateMixin, RESTManager):
2525
_obj_cls=GroupExport
2626
_from_parent_attrs= {"group_id":"id"}
2727

28-
defget(self,id:Optional[Union[int,str]]=None,**kwargs:Any)->GroupExport:
29-
returncast(GroupExport,super().get(id=id,**kwargs))
28+
defget(self,**kwargs:Any)->GroupExport:
29+
returncast(GroupExport,super().get(**kwargs))
3030

3131

3232
classGroupImport(RESTObject):
@@ -38,8 +38,8 @@ class GroupImportManager(GetWithoutIdMixin, RESTManager):
3838
_obj_cls=GroupImport
3939
_from_parent_attrs= {"group_id":"id"}
4040

41-
defget(self,id:Optional[Union[int,str]]=None,**kwargs:Any)->GroupImport:
42-
returncast(GroupImport,super().get(id=id,**kwargs))
41+
defget(self,**kwargs:Any)->GroupImport:
42+
returncast(GroupImport,super().get(**kwargs))
4343

4444

4545
classProjectExport(DownloadMixin,RefreshMixin,RESTObject):
@@ -52,8 +52,8 @@ class ProjectExportManager(GetWithoutIdMixin, CreateMixin, RESTManager):
5252
_from_parent_attrs= {"project_id":"id"}
5353
_create_attrs=RequiredOptional(optional=("description",))
5454

55-
defget(self,id:Optional[Union[int,str]]=None,**kwargs:Any)->ProjectExport:
56-
returncast(ProjectExport,super().get(id=id,**kwargs))
55+
defget(self,**kwargs:Any)->ProjectExport:
56+
returncast(ProjectExport,super().get(**kwargs))
5757

5858

5959
classProjectImport(RefreshMixin,RESTObject):
@@ -65,5 +65,5 @@ class ProjectImportManager(GetWithoutIdMixin, RESTManager):
6565
_obj_cls=ProjectImport
6666
_from_parent_attrs= {"project_id":"id"}
6767

68-
defget(self,id:Optional[Union[int,str]]=None,**kwargs:Any)->ProjectImport:
69-
returncast(ProjectImport,super().get(id=id,**kwargs))
68+
defget(self,**kwargs:Any)->ProjectImport:
69+
returncast(ProjectImport,super().get(**kwargs))

‎gitlab/v4/objects/merge_request_approvals.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fromtypingimportAny,cast,Dict,List,Optional,TYPE_CHECKING,Union
1+
fromtypingimportAny,cast,Dict,List,Optional,TYPE_CHECKING
22

33
fromgitlabimportexceptionsasexc
44
fromgitlab.baseimportRESTManager,RESTObject
@@ -46,10 +46,8 @@ class ProjectApprovalManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
4646
)
4747
_update_uses_post=True
4848

49-
defget(
50-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
51-
)->ProjectApproval:
52-
returncast(ProjectApproval,super().get(id=id,**kwargs))
49+
defget(self,**kwargs:Any)->ProjectApproval:
50+
returncast(ProjectApproval,super().get(**kwargs))
5351

5452
@exc.on_http_error(exc.GitlabUpdateError)
5553
defset_approvers(
@@ -111,10 +109,8 @@ class ProjectMergeRequestApprovalManager(GetWithoutIdMixin, UpdateMixin, RESTMan
111109
_update_attrs=RequiredOptional(required=("approvals_required",))
112110
_update_uses_post=True
113111

114-
defget(
115-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
116-
)->ProjectMergeRequestApproval:
117-
returncast(ProjectMergeRequestApproval,super().get(id=id,**kwargs))
112+
defget(self,**kwargs:Any)->ProjectMergeRequestApproval:
113+
returncast(ProjectMergeRequestApproval,super().get(**kwargs))
118114

119115
@exc.on_http_error(exc.GitlabUpdateError)
120116
defset_approvers(
@@ -254,7 +250,5 @@ class ProjectMergeRequestApprovalStateManager(GetWithoutIdMixin, RESTManager):
254250
_obj_cls=ProjectMergeRequestApprovalState
255251
_from_parent_attrs= {"project_id":"project_id","mr_iid":"iid"}
256252

257-
defget(
258-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
259-
)->ProjectMergeRequestApprovalState:
260-
returncast(ProjectMergeRequestApprovalState,super().get(id=id,**kwargs))
253+
defget(self,**kwargs:Any)->ProjectMergeRequestApprovalState:
254+
returncast(ProjectMergeRequestApprovalState,super().get(**kwargs))

‎gitlab/v4/objects/notification_settings.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fromtypingimportAny,cast,Optional,Union
1+
fromtypingimportAny,cast
22

33
fromgitlab.baseimportRESTManager,RESTObject
44
fromgitlab.mixinsimportGetWithoutIdMixin,SaveMixin,UpdateMixin
@@ -39,10 +39,8 @@ class NotificationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
3939
),
4040
)
4141

42-
defget(
43-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
44-
)->NotificationSettings:
45-
returncast(NotificationSettings,super().get(id=id,**kwargs))
42+
defget(self,**kwargs:Any)->NotificationSettings:
43+
returncast(NotificationSettings,super().get(**kwargs))
4644

4745

4846
classGroupNotificationSettings(NotificationSettings):
@@ -54,9 +52,7 @@ class GroupNotificationSettingsManager(NotificationSettingsManager):
5452
_obj_cls=GroupNotificationSettings
5553
_from_parent_attrs= {"group_id":"id"}
5654

57-
defget(
58-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
59-
)->GroupNotificationSettings:
55+
defget(self,**kwargs:Any)->GroupNotificationSettings:
6056
returncast(GroupNotificationSettings,super().get(id=id,**kwargs))
6157

6258

@@ -69,7 +65,5 @@ class ProjectNotificationSettingsManager(NotificationSettingsManager):
6965
_obj_cls=ProjectNotificationSettings
7066
_from_parent_attrs= {"project_id":"id"}
7167

72-
defget(
73-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
74-
)->ProjectNotificationSettings:
68+
defget(self,**kwargs:Any)->ProjectNotificationSettings:
7569
returncast(ProjectNotificationSettings,super().get(id=id,**kwargs))

‎gitlab/v4/objects/pipelines.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,8 @@ class ProjectPipelineTestReportManager(GetWithoutIdMixin, RESTManager):
251251
_obj_cls=ProjectPipelineTestReport
252252
_from_parent_attrs= {"project_id":"project_id","pipeline_id":"id"}
253253

254-
defget(
255-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
256-
)->ProjectPipelineTestReport:
257-
returncast(ProjectPipelineTestReport,super().get(id=id,**kwargs))
254+
defget(self,**kwargs:Any)->ProjectPipelineTestReport:
255+
returncast(ProjectPipelineTestReport,super().get(**kwargs))
258256

259257

260258
classProjectPipelineTestReportSummary(RESTObject):
@@ -266,7 +264,5 @@ class ProjectPipelineTestReportSummaryManager(GetWithoutIdMixin, RESTManager):
266264
_obj_cls=ProjectPipelineTestReportSummary
267265
_from_parent_attrs= {"project_id":"project_id","pipeline_id":"id"}
268266

269-
defget(
270-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
271-
)->ProjectPipelineTestReportSummary:
272-
returncast(ProjectPipelineTestReportSummary,super().get(id=id,**kwargs))
267+
defget(self,**kwargs:Any)->ProjectPipelineTestReportSummary:
268+
returncast(ProjectPipelineTestReportSummary,super().get(**kwargs))

‎gitlab/v4/objects/projects.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,5 @@ class ProjectStorageManager(GetWithoutIdMixin, RESTManager):
10331033
_obj_cls=ProjectStorage
10341034
_from_parent_attrs= {"project_id":"id"}
10351035

1036-
defget(
1037-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
1038-
)->ProjectStorage:
1039-
returncast(ProjectStorage,super().get(id=id,**kwargs))
1036+
defget(self,**kwargs:Any)->ProjectStorage:
1037+
returncast(ProjectStorage,super().get(**kwargs))

‎gitlab/v4/objects/push_rules.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fromtypingimportAny,cast,Optional,Union
1+
fromtypingimportAny,cast
22

33
fromgitlab.baseimportRESTManager,RESTObject
44
fromgitlab.mixinsimport (
@@ -52,7 +52,5 @@ class ProjectPushRulesManager(
5252
),
5353
)
5454

55-
defget(
56-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
57-
)->ProjectPushRules:
58-
returncast(ProjectPushRules,super().get(id=id,**kwargs))
55+
defget(self,**kwargs:Any)->ProjectPushRules:
56+
returncast(ProjectPushRules,super().get(**kwargs))

‎gitlab/v4/objects/settings.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,5 @@ def update(
116116
data.pop("domain_whitelist")
117117
returnsuper().update(id,data,**kwargs)
118118

119-
defget(
120-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
121-
)->ApplicationSettings:
122-
returncast(ApplicationSettings,super().get(id=id,**kwargs))
119+
defget(self,**kwargs:Any)->ApplicationSettings:
120+
returncast(ApplicationSettings,super().get(**kwargs))

‎gitlab/v4/objects/statistics.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fromtypingimportAny,cast,Optional,Union
1+
fromtypingimportAny,cast
22

33
fromgitlab.baseimportRESTManager,RESTObject
44
fromgitlab.mixinsimportGetWithoutIdMixin,RefreshMixin
@@ -24,10 +24,8 @@ class ProjectAdditionalStatisticsManager(GetWithoutIdMixin, RESTManager):
2424
_obj_cls=ProjectAdditionalStatistics
2525
_from_parent_attrs= {"project_id":"id"}
2626

27-
defget(
28-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
29-
)->ProjectAdditionalStatistics:
30-
returncast(ProjectAdditionalStatistics,super().get(id=id,**kwargs))
27+
defget(self,**kwargs:Any)->ProjectAdditionalStatistics:
28+
returncast(ProjectAdditionalStatistics,super().get(**kwargs))
3129

3230

3331
classIssuesStatistics(RefreshMixin,RESTObject):
@@ -38,10 +36,8 @@ class IssuesStatisticsManager(GetWithoutIdMixin, RESTManager):
3836
_path="/issues_statistics"
3937
_obj_cls=IssuesStatistics
4038

41-
defget(
42-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
43-
)->IssuesStatistics:
44-
returncast(IssuesStatistics,super().get(id=id,**kwargs))
39+
defget(self,**kwargs:Any)->IssuesStatistics:
40+
returncast(IssuesStatistics,super().get(**kwargs))
4541

4642

4743
classGroupIssuesStatistics(RefreshMixin,RESTObject):
@@ -53,10 +49,8 @@ class GroupIssuesStatisticsManager(GetWithoutIdMixin, RESTManager):
5349
_obj_cls=GroupIssuesStatistics
5450
_from_parent_attrs= {"group_id":"id"}
5551

56-
defget(
57-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
58-
)->GroupIssuesStatistics:
59-
returncast(GroupIssuesStatistics,super().get(id=id,**kwargs))
52+
defget(self,**kwargs:Any)->GroupIssuesStatistics:
53+
returncast(GroupIssuesStatistics,super().get(**kwargs))
6054

6155

6256
classProjectIssuesStatistics(RefreshMixin,RESTObject):
@@ -68,7 +62,5 @@ class ProjectIssuesStatisticsManager(GetWithoutIdMixin, RESTManager):
6862
_obj_cls=ProjectIssuesStatistics
6963
_from_parent_attrs= {"project_id":"id"}
7064

71-
defget(
72-
self,id:Optional[Union[int,str]]=None,**kwargs:Any
73-
)->ProjectIssuesStatistics:
74-
returncast(ProjectIssuesStatistics,super().get(id=id,**kwargs))
65+
defget(self,**kwargs:Any)->ProjectIssuesStatistics:
66+
returncast(ProjectIssuesStatistics,super().get(**kwargs))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp