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

Commit79e785e

Browse files
committed
docs: use annotations for return types
1 parentaf0cb4d commit79e785e

26 files changed

+99
-101
lines changed

‎gitlab/client.py‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,8 @@ def version(self) -> Tuple[str, str]:
269269
object.
270270
271271
Returns:
272-
tuple: The server version and server revision.
273-
('unknown', 'unknwown') if the server doesn't
274-
perform as expected.
272+
The server version and server revision.
273+
('unknown', 'unknown') if the server doesn't perform as expected.
275274
"""
276275
ifself._server_versionisNone:
277276
try:
@@ -301,8 +300,7 @@ def lint(self, content: str, **kwargs: Any) -> Tuple[bool, List[str]]:
301300
GitlabVerifyError: If the validation could not be done
302301
303302
Returns:
304-
tuple: (True, []) if the file is valid, (False, errors(list))
305-
otherwise
303+
(True, []) if the file is valid, (False, errors(list)) otherwise
306304
"""
307305
post_data= {"content":content}
308306
data=self.http_post("/ci/lint",post_data=post_data,**kwargs)
@@ -327,7 +325,7 @@ def markdown(
327325
GitlabMarkdownError: If the server cannot perform the request
328326
329327
Returns:
330-
str:The HTML rendering of the markdown text.
328+
The HTML rendering of the markdown text.
331329
"""
332330
post_data= {"text":text,"gfm":gfm}
333331
ifprojectisnotNone:
@@ -349,7 +347,7 @@ def get_license(self, **kwargs: Any) -> Dict[str, Any]:
349347
GitlabGetError: If the server cannot perform the request
350348
351349
Returns:
352-
dict:The current license information
350+
The current license information
353351
"""
354352
result=self.http_get("/license",**kwargs)
355353
ifisinstance(result,dict):
@@ -369,7 +367,7 @@ def set_license(self, license: str, **kwargs: Any) -> Dict[str, Any]:
369367
GitlabPostError: If the server cannot perform the request
370368
371369
Returns:
372-
dict:The new license information
370+
The new license information
373371
"""
374372
data= {"license":license}
375373
result=self.http_post("/license",post_data=data,**kwargs)
@@ -444,7 +442,7 @@ def _get_base_url(self, url: Optional[str] = None) -> str:
444442
"""Return the base URL with the trailing slash stripped.
445443
If the URL is a Falsy value, return the default URL.
446444
Returns:
447-
str:The base URL
445+
The base URL
448446
"""
449447
ifnoturl:
450448
returngitlab.const.DEFAULT_URL
@@ -458,7 +456,7 @@ def _build_url(self, path: str) -> str:
458456
it to the stored url.
459457
460458
Returns:
461-
str:The full URL
459+
The full URL
462460
"""
463461
ifpath.startswith("http://")orpath.startswith("https://"):
464462
returnpath
@@ -716,7 +714,7 @@ def http_list(
716714
per_page)
717715
718716
Returns:
719-
list:A list of the objects returned by the server. If `as_list` is
717+
A list of the objects returned by the server. If `as_list` is
720718
False and no pagination-related arguments (`page`, `per_page`,
721719
`all`) are defined then a GitlabList object (generator) is returned
722720
instead. This object will make API calls when needed to fetch the
@@ -874,7 +872,7 @@ def search(
874872
GitlabSearchError: If the server failed to perform the request
875873
876874
Returns:
877-
GitlabList:A list of dicts describing the resources found.
875+
A list of dicts describing the resources found.
878876
"""
879877
data= {"scope":scope,"search":search}
880878
returnself.http_list("/search",query_data=data,**kwargs)

‎gitlab/mixins.py‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def get(
9393
**kwargs: Extra options to send to the server (e.g. sudo)
9494
9595
Returns:
96-
object:The generated RESTObject.
96+
The generated RESTObject.
9797
9898
Raises:
9999
GitlabAuthenticationError: If authentication is not correct
@@ -134,7 +134,7 @@ def get(
134134
**kwargs: Extra options to send to the server (e.g. sudo)
135135
136136
Returns:
137-
object:The generated RESTObject
137+
The generated RESTObject
138138
139139
Raises:
140140
GitlabAuthenticationError: If authentication is not correct
@@ -207,7 +207,7 @@ def list(self, **kwargs: Any) -> Union[base.RESTObjectList, List[base.RESTObject
207207
**kwargs: Extra options to send to the server (e.g. sudo)
208208
209209
Returns:
210-
list:The list of objects, or a generator if `as_list` is False
210+
The list of objects, or a generator if `as_list` is False
211211
212212
Raises:
213213
GitlabAuthenticationError: If authentication is not correct
@@ -287,7 +287,7 @@ def create(
287287
**kwargs: Extra options to send to the server (e.g. sudo)
288288
289289
Returns:
290-
RESTObject: a new instance of the managed object class built with
290+
A new instance of the managed object class built with
291291
the data sent by the server
292292
293293
Raises:
@@ -357,7 +357,7 @@ def _get_update_method(
357357
"""Return the HTTP method to use.
358358
359359
Returns:
360-
object:http_put (default) or http_post
360+
http_put (default) or http_post
361361
"""
362362
ifself._update_uses_post:
363363
http_method=self.gitlab.http_post
@@ -380,7 +380,7 @@ def update(
380380
**kwargs: Extra options to send to the server (e.g. sudo)
381381
382382
Returns:
383-
dict:The new object data (*not* a RESTObject)
383+
The new object data (*not* a RESTObject)
384384
385385
Raises:
386386
GitlabAuthenticationError: If authentication is not correct
@@ -442,7 +442,7 @@ def set(self, key: str, value: str, **kwargs: Any) -> base.RESTObject:
442442
GitlabSetError: If an error occurred
443443
444444
Returns:
445-
obj:The created/updated attribute
445+
The created/updated attribute
446446
"""
447447
path=f"{self.path}/{utils.clean_str_id(key)}"
448448
data= {"value":value}
@@ -672,7 +672,7 @@ def download(
672672
GitlabGetError: If the server failed to perform the request
673673
674674
Returns:
675-
str:The blob content if streamed is False, None otherwise
675+
The blob content if streamed is False, None otherwise
676676
"""
677677
path=f"{self.manager.path}/download"
678678
result=self.manager.gitlab.http_get(
@@ -890,7 +890,7 @@ def participants(self, **kwargs: Any) -> Dict[str, Any]:
890890
GitlabListError: If the list could not be retrieved
891891
892892
Returns:
893-
RESTObjectList:The list of participants
893+
The list of participants
894894
"""
895895

896896
path=f"{self.manager.path}/{self.get_id()}/participants"
@@ -918,7 +918,7 @@ def render(self, link_url: str, image_url: str, **kwargs: Any) -> Dict[str, Any]
918918
GitlabRenderError: If the rendering failed
919919
920920
Returns:
921-
dict:The rendering properties
921+
The rendering properties
922922
"""
923923
path=f"{self.path}/render"
924924
data= {"link_url":link_url,"image_url":image_url}
@@ -943,7 +943,7 @@ def _get_update_method(
943943
"""Return the HTTP method to use.
944944
945945
Returns:
946-
object:http_put (default) or http_post
946+
http_put (default) or http_post
947947
"""
948948
ifself._update_uses_post:
949949
http_method=self.manager.gitlab.http_post
@@ -964,7 +964,7 @@ def promote(self, **kwargs: Any) -> Dict[str, Any]:
964964
GitlabParsingError: If the json data could not be parsed
965965
966966
Returns:
967-
dict:The updated object data (*not* a RESTObject)
967+
The updated object data (*not* a RESTObject)
968968
"""
969969

970970
path=f"{self.manager.path}/{self.id}/promote"

‎gitlab/v4/objects/appearance.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def update(
4848
**kwargs: Extra options to send to the server (e.g. sudo)
4949
5050
Returns:
51-
dict:The new object data (*not* a RESTObject)
51+
The new object data (*not* a RESTObject)
5252
5353
Raises:
5454
GitlabAuthenticationError: If authentication is not correct

‎gitlab/v4/objects/clusters.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def create(
5151
GitlabCreateError: If the server cannot perform the request
5252
5353
Returns:
54-
RESTObject:A new instance of the manage object class build with
55-
the data sent by the server
54+
A new instance of the manage object class build with
55+
the data sent by the server
5656
"""
5757
path=f"{self.path}/user"
5858
returncast(GroupCluster,CreateMixin.create(self,data,path=path,**kwargs))
@@ -102,8 +102,8 @@ def create(
102102
GitlabCreateError: If the server cannot perform the request
103103
104104
Returns:
105-
RESTObject:A new instance of the manage object class build with
106-
the data sent by the server
105+
A new instance of the manage object class build with
106+
the data sent by the server
107107
"""
108108
path=f"{self.path}/user"
109109
returncast(ProjectCluster,CreateMixin.create(self,data,path=path,**kwargs))

‎gitlab/v4/objects/commits.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def diff(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
3939
GitlabGetError: If the diff could not be retrieved
4040
4141
Returns:
42-
list:The changes done in this commit
42+
The changes done in this commit
4343
"""
4444
path=f"{self.manager.path}/{self.get_id()}/diff"
4545
returnself.manager.gitlab.http_get(path,**kwargs)
@@ -77,7 +77,7 @@ def refs(
7777
GitlabGetError: If the references could not be retrieved
7878
7979
Returns:
80-
list:The references the commit is pushed to.
80+
The references the commit is pushed to.
8181
"""
8282
path=f"{self.manager.path}/{self.get_id()}/refs"
8383
data= {"type":type}
@@ -96,7 +96,7 @@ def merge_requests(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Respon
9696
GitlabGetError: If the references could not be retrieved
9797
9898
Returns:
99-
list:The merge requests related to the commit.
99+
The merge requests related to the commit.
100100
"""
101101
path=f"{self.manager.path}/{self.get_id()}/merge_requests"
102102
returnself.manager.gitlab.http_get(path,**kwargs)
@@ -117,7 +117,7 @@ def revert(
117117
GitlabRevertError: If the revert could not be performed
118118
119119
Returns:
120-
dict:The new commit data (*not* a RESTObject)
120+
The new commit data (*not* a RESTObject)
121121
"""
122122
path=f"{self.manager.path}/{self.get_id()}/revert"
123123
post_data= {"branch":branch}
@@ -136,7 +136,7 @@ def signature(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
136136
GitlabGetError: If the signature could not be retrieved
137137
138138
Returns:
139-
dict:The commit's signature data
139+
The commit's signature data
140140
"""
141141
path=f"{self.manager.path}/{self.get_id()}/signature"
142142
returnself.manager.gitlab.http_get(path,**kwargs)
@@ -201,8 +201,8 @@ def create(
201201
GitlabCreateError: If the server cannot perform the request
202202
203203
Returns:
204-
RESTObject:A new instance of the manage object class build with
205-
the data sent by the server
204+
A new instance of the manage object class build with
205+
the data sent by the server
206206
"""
207207
# project_id and commit_id are in the data dict when using the CLI, but
208208
# they are missing when using only the API

‎gitlab/v4/objects/epics.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ def create(
101101
GitlabCreateError: If the server cannot perform the request
102102
103103
Returns:
104-
RESTObject:A new instance of the manage object class build with
105-
the data sent by the server
104+
A new instance of the manage object class build with
105+
the data sent by the server
106106
"""
107107
ifTYPE_CHECKING:
108108
assertdataisnotNone

‎gitlab/v4/objects/features.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def set(
5050
GitlabSetError: If an error occurred
5151
5252
Returns:
53-
obj:The created/updated attribute
53+
The created/updated attribute
5454
"""
5555
path=f"{self.path}/{name.replace('/','%2F')}"
5656
data= {

‎gitlab/v4/objects/files.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def get( # type: ignore
111111
GitlabGetError: If the file could not be retrieved
112112
113113
Returns:
114-
object:The generated RESTObject
114+
The generated RESTObject
115115
"""
116116
returncast(ProjectFile,GetMixin.get(self,file_path,ref=ref,**kwargs))
117117

@@ -132,7 +132,7 @@ def create(
132132
**kwargs: Extra options to send to the server (e.g. sudo)
133133
134134
Returns:
135-
RESTObject:a new instance of the managed object class built with
135+
a new instance of the managed object class built with
136136
the data sent by the server
137137
138138
Raises:
@@ -165,7 +165,7 @@ def update( # type: ignore
165165
**kwargs: Extra options to send to the server (e.g. sudo)
166166
167167
Returns:
168-
dict:The new object data (*not* a RESTObject)
168+
The new object data (*not* a RESTObject)
169169
170170
Raises:
171171
GitlabAuthenticationError: If authentication is not correct
@@ -236,7 +236,7 @@ def raw(
236236
GitlabGetError: If the file could not be retrieved
237237
238238
Returns:
239-
str:The file content
239+
The file content
240240
"""
241241
file_path=file_path.replace("/","%2F").replace(".","%2E")
242242
path=f"{self.path}/{file_path}/raw"

‎gitlab/v4/objects/geo_nodes.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def status(self, **kwargs: Any) -> Dict[str, Any]:
4949
GitlabGetError: If the server failed to perform the request
5050
5151
Returns:
52-
dict:The status of the geo node
52+
The status of the geo node
5353
"""
5454
path=f"/geo_nodes/{self.get_id()}/status"
5555
result=self.manager.gitlab.http_get(path,**kwargs)
@@ -81,7 +81,7 @@ def status(self, **kwargs: Any) -> List[Dict[str, Any]]:
8181
GitlabGetError: If the server failed to perform the request
8282
8383
Returns:
84-
list:The status of all the geo nodes
84+
The status of all the geo nodes
8585
"""
8686
result=self.gitlab.http_list("/geo_nodes/status",**kwargs)
8787
ifTYPE_CHECKING:
@@ -101,7 +101,7 @@ def current_failures(self, **kwargs: Any) -> List[Dict[str, Any]]:
101101
GitlabGetError: If the server failed to perform the request
102102
103103
Returns:
104-
list:The list of failures
104+
The list of failures
105105
"""
106106
result=self.gitlab.http_list("/geo_nodes/current/failures",**kwargs)
107107
ifTYPE_CHECKING:

‎gitlab/v4/objects/groups.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def search(
110110
GitlabSearchError: If the server failed to perform the request
111111
112112
Returns:
113-
GitlabList:A list of dicts describing the resources found.
113+
A list of dicts describing the resources found.
114114
"""
115115
data= {"scope":scope,"search":search}
116116
path=f"/groups/{self.get_id()}/search"
@@ -319,7 +319,7 @@ def import_group(
319319
GitlabImportError: If the server failed to perform the request
320320
321321
Returns:
322-
dict:A representation of the import status.
322+
A representation of the import status.
323323
"""
324324
files= {"file": ("file.tar.gz",file,"application/octet-stream")}
325325
data= {"path":path,"name":name}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp