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
@@ -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 RetrieveMixin
5
3
 
6
4
  __all__ = [
@@ -31,141 +29,95 @@ class Dockerfile(RESTObject):
31
29
  _id_attr = "name"
32
30
 
33
31
 
34
- class DockerfileManager(RetrieveMixin, RESTManager):
32
+ class DockerfileManager(RetrieveMixin[Dockerfile]):
35
33
  _path = "/templates/dockerfiles"
36
34
  _obj_cls = Dockerfile
37
35
 
38
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Dockerfile:
39
- return cast(Dockerfile, super().get(id=id, lazy=lazy, **kwargs))
40
-
41
36
 
42
37
  class Gitignore(RESTObject):
43
38
  _id_attr = "name"
44
39
 
45
40
 
46
- class GitignoreManager(RetrieveMixin, RESTManager):
41
+ class GitignoreManager(RetrieveMixin[Gitignore]):
47
42
  _path = "/templates/gitignores"
48
43
  _obj_cls = Gitignore
49
44
 
50
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Gitignore:
51
- return cast(Gitignore, super().get(id=id, lazy=lazy, **kwargs))
52
-
53
45
 
54
46
  class Gitlabciyml(RESTObject):
55
47
  _id_attr = "name"
56
48
 
57
49
 
58
- class GitlabciymlManager(RetrieveMixin, RESTManager):
50
+ class GitlabciymlManager(RetrieveMixin[Gitlabciyml]):
59
51
  _path = "/templates/gitlab_ci_ymls"
60
52
  _obj_cls = Gitlabciyml
61
53
 
62
- def get(
63
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
64
- ) -> Gitlabciyml:
65
- return cast(Gitlabciyml, super().get(id=id, lazy=lazy, **kwargs))
66
-
67
54
 
68
55
  class License(RESTObject):
69
56
  _id_attr = "key"
70
57
 
71
58
 
72
- class LicenseManager(RetrieveMixin, RESTManager):
59
+ class LicenseManager(RetrieveMixin[License]):
73
60
  _path = "/templates/licenses"
74
61
  _obj_cls = License
75
62
  _list_filters = ("popular",)
76
63
  _optional_get_attrs = ("project", "fullname")
77
64
 
78
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> License:
79
- return cast(License, super().get(id=id, lazy=lazy, **kwargs))
80
-
81
65
 
82
66
  class ProjectDockerfileTemplate(RESTObject):
83
67
  _id_attr = "name"
84
68
 
85
69
 
86
- class ProjectDockerfileTemplateManager(RetrieveMixin, RESTManager):
70
+ class ProjectDockerfileTemplateManager(RetrieveMixin[ProjectDockerfileTemplate]):
87
71
  _path = "/projects/{project_id}/templates/dockerfiles"
88
72
  _obj_cls = ProjectDockerfileTemplate
89
73
  _from_parent_attrs = {"project_id": "id"}
90
74
 
91
- def get(
92
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
93
- ) -> ProjectDockerfileTemplate:
94
- return cast(ProjectDockerfileTemplate, super().get(id=id, lazy=lazy, **kwargs))
95
-
96
75
 
97
76
  class ProjectGitignoreTemplate(RESTObject):
98
77
  _id_attr = "name"
99
78
 
100
79
 
101
- class ProjectGitignoreTemplateManager(RetrieveMixin, RESTManager):
80
+ class ProjectGitignoreTemplateManager(RetrieveMixin[ProjectGitignoreTemplate]):
102
81
  _path = "/projects/{project_id}/templates/gitignores"
103
82
  _obj_cls = ProjectGitignoreTemplate
104
83
  _from_parent_attrs = {"project_id": "id"}
105
84
 
106
- def get(
107
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
108
- ) -> ProjectGitignoreTemplate:
109
- return cast(ProjectGitignoreTemplate, super().get(id=id, lazy=lazy, **kwargs))
110
-
111
85
 
112
86
  class ProjectGitlabciymlTemplate(RESTObject):
113
87
  _id_attr = "name"
114
88
 
115
89
 
116
- class ProjectGitlabciymlTemplateManager(RetrieveMixin, RESTManager):
90
+ class ProjectGitlabciymlTemplateManager(RetrieveMixin[ProjectGitlabciymlTemplate]):
117
91
  _path = "/projects/{project_id}/templates/gitlab_ci_ymls"
118
92
  _obj_cls = ProjectGitlabciymlTemplate
119
93
  _from_parent_attrs = {"project_id": "id"}
120
94
 
121
- def get(
122
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
123
- ) -> ProjectGitlabciymlTemplate:
124
- return cast(ProjectGitlabciymlTemplate, super().get(id=id, lazy=lazy, **kwargs))
125
-
126
95
 
127
96
  class ProjectLicenseTemplate(RESTObject):
128
97
  _id_attr = "key"
129
98
 
130
99
 
131
- class ProjectLicenseTemplateManager(RetrieveMixin, RESTManager):
100
+ class ProjectLicenseTemplateManager(RetrieveMixin[ProjectLicenseTemplate]):
132
101
  _path = "/projects/{project_id}/templates/licenses"
133
102
  _obj_cls = ProjectLicenseTemplate
134
103
  _from_parent_attrs = {"project_id": "id"}
135
104
 
136
- def get(
137
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
138
- ) -> ProjectLicenseTemplate:
139
- return cast(ProjectLicenseTemplate, super().get(id=id, lazy=lazy, **kwargs))
140
-
141
105
 
142
106
  class ProjectIssueTemplate(RESTObject):
143
107
  _id_attr = "name"
144
108
 
145
109
 
146
- class ProjectIssueTemplateManager(RetrieveMixin, RESTManager):
110
+ class ProjectIssueTemplateManager(RetrieveMixin[ProjectIssueTemplate]):
147
111
  _path = "/projects/{project_id}/templates/issues"
148
112
  _obj_cls = ProjectIssueTemplate
149
113
  _from_parent_attrs = {"project_id": "id"}
150
114
 
151
- def get(
152
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
153
- ) -> ProjectIssueTemplate:
154
- return cast(ProjectIssueTemplate, super().get(id=id, lazy=lazy, **kwargs))
155
-
156
115
 
157
116
  class ProjectMergeRequestTemplate(RESTObject):
158
117
  _id_attr = "name"
159
118
 
160
119
 
161
- class ProjectMergeRequestTemplateManager(RetrieveMixin, RESTManager):
120
+ class ProjectMergeRequestTemplateManager(RetrieveMixin[ProjectMergeRequestTemplate]):
162
121
  _path = "/projects/{project_id}/templates/merge_requests"
163
122
  _obj_cls = ProjectMergeRequestTemplate
164
123
  _from_parent_attrs = {"project_id": "id"}
165
-
166
- def get(
167
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
168
- ) -> ProjectMergeRequestTemplate:
169
- return cast(
170
- ProjectMergeRequestTemplate, super().get(id=id, lazy=lazy, **kwargs)
171
- )
@@ -2,13 +2,10 @@ from typing import Any, Dict, TYPE_CHECKING
2
2
 
3
3
  from gitlab import cli
4
4
  from gitlab import exceptions as exc
5
- from gitlab.base import RESTManager, RESTObject
5
+ from gitlab.base import RESTObject
6
6
  from gitlab.mixins import DeleteMixin, ListMixin, ObjectDeleteMixin
7
7
 
8
- __all__ = [
9
- "Todo",
10
- "TodoManager",
11
- ]
8
+ __all__ = ["Todo", "TodoManager"]
12
9
 
13
10
 
14
11
  class Todo(ObjectDeleteMixin, RESTObject):
@@ -35,7 +32,7 @@ class Todo(ObjectDeleteMixin, RESTObject):
35
32
  return server_data
36
33
 
37
34
 
38
- class TodoManager(ListMixin, DeleteMixin, RESTManager):
35
+ class TodoManager(ListMixin[Todo], DeleteMixin[Todo]):
39
36
  _path = "/todos"
40
37
  _obj_cls = Todo
41
38
  _list_filters = ("action", "author_id", "project_id", "state", "type")
@@ -1,23 +1,22 @@
1
- from typing import Any, cast, Dict, TYPE_CHECKING, Union
1
+ from __future__ import annotations
2
+
3
+ from typing import Any, TYPE_CHECKING
2
4
 
3
5
  from gitlab import cli
4
6
  from gitlab import exceptions as exc
5
7
  from gitlab import types
6
- from gitlab.base import RESTManager, RESTObject
8
+ from gitlab.base import RESTObject
7
9
  from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
8
10
  from gitlab.types import RequiredOptional
9
11
 
10
- __all__ = [
11
- "Topic",
12
- "TopicManager",
13
- ]
12
+ __all__ = ["Topic", "TopicManager"]
14
13
 
15
14
 
16
15
  class Topic(SaveMixin, ObjectDeleteMixin, RESTObject):
17
16
  pass
18
17
 
19
18
 
20
- class TopicManager(CRUDMixin, RESTManager):
19
+ class TopicManager(CRUDMixin[Topic]):
21
20
  _path = "/topics"
22
21
  _obj_cls = Topic
23
22
  _create_attrs = RequiredOptional(
@@ -29,20 +28,13 @@ class TopicManager(CRUDMixin, RESTManager):
29
28
  _update_attrs = RequiredOptional(optional=("avatar", "description", "name"))
30
29
  _types = {"avatar": types.ImageAttribute}
31
30
 
32
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Topic:
33
- return cast(Topic, super().get(id=id, lazy=lazy, **kwargs))
34
-
35
31
  @cli.register_custom_action(
36
- cls_names="TopicManager",
37
- required=("source_topic_id", "target_topic_id"),
32
+ cls_names="TopicManager", required=("source_topic_id", "target_topic_id")
38
33
  )
39
34
  @exc.on_http_error(exc.GitlabMRClosedError)
40
35
  def merge(
41
- self,
42
- source_topic_id: Union[int, str],
43
- target_topic_id: Union[int, str],
44
- **kwargs: Any,
45
- ) -> Dict[str, Any]:
36
+ self, source_topic_id: int | str, target_topic_id: int | str, **kwargs: Any
37
+ ) -> dict[str, Any]:
46
38
  """Merge two topics, assigning all projects to the target topic.
47
39
 
48
40
  Args:
@@ -58,10 +50,7 @@ class TopicManager(CRUDMixin, RESTManager):
58
50
  The merged topic data (*not* a RESTObject)
59
51
  """
60
52
  path = f"{self.path}/merge"
61
- data = {
62
- "source_topic_id": source_topic_id,
63
- "target_topic_id": target_topic_id,
64
- }
53
+ data = {"source_topic_id": source_topic_id, "target_topic_id": target_topic_id}
65
54
 
66
55
  server_data = self.gitlab.http_post(path, post_data=data, **kwargs)
67
56
  if TYPE_CHECKING:
@@ -1,27 +1,17 @@
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
 
7
- __all__ = [
8
- "ProjectTrigger",
9
- "ProjectTriggerManager",
10
- ]
5
+ __all__ = ["ProjectTrigger", "ProjectTriggerManager"]
11
6
 
12
7
 
13
8
  class ProjectTrigger(SaveMixin, ObjectDeleteMixin, RESTObject):
14
9
  pass
15
10
 
16
11
 
17
- class ProjectTriggerManager(CRUDMixin, RESTManager):
12
+ class ProjectTriggerManager(CRUDMixin[ProjectTrigger]):
18
13
  _path = "/projects/{project_id}/triggers"
19
14
  _obj_cls = ProjectTrigger
20
15
  _from_parent_attrs = {"project_id": "id"}
21
16
  _create_attrs = RequiredOptional(required=("description",))
22
17
  _update_attrs = RequiredOptional(required=("description",))
23
-
24
- def get(
25
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
26
- ) -> ProjectTrigger:
27
- return cast(ProjectTrigger, super().get(id=id, lazy=lazy, **kwargs))