python-gitlab 5.5.0__py3-none-any.whl → 6.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. gitlab/__init__.py +0 -1
  2. gitlab/_backends/protocol.py +9 -13
  3. gitlab/_backends/requests_backend.py +12 -12
  4. gitlab/_version.py +1 -1
  5. gitlab/base.py +48 -48
  6. gitlab/cli.py +14 -24
  7. gitlab/client.py +114 -140
  8. gitlab/config.py +16 -17
  9. gitlab/exceptions.py +7 -5
  10. gitlab/mixins.py +154 -238
  11. gitlab/types.py +13 -14
  12. gitlab/utils.py +32 -43
  13. gitlab/v4/cli.py +50 -53
  14. gitlab/v4/objects/__init__.py +1 -0
  15. gitlab/v4/objects/access_requests.py +11 -3
  16. gitlab/v4/objects/appearance.py +12 -14
  17. gitlab/v4/objects/applications.py +5 -6
  18. gitlab/v4/objects/artifacts.py +10 -17
  19. gitlab/v4/objects/audit_events.py +4 -19
  20. gitlab/v4/objects/award_emojis.py +13 -57
  21. gitlab/v4/objects/badges.py +4 -19
  22. gitlab/v4/objects/boards.py +7 -27
  23. gitlab/v4/objects/branches.py +3 -15
  24. gitlab/v4/objects/broadcast_messages.py +3 -13
  25. gitlab/v4/objects/bulk_imports.py +6 -14
  26. gitlab/v4/objects/ci_lint.py +7 -13
  27. gitlab/v4/objects/cluster_agents.py +3 -13
  28. gitlab/v4/objects/clusters.py +13 -23
  29. gitlab/v4/objects/commits.py +23 -28
  30. gitlab/v4/objects/container_registry.py +13 -19
  31. gitlab/v4/objects/custom_attributes.py +16 -21
  32. gitlab/v4/objects/deploy_keys.py +22 -19
  33. gitlab/v4/objects/deploy_tokens.py +14 -32
  34. gitlab/v4/objects/deployments.py +13 -15
  35. gitlab/v4/objects/discussions.py +13 -29
  36. gitlab/v4/objects/draft_notes.py +4 -14
  37. gitlab/v4/objects/environments.py +13 -21
  38. gitlab/v4/objects/epics.py +14 -17
  39. gitlab/v4/objects/events.py +27 -79
  40. gitlab/v4/objects/export_import.py +7 -19
  41. gitlab/v4/objects/features.py +11 -12
  42. gitlab/v4/objects/files.py +23 -38
  43. gitlab/v4/objects/geo_nodes.py +7 -11
  44. gitlab/v4/objects/group_access_tokens.py +6 -13
  45. gitlab/v4/objects/groups.py +42 -37
  46. gitlab/v4/objects/hooks.py +4 -17
  47. gitlab/v4/objects/integrations.py +7 -18
  48. gitlab/v4/objects/invitations.py +12 -23
  49. gitlab/v4/objects/issues.py +21 -27
  50. gitlab/v4/objects/iterations.py +4 -8
  51. gitlab/v4/objects/job_token_scope.py +18 -14
  52. gitlab/v4/objects/jobs.py +17 -32
  53. gitlab/v4/objects/keys.py +8 -11
  54. gitlab/v4/objects/labels.py +19 -30
  55. gitlab/v4/objects/ldap.py +25 -9
  56. gitlab/v4/objects/member_roles.py +102 -0
  57. gitlab/v4/objects/members.py +11 -29
  58. gitlab/v4/objects/merge_request_approvals.py +47 -38
  59. gitlab/v4/objects/merge_requests.py +30 -40
  60. gitlab/v4/objects/merge_trains.py +3 -6
  61. gitlab/v4/objects/milestones.py +23 -29
  62. gitlab/v4/objects/namespaces.py +4 -10
  63. gitlab/v4/objects/notes.py +26 -69
  64. gitlab/v4/objects/notification_settings.py +5 -14
  65. gitlab/v4/objects/package_protection_rules.py +8 -8
  66. gitlab/v4/objects/packages.py +22 -37
  67. gitlab/v4/objects/pages.py +8 -14
  68. gitlab/v4/objects/personal_access_tokens.py +7 -10
  69. gitlab/v4/objects/pipelines.py +38 -47
  70. gitlab/v4/objects/project_access_tokens.py +6 -13
  71. gitlab/v4/objects/projects.py +54 -76
  72. gitlab/v4/objects/push_rules.py +13 -15
  73. gitlab/v4/objects/registry_protection_repository_rules.py +6 -7
  74. gitlab/v4/objects/registry_protection_rules.py +7 -11
  75. gitlab/v4/objects/releases.py +6 -20
  76. gitlab/v4/objects/repositories.py +25 -34
  77. gitlab/v4/objects/resource_groups.py +10 -15
  78. gitlab/v4/objects/reviewers.py +4 -2
  79. gitlab/v4/objects/runners.py +14 -13
  80. gitlab/v4/objects/secure_files.py +8 -21
  81. gitlab/v4/objects/service_accounts.py +7 -5
  82. gitlab/v4/objects/settings.py +13 -14
  83. gitlab/v4/objects/sidekiq.py +17 -18
  84. gitlab/v4/objects/snippets.py +78 -66
  85. gitlab/v4/objects/statistics.py +8 -23
  86. gitlab/v4/objects/status_checks.py +6 -3
  87. gitlab/v4/objects/tags.py +3 -13
  88. gitlab/v4/objects/templates.py +11 -59
  89. gitlab/v4/objects/todos.py +3 -6
  90. gitlab/v4/objects/topics.py +10 -21
  91. gitlab/v4/objects/triggers.py +3 -13
  92. gitlab/v4/objects/users.py +87 -93
  93. gitlab/v4/objects/variables.py +4 -19
  94. gitlab/v4/objects/wikis.py +4 -19
  95. {python_gitlab-5.5.0.dist-info → python_gitlab-6.0.0.dist-info}/METADATA +3 -2
  96. python_gitlab-6.0.0.dist-info/RECORD +107 -0
  97. {python_gitlab-5.5.0.dist-info → python_gitlab-6.0.0.dist-info}/WHEEL +1 -1
  98. python_gitlab-5.5.0.dist-info/RECORD +0 -106
  99. {python_gitlab-5.5.0.dist-info → python_gitlab-6.0.0.dist-info}/entry_points.txt +0 -0
  100. {python_gitlab-5.5.0.dist-info → python_gitlab-6.0.0.dist-info/licenses}/AUTHORS +0 -0
  101. {python_gitlab-5.5.0.dist-info → python_gitlab-6.0.0.dist-info/licenses}/COPYING +0 -0
  102. {python_gitlab-5.5.0.dist-info → python_gitlab-6.0.0.dist-info}/top_level.txt +0 -0
@@ -3,16 +3,9 @@ GitLab API:
3
3
  https://docs.gitlab.com/ee/api/job_artifacts.html
4
4
  """
5
5
 
6
- from typing import (
7
- Any,
8
- Callable,
9
- Iterator,
10
- Literal,
11
- Optional,
12
- overload,
13
- TYPE_CHECKING,
14
- Union,
15
- )
6
+ from __future__ import annotations
7
+
8
+ from typing import Any, Callable, Iterator, Literal, overload, TYPE_CHECKING
16
9
 
17
10
  import requests
18
11
 
@@ -30,7 +23,7 @@ class ProjectArtifact(RESTObject):
30
23
  _id_attr = "ref_name"
31
24
 
32
25
 
33
- class ProjectArtifactManager(RESTManager):
26
+ class ProjectArtifactManager(RESTManager[ProjectArtifact]):
34
27
  _obj_cls = ProjectArtifact
35
28
  _path = "/projects/{project_id}/jobs/artifacts"
36
29
  _from_parent_attrs = {"project_id": "id"}
@@ -84,7 +77,7 @@ class ProjectArtifactManager(RESTManager):
84
77
  ref_name: str,
85
78
  job: str,
86
79
  streamed: Literal[True] = True,
87
- action: Optional[Callable[[bytes], Any]] = None,
80
+ action: Callable[[bytes], Any] | None = None,
88
81
  chunk_size: int = 1024,
89
82
  *,
90
83
  iterator: Literal[False] = False,
@@ -102,12 +95,12 @@ class ProjectArtifactManager(RESTManager):
102
95
  ref_name: str,
103
96
  job: str,
104
97
  streamed: bool = False,
105
- action: Optional[Callable[[bytes], Any]] = None,
98
+ action: Callable[[bytes], Any] | None = None,
106
99
  chunk_size: int = 1024,
107
100
  *,
108
101
  iterator: bool = False,
109
102
  **kwargs: Any,
110
- ) -> Optional[Union[bytes, Iterator[Any]]]:
103
+ ) -> bytes | Iterator[Any] | None:
111
104
  """Get the job artifacts archive from a specific tag or branch.
112
105
 
113
106
  Args:
@@ -177,7 +170,7 @@ class ProjectArtifactManager(RESTManager):
177
170
  artifact_path: str,
178
171
  job: str,
179
172
  streamed: Literal[True] = True,
180
- action: Optional[Callable[[bytes], Any]] = None,
173
+ action: Callable[[bytes], Any] | None = None,
181
174
  chunk_size: int = 1024,
182
175
  *,
183
176
  iterator: Literal[False] = False,
@@ -195,12 +188,12 @@ class ProjectArtifactManager(RESTManager):
195
188
  artifact_path: str,
196
189
  job: str,
197
190
  streamed: bool = False,
198
- action: Optional[Callable[[bytes], Any]] = None,
191
+ action: Callable[[bytes], Any] | None = None,
199
192
  chunk_size: int = 1024,
200
193
  *,
201
194
  iterator: bool = False,
202
195
  **kwargs: Any,
203
- ) -> Optional[Union[bytes, Iterator[Any]]]:
196
+ ) -> bytes | Iterator[Any] | None:
204
197
  """Download a single artifact file from a specific tag or branch from
205
198
  within the job's artifacts archive.
206
199
 
@@ -3,9 +3,7 @@ GitLab API:
3
3
  https://docs.gitlab.com/ee/api/audit_events.html
4
4
  """
5
5
 
6
- from typing import Any, cast, Union
7
-
8
- from gitlab.base import RESTManager, RESTObject
6
+ from gitlab.base import RESTObject
9
7
  from gitlab.mixins import RetrieveMixin
10
8
 
11
9
  __all__ = [
@@ -24,46 +22,33 @@ class AuditEvent(RESTObject):
24
22
  _id_attr = "id"
25
23
 
26
24
 
27
- class AuditEventManager(RetrieveMixin, RESTManager):
25
+ class AuditEventManager(RetrieveMixin[AuditEvent]):
28
26
  _path = "/audit_events"
29
27
  _obj_cls = AuditEvent
30
28
  _list_filters = ("created_after", "created_before", "entity_type", "entity_id")
31
29
 
32
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> AuditEvent:
33
- return cast(AuditEvent, super().get(id=id, lazy=lazy, **kwargs))
34
-
35
30
 
36
31
  class GroupAuditEvent(RESTObject):
37
32
  _id_attr = "id"
38
33
 
39
34
 
40
- class GroupAuditEventManager(RetrieveMixin, RESTManager):
35
+ class GroupAuditEventManager(RetrieveMixin[GroupAuditEvent]):
41
36
  _path = "/groups/{group_id}/audit_events"
42
37
  _obj_cls = GroupAuditEvent
43
38
  _from_parent_attrs = {"group_id": "id"}
44
39
  _list_filters = ("created_after", "created_before")
45
40
 
46
- def get(
47
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
48
- ) -> GroupAuditEvent:
49
- return cast(GroupAuditEvent, super().get(id=id, lazy=lazy, **kwargs))
50
-
51
41
 
52
42
  class ProjectAuditEvent(RESTObject):
53
43
  _id_attr = "id"
54
44
 
55
45
 
56
- class ProjectAuditEventManager(RetrieveMixin, RESTManager):
46
+ class ProjectAuditEventManager(RetrieveMixin[ProjectAuditEvent]):
57
47
  _path = "/projects/{project_id}/audit_events"
58
48
  _obj_cls = ProjectAuditEvent
59
49
  _from_parent_attrs = {"project_id": "id"}
60
50
  _list_filters = ("created_after", "created_before")
61
51
 
62
- def get(
63
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
64
- ) -> ProjectAuditEvent:
65
- return cast(ProjectAuditEvent, super().get(id=id, lazy=lazy, **kwargs))
66
-
67
52
 
68
53
  class ProjectAudit(ProjectAuditEvent):
69
54
  pass
@@ -1,6 +1,4 @@
1
- from typing import Any, cast, Union
2
-
3
- from gitlab.base import RESTManager, RESTObject
1
+ from gitlab.base import RESTObject
4
2
  from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin
5
3
  from gitlab.types import RequiredOptional
6
4
 
@@ -28,23 +26,18 @@ class GroupEpicAwardEmoji(ObjectDeleteMixin, RESTObject):
28
26
  pass
29
27
 
30
28
 
31
- class GroupEpicAwardEmojiManager(NoUpdateMixin, RESTManager):
29
+ class GroupEpicAwardEmojiManager(NoUpdateMixin[GroupEpicAwardEmoji]):
32
30
  _path = "/groups/{group_id}/epics/{epic_iid}/award_emoji"
33
31
  _obj_cls = GroupEpicAwardEmoji
34
32
  _from_parent_attrs = {"group_id": "group_id", "epic_iid": "iid"}
35
33
  _create_attrs = RequiredOptional(required=("name",))
36
34
 
37
- def get(
38
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
39
- ) -> GroupEpicAwardEmoji:
40
- return cast(GroupEpicAwardEmoji, super().get(id=id, lazy=lazy, **kwargs))
41
-
42
35
 
43
36
  class GroupEpicNoteAwardEmoji(ObjectDeleteMixin, RESTObject):
44
37
  pass
45
38
 
46
39
 
47
- class GroupEpicNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
40
+ class GroupEpicNoteAwardEmojiManager(NoUpdateMixin[GroupEpicNoteAwardEmoji]):
48
41
  _path = "/groups/{group_id}/epics/{epic_iid}/notes/{note_id}/award_emoji"
49
42
  _obj_cls = GroupEpicNoteAwardEmoji
50
43
  _from_parent_attrs = {
@@ -54,33 +47,23 @@ class GroupEpicNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
54
47
  }
55
48
  _create_attrs = RequiredOptional(required=("name",))
56
49
 
57
- def get(
58
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
59
- ) -> GroupEpicNoteAwardEmoji:
60
- return cast(GroupEpicNoteAwardEmoji, super().get(id=id, lazy=lazy, **kwargs))
61
-
62
50
 
63
51
  class ProjectIssueAwardEmoji(ObjectDeleteMixin, RESTObject):
64
52
  pass
65
53
 
66
54
 
67
- class ProjectIssueAwardEmojiManager(NoUpdateMixin, RESTManager):
55
+ class ProjectIssueAwardEmojiManager(NoUpdateMixin[ProjectIssueAwardEmoji]):
68
56
  _path = "/projects/{project_id}/issues/{issue_iid}/award_emoji"
69
57
  _obj_cls = ProjectIssueAwardEmoji
70
58
  _from_parent_attrs = {"project_id": "project_id", "issue_iid": "iid"}
71
59
  _create_attrs = RequiredOptional(required=("name",))
72
60
 
73
- def get(
74
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
75
- ) -> ProjectIssueAwardEmoji:
76
- return cast(ProjectIssueAwardEmoji, super().get(id=id, lazy=lazy, **kwargs))
77
-
78
61
 
79
62
  class ProjectIssueNoteAwardEmoji(ObjectDeleteMixin, RESTObject):
80
63
  pass
81
64
 
82
65
 
83
- class ProjectIssueNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
66
+ class ProjectIssueNoteAwardEmojiManager(NoUpdateMixin[ProjectIssueNoteAwardEmoji]):
84
67
  _path = "/projects/{project_id}/issues/{issue_iid}/notes/{note_id}/award_emoji"
85
68
  _obj_cls = ProjectIssueNoteAwardEmoji
86
69
  _from_parent_attrs = {
@@ -90,35 +73,27 @@ class ProjectIssueNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
90
73
  }
91
74
  _create_attrs = RequiredOptional(required=("name",))
92
75
 
93
- def get(
94
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
95
- ) -> ProjectIssueNoteAwardEmoji:
96
- return cast(ProjectIssueNoteAwardEmoji, super().get(id=id, lazy=lazy, **kwargs))
97
-
98
76
 
99
77
  class ProjectMergeRequestAwardEmoji(ObjectDeleteMixin, RESTObject):
100
78
  pass
101
79
 
102
80
 
103
- class ProjectMergeRequestAwardEmojiManager(NoUpdateMixin, RESTManager):
81
+ class ProjectMergeRequestAwardEmojiManager(
82
+ NoUpdateMixin[ProjectMergeRequestAwardEmoji]
83
+ ):
104
84
  _path = "/projects/{project_id}/merge_requests/{mr_iid}/award_emoji"
105
85
  _obj_cls = ProjectMergeRequestAwardEmoji
106
86
  _from_parent_attrs = {"project_id": "project_id", "mr_iid": "iid"}
107
87
  _create_attrs = RequiredOptional(required=("name",))
108
88
 
109
- def get(
110
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
111
- ) -> ProjectMergeRequestAwardEmoji:
112
- return cast(
113
- ProjectMergeRequestAwardEmoji, super().get(id=id, lazy=lazy, **kwargs)
114
- )
115
-
116
89
 
117
90
  class ProjectMergeRequestNoteAwardEmoji(ObjectDeleteMixin, RESTObject):
118
91
  pass
119
92
 
120
93
 
121
- class ProjectMergeRequestNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
94
+ class ProjectMergeRequestNoteAwardEmojiManager(
95
+ NoUpdateMixin[ProjectMergeRequestNoteAwardEmoji]
96
+ ):
122
97
  _path = "/projects/{project_id}/merge_requests/{mr_iid}/notes/{note_id}/award_emoji"
123
98
  _obj_cls = ProjectMergeRequestNoteAwardEmoji
124
99
  _from_parent_attrs = {
@@ -128,35 +103,23 @@ class ProjectMergeRequestNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
128
103
  }
129
104
  _create_attrs = RequiredOptional(required=("name",))
130
105
 
131
- def get(
132
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
133
- ) -> ProjectMergeRequestNoteAwardEmoji:
134
- return cast(
135
- ProjectMergeRequestNoteAwardEmoji, super().get(id=id, lazy=lazy, **kwargs)
136
- )
137
-
138
106
 
139
107
  class ProjectSnippetAwardEmoji(ObjectDeleteMixin, RESTObject):
140
108
  pass
141
109
 
142
110
 
143
- class ProjectSnippetAwardEmojiManager(NoUpdateMixin, RESTManager):
111
+ class ProjectSnippetAwardEmojiManager(NoUpdateMixin[ProjectSnippetAwardEmoji]):
144
112
  _path = "/projects/{project_id}/snippets/{snippet_id}/award_emoji"
145
113
  _obj_cls = ProjectSnippetAwardEmoji
146
114
  _from_parent_attrs = {"project_id": "project_id", "snippet_id": "id"}
147
115
  _create_attrs = RequiredOptional(required=("name",))
148
116
 
149
- def get(
150
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
151
- ) -> ProjectSnippetAwardEmoji:
152
- return cast(ProjectSnippetAwardEmoji, super().get(id=id, lazy=lazy, **kwargs))
153
-
154
117
 
155
118
  class ProjectSnippetNoteAwardEmoji(ObjectDeleteMixin, RESTObject):
156
119
  pass
157
120
 
158
121
 
159
- class ProjectSnippetNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
122
+ class ProjectSnippetNoteAwardEmojiManager(NoUpdateMixin[ProjectSnippetNoteAwardEmoji]):
160
123
  _path = "/projects/{project_id}/snippets/{snippet_id}/notes/{note_id}/award_emoji"
161
124
  _obj_cls = ProjectSnippetNoteAwardEmoji
162
125
  _from_parent_attrs = {
@@ -165,10 +128,3 @@ class ProjectSnippetNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
165
128
  "note_id": "id",
166
129
  }
167
130
  _create_attrs = RequiredOptional(required=("name",))
168
-
169
- def get(
170
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
171
- ) -> ProjectSnippetNoteAwardEmoji:
172
- return cast(
173
- ProjectSnippetNoteAwardEmoji, super().get(id=id, lazy=lazy, **kwargs)
174
- )
@@ -1,44 +1,29 @@
1
- from typing import Any, cast, Union
2
-
3
- from gitlab.base import RESTManager, RESTObject
1
+ from gitlab.base import RESTObject
4
2
  from gitlab.mixins import BadgeRenderMixin, CRUDMixin, ObjectDeleteMixin, SaveMixin
5
3
  from gitlab.types import RequiredOptional
6
4
 
7
- __all__ = [
8
- "GroupBadge",
9
- "GroupBadgeManager",
10
- "ProjectBadge",
11
- "ProjectBadgeManager",
12
- ]
5
+ __all__ = ["GroupBadge", "GroupBadgeManager", "ProjectBadge", "ProjectBadgeManager"]
13
6
 
14
7
 
15
8
  class GroupBadge(SaveMixin, ObjectDeleteMixin, RESTObject):
16
9
  pass
17
10
 
18
11
 
19
- class GroupBadgeManager(BadgeRenderMixin, CRUDMixin, RESTManager):
12
+ class GroupBadgeManager(BadgeRenderMixin[GroupBadge], CRUDMixin[GroupBadge]):
20
13
  _path = "/groups/{group_id}/badges"
21
14
  _obj_cls = GroupBadge
22
15
  _from_parent_attrs = {"group_id": "id"}
23
16
  _create_attrs = RequiredOptional(required=("link_url", "image_url"))
24
17
  _update_attrs = RequiredOptional(optional=("link_url", "image_url"))
25
18
 
26
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> GroupBadge:
27
- return cast(GroupBadge, super().get(id=id, lazy=lazy, **kwargs))
28
-
29
19
 
30
20
  class ProjectBadge(SaveMixin, ObjectDeleteMixin, RESTObject):
31
21
  pass
32
22
 
33
23
 
34
- class ProjectBadgeManager(BadgeRenderMixin, CRUDMixin, RESTManager):
24
+ class ProjectBadgeManager(BadgeRenderMixin[ProjectBadge], CRUDMixin[ProjectBadge]):
35
25
  _path = "/projects/{project_id}/badges"
36
26
  _obj_cls = ProjectBadge
37
27
  _from_parent_attrs = {"project_id": "id"}
38
28
  _create_attrs = RequiredOptional(required=("link_url", "image_url"))
39
29
  _update_attrs = RequiredOptional(optional=("link_url", "image_url"))
40
-
41
- def get(
42
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
43
- ) -> ProjectBadge:
44
- return cast(ProjectBadge, super().get(id=id, lazy=lazy, **kwargs))
@@ -1,6 +1,4 @@
1
- from typing import Any, cast, Union
2
-
3
- from gitlab.base import RESTManager, RESTObject
1
+ from gitlab.base import RESTObject
4
2
  from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
5
3
  from gitlab.types import RequiredOptional
6
4
 
@@ -20,65 +18,47 @@ class GroupBoardList(SaveMixin, ObjectDeleteMixin, RESTObject):
20
18
  pass
21
19
 
22
20
 
23
- class GroupBoardListManager(CRUDMixin, RESTManager):
21
+ class GroupBoardListManager(CRUDMixin[GroupBoardList]):
24
22
  _path = "/groups/{group_id}/boards/{board_id}/lists"
25
23
  _obj_cls = GroupBoardList
26
24
  _from_parent_attrs = {"group_id": "group_id", "board_id": "id"}
27
25
  _create_attrs = RequiredOptional(
28
- exclusive=("label_id", "assignee_id", "milestone_id")
26
+ exclusive=("label_id", "assignee_id", "milestone_id", "iteration_id")
29
27
  )
30
28
  _update_attrs = RequiredOptional(required=("position",))
31
29
 
32
- def get(
33
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
34
- ) -> GroupBoardList:
35
- return cast(GroupBoardList, super().get(id=id, lazy=lazy, **kwargs))
36
-
37
30
 
38
31
  class GroupBoard(SaveMixin, ObjectDeleteMixin, RESTObject):
39
32
  lists: GroupBoardListManager
40
33
 
41
34
 
42
- class GroupBoardManager(CRUDMixin, RESTManager):
35
+ class GroupBoardManager(CRUDMixin[GroupBoard]):
43
36
  _path = "/groups/{group_id}/boards"
44
37
  _obj_cls = GroupBoard
45
38
  _from_parent_attrs = {"group_id": "id"}
46
39
  _create_attrs = RequiredOptional(required=("name",))
47
40
 
48
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> GroupBoard:
49
- return cast(GroupBoard, super().get(id=id, lazy=lazy, **kwargs))
50
-
51
41
 
52
42
  class ProjectBoardList(SaveMixin, ObjectDeleteMixin, RESTObject):
53
43
  pass
54
44
 
55
45
 
56
- class ProjectBoardListManager(CRUDMixin, RESTManager):
46
+ class ProjectBoardListManager(CRUDMixin[ProjectBoardList]):
57
47
  _path = "/projects/{project_id}/boards/{board_id}/lists"
58
48
  _obj_cls = ProjectBoardList
59
49
  _from_parent_attrs = {"project_id": "project_id", "board_id": "id"}
60
50
  _create_attrs = RequiredOptional(
61
- exclusive=("label_id", "assignee_id", "milestone_id")
51
+ exclusive=("label_id", "assignee_id", "milestone_id", "iteration_id")
62
52
  )
63
53
  _update_attrs = RequiredOptional(required=("position",))
64
54
 
65
- def get(
66
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
67
- ) -> ProjectBoardList:
68
- return cast(ProjectBoardList, super().get(id=id, lazy=lazy, **kwargs))
69
-
70
55
 
71
56
  class ProjectBoard(SaveMixin, ObjectDeleteMixin, RESTObject):
72
57
  lists: ProjectBoardListManager
73
58
 
74
59
 
75
- class ProjectBoardManager(CRUDMixin, RESTManager):
60
+ class ProjectBoardManager(CRUDMixin[ProjectBoard]):
76
61
  _path = "/projects/{project_id}/boards"
77
62
  _obj_cls = ProjectBoard
78
63
  _from_parent_attrs = {"project_id": "id"}
79
64
  _create_attrs = RequiredOptional(required=("name",))
80
-
81
- def get(
82
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
83
- ) -> ProjectBoard:
84
- return cast(ProjectBoard, super().get(id=id, lazy=lazy, **kwargs))
@@ -1,6 +1,4 @@
1
- from typing import Any, cast, Union
2
-
3
- from gitlab.base import RESTManager, RESTObject
1
+ from gitlab.base import RESTObject
4
2
  from gitlab.mixins import (
5
3
  CRUDMixin,
6
4
  NoUpdateMixin,
@@ -22,23 +20,18 @@ class ProjectBranch(ObjectDeleteMixin, RESTObject):
22
20
  _id_attr = "name"
23
21
 
24
22
 
25
- class ProjectBranchManager(NoUpdateMixin, RESTManager):
23
+ class ProjectBranchManager(NoUpdateMixin[ProjectBranch]):
26
24
  _path = "/projects/{project_id}/repository/branches"
27
25
  _obj_cls = ProjectBranch
28
26
  _from_parent_attrs = {"project_id": "id"}
29
27
  _create_attrs = RequiredOptional(required=("branch", "ref"))
30
28
 
31
- def get(
32
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
33
- ) -> ProjectBranch:
34
- return cast(ProjectBranch, super().get(id=id, lazy=lazy, **kwargs))
35
-
36
29
 
37
30
  class ProjectProtectedBranch(SaveMixin, ObjectDeleteMixin, RESTObject):
38
31
  _id_attr = "name"
39
32
 
40
33
 
41
- class ProjectProtectedBranchManager(CRUDMixin, RESTManager):
34
+ class ProjectProtectedBranchManager(CRUDMixin[ProjectProtectedBranch]):
42
35
  _path = "/projects/{project_id}/protected_branches"
43
36
  _obj_cls = ProjectProtectedBranch
44
37
  _from_parent_attrs = {"project_id": "id"}
@@ -56,8 +49,3 @@ class ProjectProtectedBranchManager(CRUDMixin, RESTManager):
56
49
  ),
57
50
  )
