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
@@ -4,14 +4,16 @@ https://docs.gitlab.com/ee/api/users.html
4
4
  https://docs.gitlab.com/ee/api/projects.html#list-projects-starred-by-a-user
5
5
  """
6
6
 
7
- from typing import Any, cast, Dict, List, Optional, Union
7
+ from __future__ import annotations
8
+
9
+ from typing import Any, cast, Literal, Optional, overload
8
10
 
9
11
  import requests
10
12
 
11
13
  from gitlab import cli
12
14
  from gitlab import exceptions as exc
13
15
  from gitlab import types
14
- from gitlab.base import RESTManager, RESTObject, RESTObjectList
16
+ from gitlab.base import RESTObject, RESTObjectList
15
17
  from gitlab.mixins import (
16
18
  CreateMixin,
17
19
  CRUDMixin,
@@ -73,52 +75,49 @@ class CurrentUserEmail(ObjectDeleteMixin, RESTObject):
73
75
  _repr_attr = "email"
74
76
 
75
77
 
76
- class CurrentUserEmailManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManager):
78
+ class CurrentUserEmailManager(
79
+ RetrieveMixin[CurrentUserEmail],
80
+ CreateMixin[CurrentUserEmail],
81
+ DeleteMixin[CurrentUserEmail],
82
+ ):
77
83
  _path = "/user/emails"
78
84
  _obj_cls = CurrentUserEmail
79
85
  _create_attrs = RequiredOptional(required=("email",))
80
86
 
81
- def get(
82
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
83
- ) -> CurrentUserEmail:
84
- return cast(CurrentUserEmail, super().get(id=id, lazy=lazy, **kwargs))
85
-
86
87
 
87
88
  class CurrentUserGPGKey(ObjectDeleteMixin, RESTObject):
88
89
  pass
89
90
 
90
91
 
91
- class CurrentUserGPGKeyManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManager):
92
+ class CurrentUserGPGKeyManager(
93
+ RetrieveMixin[CurrentUserGPGKey],
94
+ CreateMixin[CurrentUserGPGKey],
95
+ DeleteMixin[CurrentUserGPGKey],
96
+ ):
92
97
  _path = "/user/gpg_keys"
93
98
  _obj_cls = CurrentUserGPGKey
94
99
  _create_attrs = RequiredOptional(required=("key",))
95
100
 
96
- def get(
97
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
98
- ) -> CurrentUserGPGKey:
99
- return cast(CurrentUserGPGKey, super().get(id=id, lazy=lazy, **kwargs))
100
-
101
101
 
102
102
  class CurrentUserKey(ObjectDeleteMixin, RESTObject):
103
103
  _repr_attr = "title"
104
104
 
105
105
 
106
- class CurrentUserKeyManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManager):
106
+ class CurrentUserKeyManager(
107
+ RetrieveMixin[CurrentUserKey],
108
+ CreateMixin[CurrentUserKey],
109
+ DeleteMixin[CurrentUserKey],
110
+ ):
107
111
  _path = "/user/keys"
108
112
  _obj_cls = CurrentUserKey
109
113
  _create_attrs = RequiredOptional(required=("title", "key"))
110
114
 
111
- def get(
112
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
113
- ) -> CurrentUserKey:
114
- return cast(CurrentUserKey, super().get(id=id, lazy=lazy, **kwargs))
115
-
116
115
 
117
116
  class CurrentUserRunner(RESTObject):
118
117
  pass
119
118
 
120
119
 
121
- class CurrentUserRunnerManager(CreateMixin, RESTManager):
120
+ class CurrentUserRunnerManager(CreateMixin[CurrentUserRunner]):
122
121
  _path = "/user/runners"
123
122
  _obj_cls = CurrentUserRunner
124
123
  _types = {"tag_list": types.CommaSeparatedListAttribute}
@@ -144,14 +143,13 @@ class CurrentUserStatus(SaveMixin, RESTObject):
144
143
  _repr_attr = "message"
145
144
 
146
145
 
147
- class CurrentUserStatusManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
146
+ class CurrentUserStatusManager(
147
+ GetWithoutIdMixin[CurrentUserStatus], UpdateMixin[CurrentUserStatus]
148
+ ):
148
149
  _path = "/user/status"
149
150
  _obj_cls = CurrentUserStatus
150
151
  _update_attrs = RequiredOptional(optional=("emoji", "message"))
151
152
 
152
- def get(self, **kwargs: Any) -> CurrentUserStatus:
153
- return cast(CurrentUserStatus, super().get(**kwargs))
154
-
155
153
 
156
154
  class CurrentUser(RESTObject):
157
155
  _id_attr = None
@@ -164,35 +162,32 @@ class CurrentUser(RESTObject):
164
162
  status: CurrentUserStatusManager
165
163
 
166
164
 
167
- class CurrentUserManager(GetWithoutIdMixin, RESTManager):
165
+ class CurrentUserManager(GetWithoutIdMixin[CurrentUser]):
168
166
  _path = "/user"
169
167
  _obj_cls = CurrentUser
170
168
 
171
- def get(self, **kwargs: Any) -> CurrentUser:
172
- return cast(CurrentUser, super().get(**kwargs))
173
-
174
169
 
175
170
  class User(SaveMixin, ObjectDeleteMixin, RESTObject):
176
171
  _repr_attr = "username"
177
172
 
178
173
  customattributes: UserCustomAttributeManager
179
- emails: "UserEmailManager"
174
+ emails: UserEmailManager
180
175
  events: UserEventManager
181
- followers_users: "UserFollowersManager"
182
- following_users: "UserFollowingManager"
183
- gpgkeys: "UserGPGKeyManager"
184
- identityproviders: "UserIdentityProviderManager"
185
- impersonationtokens: "UserImpersonationTokenManager"
186
- keys: "UserKeyManager"
187
- memberships: "UserMembershipManager"
176
+ followers_users: UserFollowersManager
177
+ following_users: UserFollowingManager
178
+ gpgkeys: UserGPGKeyManager
179
+ identityproviders: UserIdentityProviderManager
180
+ impersonationtokens: UserImpersonationTokenManager
181
+ keys: UserKeyManager
182
+ memberships: UserMembershipManager
188
183
  personal_access_tokens: UserPersonalAccessTokenManager
189
- projects: "UserProjectManager"
190
- starred_projects: "StarredProjectManager"
191
- status: "UserStatusManager"
184
+ projects: UserProjectManager
185
+ starred_projects: StarredProjectManager
186
+ status: UserStatusManager
192
187
 
193
188
  @cli.register_custom_action(cls_names="User")
194
189
  @exc.on_http_error(exc.GitlabBlockError)
195
- def block(self, **kwargs: Any) -> Optional[bool]:
190
+ def block(self, **kwargs: Any) -> bool | None:
196
191
  """Block the user.
197
192
 
198
193
  Args:
@@ -217,7 +212,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
217
212
 
218
213
  @cli.register_custom_action(cls_names="User")
219
214
  @exc.on_http_error(exc.GitlabFollowError)
220
- def follow(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
215
+ def follow(self, **kwargs: Any) -> dict[str, Any] | requests.Response:
221
216
  """Follow the user.
222
217
 
223
218
  Args:
@@ -235,7 +230,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
235
230
 
236
231
  @cli.register_custom_action(cls_names="User")
237
232
  @exc.on_http_error(exc.GitlabUnfollowError)
238
- def unfollow(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
233
+ def unfollow(self, **kwargs: Any) -> dict[str, Any] | requests.Response:
239
234
  """Unfollow the user.
240
235
 
241
236
  Args:
@@ -253,7 +248,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
253
248
 
254
249
  @cli.register_custom_action(cls_names="User")
255
250
  @exc.on_http_error(exc.GitlabUnblockError)
256
- def unblock(self, **kwargs: Any) -> Optional[bool]:
251
+ def unblock(self, **kwargs: Any) -> bool | None:
257
252
  """Unblock the user.
258
253
 
259
254
  Args:
@@ -278,7 +273,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
278
273
 
279
274
  @cli.register_custom_action(cls_names="User")
280
275
  @exc.on_http_error(exc.GitlabDeactivateError)
281
- def deactivate(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
276
+ def deactivate(self, **kwargs: Any) -> dict[str, Any] | requests.Response:
282
277
  """Deactivate the user.
283
278
 
284
279
  Args:
@@ -299,7 +294,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
299
294
 
300
295
  @cli.register_custom_action(cls_names="User")
301
296
  @exc.on_http_error(exc.GitlabActivateError)
302
- def activate(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
297
+ def activate(self, **kwargs: Any) -> dict[str, Any] | requests.Response:
303
298
  """Activate the user.
304
299
 
305
300
  Args:
@@ -320,7 +315,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
320
315
 
321
316
  @cli.register_custom_action(cls_names="User")
322
317
  @exc.on_http_error(exc.GitlabUserApproveError)
323
- def approve(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
318
+ def approve(self, **kwargs: Any) -> dict[str, Any] | requests.Response:
324
319
  """Approve a user creation request.
325
320
 
326
321
  Args:
@@ -338,7 +333,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
338
333
 
339
334
  @cli.register_custom_action(cls_names="User")
340
335
  @exc.on_http_error(exc.GitlabUserRejectError)
341
- def reject(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
336
+ def reject(self, **kwargs: Any) -> dict[str, Any] | requests.Response:
342
337
  """Reject a user creation request.
343
338
 
344
339
  Args:
@@ -356,7 +351,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
356
351
 
357
352
  @cli.register_custom_action(cls_names="User")
358
353
  @exc.on_http_error(exc.GitlabBanError)
359
- def ban(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
354
+ def ban(self, **kwargs: Any) -> dict[str, Any] | requests.Response:
360
355
  """Ban the user.
361
356
 
362
357
  Args:
@@ -377,7 +372,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
377
372
 
378
373
  @cli.register_custom_action(cls_names="User")
379
374
  @exc.on_http_error(exc.GitlabUnbanError)
380
- def unban(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
375
+ def unban(self, **kwargs: Any) -> dict[str, Any] | requests.Response:
381
376
  """Unban the user.
382
377
 
383
378
  Args:
@@ -397,7 +392,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject):
397
392
  return server_data
398
393
 
399
394
 
400
- class UserManager(CRUDMixin, RESTManager):
395
+ class UserManager(CRUDMixin[User]):
401
396
  _path = "/users"
402
397
  _obj_cls = User
403
398
 
@@ -439,7 +434,7 @@ class UserManager(CRUDMixin, RESTManager):
439
434
  "private_profile",
440
435
  "color_scheme_id",
441
436
  "theme_id",
442
- ),
437
+ )
443
438
  )
444
439
  _update_attrs = RequiredOptional(
445
440
  required=("email", "username", "name"),
@@ -468,15 +463,12 @@ class UserManager(CRUDMixin, RESTManager):
468
463
  )
469
464
  _types = {"confirm": types.LowercaseStringAttribute, "avatar": types.ImageAttribute}
470
465
 
471
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> User:
472
- return cast(User, super().get(id=id, lazy=lazy, **kwargs))
473
-
474
466
 
475
467
  class ProjectUser(RESTObject):
476
468
  pass
477
469
 
478
470
 
479
- class ProjectUserManager(ListMixin, RESTManager):
471
+ class ProjectUserManager(ListMixin[ProjectUser]):
480
472
  _path = "/projects/{project_id}/users"
481
473
  _obj_cls = ProjectUser
482
474
  _from_parent_attrs = {"project_id": "id"}
@@ -488,15 +480,14 @@ class UserEmail(ObjectDeleteMixin, RESTObject):
488
480
  _repr_attr = "email"
489
481
 
490
482
 
491
- class UserEmailManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManager):
483
+ class UserEmailManager(
484
+ RetrieveMixin[UserEmail], CreateMixin[UserEmail], DeleteMixin[UserEmail]
485
+ ):
492
486
  _path = "/users/{user_id}/emails"
493
487
  _obj_cls = UserEmail
494
488
  _from_parent_attrs = {"user_id": "id"}
495
489
  _create_attrs = RequiredOptional(required=("email",))
496
490
 
497
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> UserEmail:
498
- return cast(UserEmail, super().get(id=id, lazy=lazy, **kwargs))
499
-
500
491
 
501
492
  class UserActivities(RESTObject):
502
493
  _id_attr = "username"
@@ -507,16 +498,13 @@ class UserStatus(RESTObject):
507
498
  _repr_attr = "message"
508
499
 
509
500
 
510
- class UserStatusManager(GetWithoutIdMixin, RESTManager):
501
+ class UserStatusManager(GetWithoutIdMixin[UserStatus]):
511
502
  _path = "/users/{user_id}/status"
512
503
  _obj_cls = UserStatus
513
504
  _from_parent_attrs = {"user_id": "id"}
514
505
 
515
- def get(self, **kwargs: Any) -> UserStatus:
516
- return cast(UserStatus, super().get(**kwargs))
517
506
 
518
-
519
- class UserActivitiesManager(ListMixin, RESTManager):
507
+ class UserActivitiesManager(ListMixin[UserActivities]):
520
508
  _path = "/user/activities"
521
509
  _obj_cls = UserActivities
522
510
 
@@ -525,31 +513,29 @@ class UserGPGKey(ObjectDeleteMixin, RESTObject):
525
513
  pass
526
514
 
527
515
 
528
- class UserGPGKeyManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManager):
516
+ class UserGPGKeyManager(
517
+ RetrieveMixin[UserGPGKey], CreateMixin[UserGPGKey], DeleteMixin[UserGPGKey]
518
+ ):
529
519
  _path = "/users/{user_id}/gpg_keys"
530
520
  _obj_cls = UserGPGKey
531
521
  _from_parent_attrs = {"user_id": "id"}
532
522
  _create_attrs = RequiredOptional(required=("key",))
533
523
 
534
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> UserGPGKey:
535
- return cast(UserGPGKey, super().get(id=id, lazy=lazy, **kwargs))
536
-
537
524
 
538
525
  class UserKey(ObjectDeleteMixin, RESTObject):
539
526
  pass
540
527
 
541
528
 
542
- class UserKeyManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManager):
529
+ class UserKeyManager(
530
+ RetrieveMixin[UserKey], CreateMixin[UserKey], DeleteMixin[UserKey]
531
+ ):
543
532
  _path = "/users/{user_id}/keys"
544
533
  _obj_cls = UserKey
545
534
  _from_parent_attrs = {"user_id": "id"}
546
535
  _create_attrs = RequiredOptional(required=("title", "key"))
547
536
 
548
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> UserKey:
549
- return cast(UserKey, super().get(id=id, lazy=lazy, **kwargs))
550
-
551
537
 
552
- class UserIdentityProviderManager(DeleteMixin, RESTManager):
538
+ class UserIdentityProviderManager(DeleteMixin[User]):
553
539
  """Manager for user identities.
554
540
 
555
541
  This manager does not actually manage objects but enables
@@ -557,6 +543,7 @@ class UserIdentityProviderManager(DeleteMixin, RESTManager):
557
543
  """
558
544
 
559
545
  _path = "/users/{user_id}/identities"
546
+ _obj_cls = User
560
547
  _from_parent_attrs = {"user_id": "id"}
561
548
 
562
549
 
@@ -564,7 +551,7 @@ class UserImpersonationToken(ObjectDeleteMixin, RESTObject):
564
551
  pass
565
552
 
566
553
 
567
- class UserImpersonationTokenManager(NoUpdateMixin, RESTManager):
554
+ class UserImpersonationTokenManager(NoUpdateMixin[UserImpersonationToken]):
568
555
  _path = "/users/{user_id}/impersonation_tokens"
569
556
  _obj_cls = UserImpersonationToken
570
557
  _from_parent_attrs = {"user_id": "id"}
@@ -574,34 +561,24 @@ class UserImpersonationTokenManager(NoUpdateMixin, RESTManager):
574
561
  _list_filters = ("state",)
575
562
  _types = {"scopes": ArrayAttribute}
576
563
 
577
- def get(
578
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
579
- ) -> UserImpersonationToken:
580
- return cast(UserImpersonationToken, super().get(id=id, lazy=lazy, **kwargs))
581
-
582
564
 
583
565
  class UserMembership(RESTObject):
584
566
  _id_attr = "source_id"
585
567
 
586
568
 
587
- class UserMembershipManager(RetrieveMixin, RESTManager):
569
+ class UserMembershipManager(RetrieveMixin[UserMembership]):
588
570
  _path = "/users/{user_id}/memberships"
589
571
  _obj_cls = UserMembership
590
572
  _from_parent_attrs = {"user_id": "id"}
591
573
  _list_filters = ("type",)
592
574
 
593
- def get(
594
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
595
- ) -> UserMembership:
596
- return cast(UserMembership, super().get(id=id, lazy=lazy, **kwargs))
597
-
598
575
 
599
576
  # Having this outside projects avoids circular imports due to ProjectUser
600
577
  class UserProject(RESTObject):
601
578
  pass
602
579
 
603
580
 
604
- class UserProjectManager(ListMixin, CreateMixin, RESTManager):
581
+ class UserProjectManager(ListMixin[UserProject], CreateMixin[UserProject]):
605
582
  _path = "/projects/user/{user_id}"
606
583
  _obj_cls = UserProject
607
584
  _from_parent_attrs = {"user_id": "id"}
@@ -646,11 +623,28 @@ class UserProjectManager(ListMixin, CreateMixin, RESTManager):
646
623
  "id_before",
647
624
  )
648
625
 
649
- def list(self, **kwargs: Any) -> Union[RESTObjectList, List[RESTObject]]:
626
+ @overload
627
+ def list(
628
+ self, *, iterator: Literal[False] = False, **kwargs: Any
629
+ ) -> list[UserProject]: ...
630
+
631
+ @overload
632
+ def list(
633
+ self, *, iterator: Literal[True] = True, **kwargs: Any
634
+ ) -> RESTObjectList[UserProject]: ...
635
+
636
+ @overload
637
+ def list(
638
+ self, *, iterator: bool = False, **kwargs: Any
639
+ ) -> RESTObjectList[UserProject] | list[UserProject]: ...
640
+
641
+ def list(
642
+ self, *, iterator: bool = False, **kwargs: Any
643
+ ) -> RESTObjectList[UserProject] | list[UserProject]:
650
644
  """Retrieve a list of objects.
651
645
 
652
646
  Args:
653
- all: If True, return all the items, without pagination
647
+ get_all: If True, return all the items, without pagination
654
648
  per_page: Number of items to retrieve per request
655
649
  page: ID of the page to return (starts with page 1)
656
650
  iterator: If set to True and no pagination option is
@@ -668,14 +662,14 @@ class UserProjectManager(ListMixin, CreateMixin, RESTManager):
668
662
  path = f"/users/{self._parent.id}/projects"
669
663
  else:
670
664
  path = f"/users/{self._from_parent_attrs['user_id']}/projects"
671
- return ListMixin.list(self, path=path, **kwargs)
665
+ return super().list(path=path, iterator=iterator, **kwargs)
672
666
 
673
667
 
674
668
  class StarredProject(RESTObject):
675
669
  pass
676
670
 
677
671
 
678
- class StarredProjectManager(ListMixin, RESTManager):
672
+ class StarredProjectManager(ListMixin[StarredProject]):
679
673
  _path = "/users/{user_id}/starred_projects"
680
674
  _obj_cls = StarredProject
681
675
  _from_parent_attrs = {"user_id": "id"}
@@ -697,13 +691,13 @@ class StarredProjectManager(ListMixin, RESTManager):
697
691
  )
698
692
 
699
693
 
700
- class UserFollowersManager(ListMixin, RESTManager):
694
+ class UserFollowersManager(ListMixin[User]):
701
695
  _path = "/users/{user_id}/followers"
702
696
  _obj_cls = User
703
697
  _from_parent_attrs = {"user_id": "id"}
704
698
 
705
699
 
706
- class UserFollowingManager(ListMixin, RESTManager):
700
+ class UserFollowingManager(ListMixin[User]):
707
701
  _path = "/users/{user_id}/following"
708
702
  _obj_cls = User
709
703
  _from_parent_attrs = {"user_id": "id"}
@@ -5,9 +5,7 @@ https://docs.gitlab.com/ee/api/project_level_variables.html
5
5
  https://docs.gitlab.com/ee/api/group_level_variables.html
6
6
  """
7
7
 
8
- from typing import Any, cast, Union
9
-
10
- from gitlab.base import RESTManager, RESTObject
8
+ from gitlab.base import RESTObject
11
9
  from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
12
10
  from gitlab.types import RequiredOptional
13
11
 
@@ -25,7 +23,7 @@ class Variable(SaveMixin, ObjectDeleteMixin, RESTObject):
25
23
  _id_attr = "key"
26
24
 
27
25
 
28
- class VariableManager(CRUDMixin, RESTManager):
26
+ class VariableManager(CRUDMixin[Variable]):
29
27
  _path = "/admin/ci/variables"
30
28
  _obj_cls = Variable
31
29
  _create_attrs = RequiredOptional(
@@ -35,15 +33,12 @@ class VariableManager(CRUDMixin, RESTManager):
35
33
  required=("key", "value"), optional=("protected", "variable_type", "masked")
36
34
  )
37
35
 
38
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Variable:
39
- return cast(Variable, super().get(id=id, lazy=lazy, **kwargs))
40
-
41
36
 
42
37
  class GroupVariable(SaveMixin, ObjectDeleteMixin, RESTObject):
43
38
  _id_attr = "key"
44
39
 
45
40
 
46
- class GroupVariableManager(CRUDMixin, RESTManager):
41
+ class GroupVariableManager(CRUDMixin[GroupVariable]):
47
42
  _path = "/groups/{group_id}/variables"
48
43
  _obj_cls = GroupVariable
49
44
  _from_parent_attrs = {"group_id": "id"}
@@ -54,17 +49,12 @@ class GroupVariableManager(CRUDMixin, RESTManager):
54
49
  required=("key", "value"), optional=("protected", "variable_type", "masked")
55
50
  )
56
51
 
57
- def get(
58
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
59
- ) -> GroupVariable:
60
- return cast(GroupVariable, super().get(id=id, lazy=lazy, **kwargs))
61
-
62
52
 
63
53
  class ProjectVariable(SaveMixin, ObjectDeleteMixin, RESTObject):
64
54
  _id_attr = "key"
65
55
 
66
56
 
67
- class ProjectVariableManager(CRUDMixin, RESTManager):
57
+ class ProjectVariableManager(CRUDMixin[ProjectVariable]):
68
58
  _path = "/projects/{project_id}/variables"
69
59
  _obj_cls = ProjectVariable
70
60
  _from_parent_attrs = {"project_id": "id"}
@@ -76,8 +66,3 @@ class ProjectVariableManager(CRUDMixin, RESTManager):
76
66
  required=("key", "value"),
77
67
  optional=("protected", "variable_type", "masked", "environment_scope"),
78
68
  )
79
-
80
- def get(
81
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
82
- ) -> ProjectVariable:
83
- return cast(ProjectVariable, super().get(id=id, lazy=lazy, **kwargs))
@@ -1,15 +1,8 @@
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, UploadMixin
5
3
  from gitlab.types import RequiredOptional
6
4
 
7
- __all__ = [
8
- "ProjectWiki",
9
- "ProjectWikiManager",
10
- "GroupWiki",
11
- "GroupWikiManager",
12
- ]
5
+ __all__ = ["ProjectWiki", "ProjectWikiManager", "GroupWiki", "GroupWikiManager"]
13
6
 
14
7
 
15
8
  class ProjectWiki(SaveMixin, ObjectDeleteMixin, UploadMixin, RESTObject):
@@ -18,7 +11,7 @@ class ProjectWiki(SaveMixin, ObjectDeleteMixin, UploadMixin, RESTObject):
18
11
  _upload_path = "/projects/{project_id}/wikis/attachments"
19
12
 
20
13
 
21
- class ProjectWikiManager(CRUDMixin, RESTManager):
14
+ class ProjectWikiManager(CRUDMixin[ProjectWiki]):
22
15
  _path = "/projects/{project_id}/wikis"
23
16
  _obj_cls = ProjectWiki
24
17
  _from_parent_attrs = {"project_id": "id"}
@@ -28,11 +21,6 @@ class ProjectWikiManager(CRUDMixin, RESTManager):
28
21
  _update_attrs = RequiredOptional(optional=("title", "content", "format"))
29
22
  _list_filters = ("with_content",)
30
23
 
31
- def get(
32
- self, id: Union[str, int], lazy: bool = False, **kwargs: Any
33
- ) -> ProjectWiki:
34
- return cast(ProjectWiki, super().get(id=id, lazy=lazy, **kwargs))
35
-
36
24
 
37
25
  class GroupWiki(SaveMixin, ObjectDeleteMixin, UploadMixin, RESTObject):
38
26
  _id_attr = "slug"
@@ -40,7 +28,7 @@ class GroupWiki(SaveMixin, ObjectDeleteMixin, UploadMixin, RESTObject):
40
28
  _upload_path = "/groups/{group_id}/wikis/attachments"
41
29
 
42
30
 
43
- class GroupWikiManager(CRUDMixin, RESTManager):
31
+ class GroupWikiManager(CRUDMixin[GroupWiki]):
44
32
  _path = "/groups/{group_id}/wikis"
45
33
  _obj_cls = GroupWiki
46
34
  _from_parent_attrs = {"group_id": "id"}
@@ -49,6 +37,3 @@ class GroupWikiManager(CRUDMixin, RESTManager):
49
37
  )
50
38
  _update_attrs = RequiredOptional(optional=("title", "content", "format"))
51
39
  _list_filters = ("with_content",)
52
-
53
- def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> GroupWiki:
54
- return cast(GroupWiki, super().get(id=id, lazy=lazy, **kwargs))
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: python-gitlab
3
- Version: 5.5.0
3
+ Version: 6.0.0
4
4
  Summary: The python wrapper for the GitLab REST and GraphQL APIs.
5
5
  Author-email: Gauvain Pocentek <gauvain@pocentek.net>
6
6
  Maintainer-email: John Villalovos <john@sodarock.com>, Max Wittig <max.wittig@siemens.com>, Nejc Habjan <nejc.habjan@siemens.com>, Roger Meier <r.meier@siemens.com>
@@ -36,6 +36,7 @@ Provides-Extra: yaml
36
36
  Requires-Dist: PyYaml>=6.0.1; extra == "yaml"
37
37
  Provides-Extra: graphql
38
38
  Requires-Dist: gql[httpx]<4,>=3.5.0; extra == "graphql"
39
+ Dynamic: license-file
39
40
 
40
41
  python-gitlab
41
42
  =============