python-gitlab 4.11.0__py3-none-any.whl → 4.12.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.
gitlab/_version.py CHANGED
@@ -3,4 +3,4 @@ __copyright__ = "Copyright 2013-2019 Gauvain Pocentek, 2019-2023 python-gitlab t
3
3
  __email__ = "gauvainpocentek@gmail.com"
4
4
  __license__ = "LGPL3"
5
5
  __title__ = "python-gitlab"
6
- __version__ = "4.11.0"
6
+ __version__ = "4.12.0"
gitlab/client.py CHANGED
@@ -1,5 +1,7 @@
1
1
  """Wrapper for the GitLab API."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import os
4
6
  import re
5
7
  from typing import (
@@ -2,11 +2,11 @@ import base64
2
2
  from typing import (
3
3
  Any,
4
4
  Callable,
5
- cast,
6
5
  Dict,
7
6
  Iterator,
8
7
  List,
9
8
  Optional,
9
+ Tuple,
10
10
  TYPE_CHECKING,
11
11
  Union,
12
12
  )
@@ -20,7 +20,6 @@ from gitlab.base import RESTManager, RESTObject
20
20
  from gitlab.mixins import (
21
21
  CreateMixin,
22
22
  DeleteMixin,
23
- GetMixin,
24
23
  ObjectDeleteMixin,
25
24
  SaveMixin,
26
25
  UpdateMixin,
@@ -96,10 +95,11 @@ class ProjectFile(SaveMixin, ObjectDeleteMixin, RESTObject):
96
95
  self.manager.delete(file_path, branch, commit_message, **kwargs)
97
96
 
98
97
 
99
- class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTManager):
98
+ class ProjectFileManager(CreateMixin, UpdateMixin, DeleteMixin, RESTManager):
100
99
  _path = "/projects/{project_id}/repository/files"
101
100
  _obj_cls = ProjectFile
102
101
  _from_parent_attrs = {"project_id": "id"}
102
+ _optional_get_attrs: Tuple[str, ...] = ()
103
103
  _create_attrs = RequiredOptional(
104
104
  required=("file_path", "branch", "content", "commit_message"),
105
105
  optional=("encoding", "author_email", "author_name"),
@@ -112,11 +112,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa
112
112
  @cli.register_custom_action(
113
113
  cls_names="ProjectFileManager", required=("file_path", "ref")
114
114
  )
115
- # NOTE(jlvillal): Signature doesn't match UpdateMixin.update() so ignore
116
- # type error
117
- def get( # type: ignore
118
- self, file_path: str, ref: str, **kwargs: Any
119
- ) -> ProjectFile:
115
+ def get(self, file_path: str, ref: str, **kwargs: Any) -> ProjectFile:
120
116
  """Retrieve a single file.
121
117
 
122
118
  Args:
@@ -131,7 +127,37 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa
131
127
  Returns:
132
128
  The generated RESTObject
133
129
  """
134
- return cast(ProjectFile, GetMixin.get(self, file_path, ref=ref, **kwargs))
130
+ if TYPE_CHECKING:
131
+ assert file_path is not None
132
+ file_path = utils.EncodedId(file_path)
133
+ path = f"{self.path}/{file_path}"
134
+ server_data = self.gitlab.http_get(path, ref=ref, **kwargs)
135
+ if TYPE_CHECKING:
136
+ assert isinstance(server_data, dict)
137
+ return self._obj_cls(self, server_data)
138
+
139
+ def head(
140
+ self, file_path: str, ref: str, **kwargs: Any
141
+ ) -> "requests.structures.CaseInsensitiveDict[Any]":
142
+ """Retrieve just metadata for a single file.
143
+
144
+ Args:
145
+ file_path: Path of the file to retrieve
146
+ ref: Name of the branch, tag or commit
147
+ **kwargs: Extra options to send to the server (e.g. sudo)
148
+
149
+ Raises:
150
+ GitlabAuthenticationError: If authentication is not correct
151
+ GitlabGetError: If the file could not be retrieved
152
+
153
+ Returns:
154
+ The response headers as a dictionary
155
+ """
156
+ if TYPE_CHECKING:
157
+ assert file_path is not None
158
+ file_path = utils.EncodedId(file_path)
159
+ path = f"{self.path}/{file_path}"
160
+ return self.gitlab.http_head(path, ref=ref, **kwargs)
135
161
 
136
162
  @cli.register_custom_action(
137
163
  cls_names="ProjectFileManager",
@@ -197,6 +197,35 @@ class ProjectMergeRequest(
197
197
  assert isinstance(server_data, dict)
198
198
  return server_data
199
199
 
200
+ @cli.register_custom_action(cls_names="ProjectMergeRequest")
201
+ @exc.on_http_error(exc.GitlabListError)
202
+ def related_issues(self, **kwargs: Any) -> RESTObjectList:
203
+ """List issues related to this merge request."
204
+
205
+ Args:
206
+ all: If True, return all the items, without pagination
207
+ per_page: Number of items to retrieve per request
208
+ page: ID of the page to return (starts with page 1)
209
+ **kwargs: Extra options to send to the server (e.g. sudo)
210
+
211
+ Raises:
212
+ GitlabAuthenticationError: If authentication is not correct
213
+ GitlabListError: If the list could not be retrieved
214
+
215
+ Returns:
216
+ List of issues
217
+ """
218
+
219
+ path = f"{self.manager.path}/{self.encoded_id}/related_issues"
220
+ data_list = self.manager.gitlab.http_list(path, iterator=True, **kwargs)
221
+
222
+ if TYPE_CHECKING:
223
+ assert isinstance(data_list, gitlab.GitlabList)
224
+
225
+ manager = ProjectIssueManager(self.manager.gitlab, parent=self.manager._parent)
226
+
227
+ return RESTObjectList(manager, ProjectIssue, data_list)
228
+
200
229
  @cli.register_custom_action(cls_names="ProjectMergeRequest")
201
230
  @exc.on_http_error(exc.GitlabListError)
202
231
  def closes_issues(self, **kwargs: Any) -> RESTObjectList:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-gitlab
3
- Version: 4.11.0
3
+ Version: 4.12.0
4
4
  Summary: A python wrapper for the GitLab API
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>
@@ -1,9 +1,9 @@
1
1
  gitlab/__init__.py,sha256=DlY_IEbIbeTJnMfkcl4866XbJ_50UiaE4yI0PwOq36E,1406
2
2
  gitlab/__main__.py,sha256=HTesNl0UAU6mPb9EXWkTKMy6Q6pAUxGi3iPnDHTE2uE,68
3
- gitlab/_version.py,sha256=_ZHsoVye-Iaog0jEDXMthyNXtQA9GiK4pyR3vDJgPVM,250
3
+ gitlab/_version.py,sha256=IOGpK04HBxTS5beU4-UfYg-hcPK6MfnieMnyiyI-YE0,250
4
4
  gitlab/base.py,sha256=5cotawlHD01Vw88aN4o7wNIhDyk_bmcwubX4mbOpnVo,13780
5
5
  gitlab/cli.py,sha256=d3-LtZuA1Fgon5wZWn4c3E70fTIu4mM4Juyhh3F8EBs,12416
6
- gitlab/client.py,sha256=BCglR-5hrEQVEc7FdsfAT3u4_sIYQBkbdaEj2feDzPo,51181
6
+ gitlab/client.py,sha256=WK13AV69dJg-5dWIcYV51_ylExuZolrCGXSLHT1vDkU,51217
7
7
  gitlab/config.py,sha256=T1DgUXD0-MN2qNszrv-SO5d4uy0FITnNN0vWJgOt2yo,9088
8
8
  gitlab/const.py,sha256=rtPU-fxVSOvgpueoQVTvZGQp6iAZ-aa3nsY4RcSs_M4,5352
9
9
  gitlab/exceptions.py,sha256=VOQftPzEq5mpVj6vke7z6Xe4S7Yf_rDTab0lNHqf3AY,8390
@@ -45,7 +45,7 @@ gitlab/v4/objects/epics.py,sha256=HKLpEL7_K54M6prGjga3qw5VfI2ZGGxBbfz42Oumvr0,41
45
45
  gitlab/v4/objects/events.py,sha256=20yCSlR9XB75AwMzatmAt4VdT9PL2nX0t1p1sAWbrvI,7067
46
46
  gitlab/v4/objects/export_import.py,sha256=XVmrSq_qHwQr3XamFPfISEXnlBd-icJRm2CCa3V2puY,1909
47
47
  gitlab/v4/objects/features.py,sha256=N7T52I2JyNIgD1JejrSr8fNa14ZlAUxrS2VceUekhj0,1973
48
- gitlab/v4/objects/files.py,sha256=9M7pocu_n9JDRAPu5BqIt398emYD5WVnGh3wAJinPX8,10608
48
+ gitlab/v4/objects/files.py,sha256=g4tME-muYjaCAmOc4NvwovKcQAqVEhV8JRKKvSHc9pA,11587
49
49
  gitlab/v4/objects/geo_nodes.py,sha256=tD9piU7OIZgbNQRUeLTFPtAJ6PVL_SI6tR_zh6Tm2M8,3686
50
50
  gitlab/v4/objects/group_access_tokens.py,sha256=EijY0sfsp0Gtx_q4JLBeLL3jphx5b_6-nTzKxV272jc,1023
51
51
  gitlab/v4/objects/groups.py,sha256=YxOeaRYUjhu8PicCicVT7Eua04YuyOLAc8J13V7r9Gg,15958
@@ -61,7 +61,7 @@ gitlab/v4/objects/labels.py,sha256=JvOciJ6V76pF9HuJp5OT_Ykq8oqaa6ItxvpKf3hiEzs,4
61
61
  gitlab/v4/objects/ldap.py,sha256=adpkdfk7VBjshuh8SpCsc77Pax4QgqCx1N12CuzitDE,1662
62
62
  gitlab/v4/objects/members.py,sha256=YJO9MaqlCSUnozHIlI7MfSlcWTju4xRmW8QIlEiBmok,3902
63
63
  gitlab/v4/objects/merge_request_approvals.py,sha256=oPZFd4AUtrAVhBTa0iM4krNkk2UTNOTw_MWlEWo2HAQ,6400
64
- gitlab/v4/objects/merge_requests.py,sha256=tpFCMmTVWyL9X7HtUoZuHJP4MVZUz1kk9-Bv-SbnwfU,17422
64
+ gitlab/v4/objects/merge_requests.py,sha256=GftA_42h4zyS7LG7-lmf4wG5gJPHkYqQwPXFB-Sywxs,18532
65
65
  gitlab/v4/objects/merge_trains.py,sha256=e0Gp2Ri75elcG_r9w8qxdrcWW_YiebPRwUYIH5od8kc,422
66
66
  gitlab/v4/objects/milestones.py,sha256=LHAGYJlTm2ed3eqv4mTO-QZ7vRbwGXRFpre_G4gHdKY,7073
67
67
  gitlab/v4/objects/namespaces.py,sha256=5_km8RP_OLZoRm6u-p53S2AM5UsHyJ4j65fi5fGIoLo,1535
@@ -95,10 +95,10 @@ gitlab/v4/objects/triggers.py,sha256=UAERq_C-QdPBbBQPHLh5IfhpkdDeIxdnVGPHfu9Qy5Y
95
95
  gitlab/v4/objects/users.py,sha256=_gGrTwcE17jeoXIPgfFSv54jtF1_9C1R0Y0hhssTvXY,21381
96
96
  gitlab/v4/objects/variables.py,sha256=S0Vz32jEpUbo4J2js8gMPPTVpcy1ge5FYVHLiPz9c-A,2627
97
97
  gitlab/v4/objects/wikis.py,sha256=JtI1cQqZV1_PRfKVlQRMh4LZjdxEfi9T2VuFYv6PrV8,1775
98
- python_gitlab-4.11.0.dist-info/AUTHORS,sha256=Z0P61GJSVnp7iFbRcMezhx3f4zMyPkVmG--TWaRo768,526
99
- python_gitlab-4.11.0.dist-info/COPYING,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
100
- python_gitlab-4.11.0.dist-info/METADATA,sha256=iSsCzBj4kepfxKWEmWopKZuOmm7aWrbIW_0aIr156Fg,8311
101
- python_gitlab-4.11.0.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
102
- python_gitlab-4.11.0.dist-info/entry_points.txt,sha256=nhpKLLP_uQPFByn8UtE9zsvQQwa402t52o_Cw9IFXMo,43
103
- python_gitlab-4.11.0.dist-info/top_level.txt,sha256=MvIaP8p_Oaf4gO_hXmHkX-5y2deHLp1pe6tJR3ukQ6o,7
104
- python_gitlab-4.11.0.dist-info/RECORD,,
98
+ python_gitlab-4.12.0.dist-info/AUTHORS,sha256=Z0P61GJSVnp7iFbRcMezhx3f4zMyPkVmG--TWaRo768,526
99
+ python_gitlab-4.12.0.dist-info/COPYING,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
100
+ python_gitlab-4.12.0.dist-info/METADATA,sha256=5nvH5LY35tyQqVF3mYS-Pu6xXmS7WdJ3_FuDZiXNSl8,8311
101
+ python_gitlab-4.12.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
102
+ python_gitlab-4.12.0.dist-info/entry_points.txt,sha256=nhpKLLP_uQPFByn8UtE9zsvQQwa402t52o_Cw9IFXMo,43
103
+ python_gitlab-4.12.0.dist-info/top_level.txt,sha256=MvIaP8p_Oaf4gO_hXmHkX-5y2deHLp1pe6tJR3ukQ6o,7
104
+ python_gitlab-4.12.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5