58
51
  _update_method = UpdateMethod.PATCH
59
-
60
- def get(
61
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
62
- ) -> ProjectProtectedBranch:
63
- return cast(ProjectProtectedBranch, super().get(id=id, lazy=lazy, **kwargs))
@@ -1,20 +1,15 @@
1
- from typing import Any, cast, Union
2
-
3
- from gitlab.base import RESTManager, RESTObject
1
+ from gitlab.base import RESTObject
4
2
  from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
5
3
  from gitlab.types import ArrayAttribute, RequiredOptional
6
4
 
7
- __all__ = [
8
- "BroadcastMessage",
9
- "BroadcastMessageManager",
10
- ]
5
+ __all__ = ["BroadcastMessage", "BroadcastMessageManager"]
11
6
 
12
7
 
13
8
  class BroadcastMessage(SaveMixin, ObjectDeleteMixin, RESTObject):
14
9
  pass
15
10
 
16
11
 
17
- class BroadcastMessageManager(CRUDMixin, RESTManager):
12
+ class BroadcastMessageManager(CRUDMixin[BroadcastMessage]):
18
13
  _path = "/broadcast_messages"
19
14
  _obj_cls = BroadcastMessage
20
15
 
@@ -33,8 +28,3 @@ class BroadcastMessageManager(CRUDMixin, RESTManager):
33
28
  )
34
29
  )
35
30
  _types = {"target_access_levels": ArrayAttribute}
36
-
37
- def get(
38
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
39
- ) -> BroadcastMessage:
40
- return cast(BroadcastMessage, super().get(id=id, lazy=lazy, **kwargs))
@@ -1,6 +1,6 @@
1
- from typing import Any, cast, Union
1
+ from __future__ import annotations
2
2
 
3
- from gitlab.base import RESTManager, RESTObject
3
+ from gitlab.base import RESTObject
4
4
  from gitlab.mixins import CreateMixin, ListMixin, RefreshMixin, RetrieveMixin
5
5
  from gitlab.types import RequiredOptional
6
6
 
@@ -15,40 +15,32 @@ __all__ = [
15
15
 
16
16
 
17
17
  class BulkImport(RefreshMixin, RESTObject):
18
- entities: "BulkImportEntityManager"
18
+ entities: BulkImportEntityManager
19
19
 
20
20
 
21
- class BulkImportManager(CreateMixin, RetrieveMixin, RESTManager):
21
+ class BulkImportManager(CreateMixin[BulkImport], RetrieveMixin[BulkImport]):
22
22
  _path = "/bulk_imports"
23
23
  _obj_cls = BulkImport
24
24
  _create_attrs = RequiredOptional(required=("configuration", "entities"))
25
25
  _list_filters = ("sort", "status")
26
26
 
27
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> BulkImport:
28
- return cast(BulkImport, super().get(id=id, lazy=lazy, **kwargs))
29
-
30
27
 
31
28
  class BulkImportEntity(RefreshMixin, RESTObject):
32
29
  pass
33
30
 
34
31
 
35
- class BulkImportEntityManager(RetrieveMixin, RESTManager):
32
+ class BulkImportEntityManager(RetrieveMixin[BulkImportEntity]):
36
33
  _path = "/bulk_imports/{bulk_import_id}/entities"
37
34
  _obj_cls = BulkImportEntity
38
35
  _from_parent_attrs = {"bulk_import_id": "id"}
39
36
  _list_filters = ("sort", "status")
40
37
 
41
- def get(
42
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
43
- ) -> BulkImportEntity:
44
- return cast(BulkImportEntity, super().get(id=id, lazy=lazy, **kwargs))
45
-
46
38
 
47
39
  class BulkImportAllEntity(RESTObject):
48
40
  pass
49
41
 
50
42
 
51
- class BulkImportAllEntityManager(ListMixin, RESTManager):
43
+ class BulkImportAllEntityManager(ListMixin[BulkImportAllEntity]):
52
44
  _path = "/bulk_imports/entities"
53
45
  _obj_cls = BulkImportAllEntity
54
46
  _list_filters = ("sort", "status")
@@ -3,27 +3,22 @@ GitLab API:
3
3
  https://docs.gitlab.com/ee/api/lint.html
4
4
  """
5
5
 
6
- from typing import Any, cast
6
+ from typing import Any
7
7
 
8
- from gitlab.base import RESTManager, RESTObject
8
+ from gitlab.base import RESTObject
9
9
  from gitlab.cli import register_custom_action
10
10
  from gitlab.exceptions import GitlabCiLintError
11
11
  from gitlab.mixins import CreateMixin, GetWithoutIdMixin
12
12
  from gitlab.types import RequiredOptional
13
13
 
14
- __all__ = [
15
- "CiLint",
16
- "CiLintManager",
17
- "ProjectCiLint",
18
- "ProjectCiLintManager",
19
- ]
14
+ __all__ = ["CiLint", "CiLintManager", "ProjectCiLint", "ProjectCiLintManager"]
20
15
 
21
16
 
22
17
  class CiLint(RESTObject):
23
18
  _id_attr = None
24
19
 
25
20
 
26
- class CiLintManager(CreateMixin, RESTManager):
21
+ class CiLintManager(CreateMixin[CiLint]):
27
22
  _path = "/ci/lint"
28
23
  _obj_cls = CiLint
29
24
  _create_attrs = RequiredOptional(
@@ -50,7 +45,9 @@ class ProjectCiLint(RESTObject):
50
45
  _id_attr = None
51
46
 
52
47
 
53
- class ProjectCiLintManager(GetWithoutIdMixin, CreateMixin, RESTManager):
48
+ class ProjectCiLintManager(
49
+ GetWithoutIdMixin[ProjectCiLint], CreateMixin[ProjectCiLint]
50
+ ):
54
51
  _path = "/projects/{project_id}/ci/lint"
55
52
  _obj_cls = ProjectCiLint
56
53
  _from_parent_attrs = {"project_id": "id"}
@@ -59,9 +56,6 @@ class ProjectCiLintManager(GetWithoutIdMixin, CreateMixin, RESTManager):
59
56
  required=("content",), optional=("dry_run", "include_jobs", "ref")
60
57
  )
61
58
 
62
- def get(self, **kwargs: Any) -> ProjectCiLint:
63
- return cast(ProjectCiLint, super().get(**kwargs))
64
-
65
59
  @register_custom_action(
66
60
  cls_names="ProjectCiLintManager",
67
61
  required=("content",),
@@ -1,26 +1,16 @@
1
- from typing import Any, cast, Union
2
-
3
- from gitlab.base import RESTManager, RESTObject
1
+ from gitlab.base import RESTObject
4
2
  from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin, SaveMixin
5
3
  from gitlab.types import RequiredOptional
6
4
 
7
- __all__ = [
8
- "ProjectClusterAgent",
9
- "ProjectClusterAgentManager",
10
- ]
5
+ __all__ = ["ProjectClusterAgent", "ProjectClusterAgentManager"]
11
6
 
12
7
 
13
8
  class ProjectClusterAgent(SaveMixin, ObjectDeleteMixin, RESTObject):
14
9
  _repr_attr = "name"
15
10
 
16
11
 
17
- class ProjectClusterAgentManager(NoUpdateMixin, RESTManager):
12
+ class ProjectClusterAgentManager(NoUpdateMixin[ProjectClusterAgent]):
18
13
  _path = "/projects/{project_id}/cluster_agents"
19
14
  _obj_cls = ProjectClusterAgent
20
15
  _from_parent_attrs = {"project_id": "id"}
21
16
  _create_attrs = RequiredOptional(required=("name",))
22
-
23
- def get(
24
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
25
- ) -> ProjectClusterAgent:
26
- return cast(ProjectClusterAgent, super().get(id=id, lazy=lazy, **kwargs))