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

Commit665b2c8

Browse files
test(pylint): enable pylint "unused-argument" check
Enable the pylint "unused-argument" check and resolve issues it found. * Quite a few functions were accepting `**kwargs` but not then passing them on through to the next level. Now pass `**kwargs` to next level. * Other functions had no reason to accept `**kwargs`, so remove it * And a few other fixes.
1 parentb644721 commit665b2c8

File tree

9 files changed

+18
-15
lines changed

9 files changed

+18
-15
lines changed

‎gitlab/client.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,7 @@ def http_post(
967967
query_data=query_data,
968968
post_data=post_data,
969969
files=files,
970+
raw=raw,
970971
**kwargs,
971972
)
972973
try:

‎gitlab/v4/cli.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ def get_dict(
382382
classJSONPrinter:
383383
@staticmethod
384384
defdisplay(d:Union[str,Dict[str,Any]],**kwargs:Any)->None:
385+
_=kwargs# Disables PyLint 'unused-argument' error
385386
importjson# noqa
386387

387388
print(json.dumps(d))
@@ -392,6 +393,7 @@ def display_list(
392393
fields:List[str],
393394
**kwargs:Any,
394395
)->None:
396+
_=kwargs# Disables PyLint 'unused-argument' error
395397
importjson# noqa
396398

397399
print(json.dumps([get_dict(obj,fields)forobjindata]))
@@ -400,6 +402,7 @@ def display_list(
400402
classYAMLPrinter:
401403
@staticmethod
402404
defdisplay(d:Union[str,Dict[str,Any]],**kwargs:Any)->None:
405+
_=kwargs# Disables PyLint 'unused-argument' error
403406
try:
404407
importyaml# noqa
405408

@@ -417,6 +420,7 @@ def display_list(
417420
fields:List[str],
418421
**kwargs:Any,
419422
)->None:
423+
_=kwargs# Disables PyLint 'unused-argument' error
420424
try:
421425
importyaml# noqa
422426

@@ -435,6 +439,7 @@ def display_list(
435439

436440
classLegacyPrinter:
437441
defdisplay(self,d:Union[str,Dict[str,Any]],**kwargs:Any)->None:
442+
_=d# Disables PyLint 'unused-argument' error
438443
verbose=kwargs.get("verbose",False)
439444
padding=kwargs.get("padding",0)
440445
obj:Optional[Union[Dict[str,Any],gitlab.base.RESTObject]]=kwargs.get("obj")

‎gitlab/v4/objects/groups.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def delete_ldap_group_link(
183183
ifproviderisnotNone:
184184
path+=f"/{provider}"
185185
path+=f"/{cn}"
186-
self.manager.gitlab.http_delete(path)
186+
self.manager.gitlab.http_delete(path,**kwargs)
187187

188188
@cli.register_custom_action("Group")
189189
@exc.on_http_error(exc.GitlabCreateError)

‎gitlab/v4/objects/jobs.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def cancel(self, **kwargs: Any) -> Dict[str, Any]:
2828
GitlabJobCancelError: If the job could not be canceled
2929
"""
3030
path=f"{self.manager.path}/{self.encoded_id}/cancel"
31-
result=self.manager.gitlab.http_post(path)
31+
result=self.manager.gitlab.http_post(path,**kwargs)
3232
ifTYPE_CHECKING:
3333
assertisinstance(result,dict)
3434
returnresult
@@ -46,7 +46,7 @@ def retry(self, **kwargs: Any) -> Dict[str, Any]:
4646
GitlabJobRetryError: If the job could not be retried
4747
"""
4848
path=f"{self.manager.path}/{self.encoded_id}/retry"
49-
result=self.manager.gitlab.http_post(path)
49+
result=self.manager.gitlab.http_post(path,**kwargs)
5050
ifTYPE_CHECKING:
5151
assertisinstance(result,dict)
5252
returnresult
@@ -64,7 +64,7 @@ def play(self, **kwargs: Any) -> None:
6464
GitlabJobPlayError: If the job could not be triggered
6565
"""
6666
path=f"{self.manager.path}/{self.encoded_id}/play"
67-
self.manager.gitlab.http_post(path)
67+
self.manager.gitlab.http_post(path,**kwargs)
6868

6969
@cli.register_custom_action("ProjectJob")
7070
@exc.on_http_error(exc.GitlabJobEraseError)
@@ -79,7 +79,7 @@ def erase(self, **kwargs: Any) -> None:
7979
GitlabJobEraseError: If the job could not be erased
8080
"""
8181
path=f"{self.manager.path}/{self.encoded_id}/erase"
82-
self.manager.gitlab.http_post(path)
82+
self.manager.gitlab.http_post(path,**kwargs)
8383

8484
@cli.register_custom_action("ProjectJob")
8585
@exc.on_http_error(exc.GitlabCreateError)
@@ -94,7 +94,7 @@ def keep_artifacts(self, **kwargs: Any) -> None:
9494
GitlabCreateError: If the request could not be performed
9595
"""
9696
path=f"{self.manager.path}/{self.encoded_id}/artifacts/keep"
97-
self.manager.gitlab.http_post(path)
97+
self.manager.gitlab.http_post(path,**kwargs)
9898

9999
@cli.register_custom_action("ProjectJob")
100100
@exc.on_http_error(exc.GitlabCreateError)
@@ -109,7 +109,7 @@ def delete_artifacts(self, **kwargs: Any) -> None:
109109
GitlabDeleteError: If the request could not be performed
110110
"""
111111
path=f"{self.manager.path}/{self.encoded_id}/artifacts"
112-
self.manager.gitlab.http_delete(path)
112+
self.manager.gitlab.http_delete(path,**kwargs)
113113

114114
@cli.register_custom_action("ProjectJob")
115115
@exc.on_http_error(exc.GitlabGetError)

‎gitlab/v4/objects/merge_request_approvals.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ def set_approvers(
119119
approver_ids:Optional[List[int]]=None,
120120
approver_group_ids:Optional[List[int]]=None,
121121
approval_rule_name:str="name",
122-
**kwargs:Any,
123122
)->RESTObject:
124123
"""Change MR-level allowed approvers and approver groups.
125124

‎gitlab/v4/objects/pipelines.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def cancel(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
7171
GitlabPipelineCancelError: If the request failed
7272
"""
7373
path=f"{self.manager.path}/{self.encoded_id}/cancel"
74-
returnself.manager.gitlab.http_post(path)
74+
returnself.manager.gitlab.http_post(path,**kwargs)
7575

7676
@cli.register_custom_action("ProjectPipeline")
7777
@exc.on_http_error(exc.GitlabPipelineRetryError)
@@ -86,7 +86,7 @@ def retry(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
8686
GitlabPipelineRetryError: If the request failed
8787
"""
8888
path=f"{self.manager.path}/{self.encoded_id}/retry"
89-
returnself.manager.gitlab.http_post(path)
89+
returnself.manager.gitlab.http_post(path,**kwargs)
9090

9191

9292
classProjectPipelineManager(RetrieveMixin,CreateMixin,DeleteMixin,RESTManager):

‎gitlab/v4/objects/projects.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ def upload(
464464

465465
url=f"/projects/{self.encoded_id}/uploads"
466466
file_info= {"file": (filename,filedata)}
467-
data=self.manager.gitlab.http_post(url,files=file_info)
467+
data=self.manager.gitlab.http_post(url,files=file_info,**kwargs)
468468

469469
ifTYPE_CHECKING:
470470
assertisinstance(data,dict)
@@ -504,7 +504,7 @@ def snapshot(
504504
"""
505505
path=f"/projects/{self.encoded_id}/snapshot"
506506
result=self.manager.gitlab.http_get(
507-
path,streamed=streamed,raw=True,**kwargs
507+
path,streamed=streamed,raw=True,wiki=wiki,**kwargs
508508
)
509509
ifTYPE_CHECKING:
510510
assertisinstance(result,requests.Response)

‎gitlab/v4/objects/services.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def get(
267267
returncast(ProjectService,super().get(id=id,lazy=lazy,**kwargs))
268268

269269
@cli.register_custom_action("ProjectServiceManager")
270-
defavailable(self,**kwargs:Any)->List[str]:
270+
defavailable(self)->List[str]:
271271
"""List the services known by python-gitlab.
272272
273273
Returns:

‎pyproject.toml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ disable = [
7070
"too-many-locals",
7171
"too-many-statements",
7272
"unsubscriptable-object",
73-
"unused-argument",
74-
7573
]
7674

7775
[tool.pytest.ini_options]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp