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

Commit80aadaf

Browse files
chore: enable pylint check: "no-self-use"
Enable the pylint check "no-self-use" and fix the errors detected.
1 parentd0b0811 commit80aadaf

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

‎gitlab/client.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,8 @@ def _set_auth_info(self) -> None:
515515
self.http_username,self.http_password
516516
)
517517

518-
defenable_debug(self)->None:
518+
@staticmethod
519+
defenable_debug()->None:
519520
importlogging
520521
fromhttp.clientimportHTTPConnection# noqa
521522

@@ -534,7 +535,8 @@ def _get_session_opts(self) -> Dict[str, Any]:
534535
"verify":self.ssl_verify,
535536
}
536537

537-
def_get_base_url(self,url:Optional[str]=None)->str:
538+
@staticmethod
539+
def_get_base_url(url:Optional[str]=None)->str:
538540
"""Return the base URL with the trailing slash stripped.
539541
If the URL is a Falsy value, return the default URL.
540542
Returns:
@@ -558,7 +560,8 @@ def _build_url(self, path: str) -> str:
558560
returnpath
559561
returnf"{self._url}{path}"
560562

561-
def_check_redirects(self,result:requests.Response)->None:
563+
@staticmethod
564+
def_check_redirects(result:requests.Response)->None:
562565
# Check the requests history to detect 301/302 redirections.
563566
# If the initial verb is POST or PUT, the redirected request will use a
564567
# GET request, leading to unwanted behaviour.
@@ -583,8 +586,8 @@ def _check_redirects(self, result: requests.Response) -> None:
583586
)
584587
)
585588

589+
@staticmethod
586590
def_prepare_send_data(
587-
self,
588591
files:Optional[Dict[str,Any]]=None,
589592
post_data:Optional[Union[Dict[str,Any],bytes]]=None,
590593
raw:bool=False,

‎gitlab/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ def get_for_api(self) -> str:
103103

104104

105105
classFileAttribute(GitlabAttribute):
106-
defget_file_name(self,attr_name:Optional[str]=None)->Optional[str]:
106+
@staticmethod
107+
defget_file_name(attr_name:Optional[str]=None)->Optional[str]:
107108
returnattr_name
108109

109110

110111
classImageAttribute(FileAttribute):
111-
defget_file_name(self,attr_name:Optional[str]=None)->str:
112+
@staticmethod
113+
defget_file_name(attr_name:Optional[str]=None)->str:
112114
returnf"{attr_name}.png"ifattr_nameelse"image.png"

‎gitlab/v4/cli.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,14 @@ def get_dict(
371371

372372

373373
classJSONPrinter:
374-
defdisplay(self,d:Union[str,Dict[str,Any]],**kwargs:Any)->None:
374+
@staticmethod
375+
defdisplay(d:Union[str,Dict[str,Any]],**kwargs:Any)->None:
375376
importjson# noqa
376377

377378
print(json.dumps(d))
378379

380+
@staticmethod
379381
defdisplay_list(
380-
self,
381382
data:List[Union[str,gitlab.base.RESTObject]],
382383
fields:List[str],
383384
**kwargs:Any,
@@ -388,7 +389,8 @@ def display_list(
388389

389390

390391
classYAMLPrinter:
391-
defdisplay(self,d:Union[str,Dict[str,Any]],**kwargs:Any)->None:
392+
@staticmethod
393+
defdisplay(d:Union[str,Dict[str,Any]],**kwargs:Any)->None:
392394
try:
393395
importyaml# noqa
394396

@@ -400,8 +402,8 @@ def display(self, d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
400402
"to use the yaml output feature"
401403
)
402404

405+
@staticmethod
403406
defdisplay_list(
404-
self,
405407
data:List[Union[str,gitlab.base.RESTObject]],
406408
fields:List[str],
407409
**kwargs:Any,

‎pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ disable = [
5757
"missing-class-docstring",
5858
"missing-function-docstring",
5959
"missing-module-docstring",
60-
"no-self-use",
6160
"protected-access",
6261
"redefined-builtin",
6362
"redefined-outer-name",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp