summaryrefslogtreecommitdiff
path: root/gitlab
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2022-06-03 16:40:43 -0700
committerJohn L. Villalovos <john@sodarock.com>2022-06-04 09:18:22 -0700
commit80aadaf4262016a8181b5150ca7e17c8139c15fa (patch)
tree8ac2d21a6e07eaa659de80e77b06bdef9780fa5b /gitlab
parentd0b0811211f69f08436dcf7617c46617fe5c0b8b (diff)
downloadgitlab-80aadaf4262016a8181b5150ca7e17c8139c15fa.tar.gz
chore: enable pylint check: "no-self-use"
Enable the pylint check "no-self-use" and fix the errors detected.
Diffstat (limited to 'gitlab')
-rw-r--r--gitlab/client.py11
-rw-r--r--gitlab/types.py6
-rw-r--r--gitlab/v4/cli.py10
3 files changed, 17 insertions, 10 deletions
diff --git a/gitlab/client.py b/gitlab/client.py
index aa612c9..0019c0e 100644
--- a/gitlab/client.py
+++ b/gitlab/client.py
@@ -515,7 +515,8 @@ class Gitlab:
self.http_username, self.http_password
)
- def enable_debug(self) -> None:
+ @staticmethod
+ def enable_debug() -> None:
import logging
from http.client import HTTPConnection # noqa
@@ -534,7 +535,8 @@ class Gitlab:
"verify": self.ssl_verify,
}
- def _get_base_url(self, url: Optional[str] = None) -> str:
+ @staticmethod
+ def _get_base_url(url: Optional[str] = None) -> str:
"""Return the base URL with the trailing slash stripped.
If the URL is a Falsy value, return the default URL.
Returns:
@@ -558,7 +560,8 @@ class Gitlab:
return path
return f"{self._url}{path}"
- def _check_redirects(self, result: requests.Response) -> None:
+ @staticmethod
+ def _check_redirects(result: requests.Response) -> None:
# Check the requests history to detect 301/302 redirections.
# If the initial verb is POST or PUT, the redirected request will use a
# GET request, leading to unwanted behaviour.
@@ -583,8 +586,8 @@ class Gitlab:
)
)
+ @staticmethod
def _prepare_send_data(
- self,
files: Optional[Dict[str, Any]] = None,
post_data: Optional[Union[Dict[str, Any], bytes]] = None,
raw: bool = False,
diff --git a/gitlab/types.py b/gitlab/types.py
index e2d988a..f811a6f 100644
--- a/gitlab/types.py
+++ b/gitlab/types.py
@@ -103,10 +103,12 @@ class LowercaseStringAttribute(GitlabAttribute):
class FileAttribute(GitlabAttribute):
- def get_file_name(self, attr_name: Optional[str] = None) -> Optional[str]:
+ @staticmethod
+ def get_file_name(attr_name: Optional[str] = None) -> Optional[str]:
return attr_name
class ImageAttribute(FileAttribute):
- def get_file_name(self, attr_name: Optional[str] = None) -> str:
+ @staticmethod
+ def get_file_name(attr_name: Optional[str] = None) -> str:
return f"{attr_name}.png" if attr_name else "image.png"
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py
index c4e15fc..3339a5a 100644
--- a/gitlab/v4/cli.py
+++ b/gitlab/v4/cli.py
@@ -371,13 +371,14 @@ def get_dict(
class JSONPrinter:
- def display(self, d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
+ @staticmethod
+ def display(d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
import json # noqa
print(json.dumps(d))
+ @staticmethod
def display_list(
- self,
data: List[Union[str, gitlab.base.RESTObject]],
fields: List[str],
**kwargs: Any,
@@ -388,7 +389,8 @@ class JSONPrinter:
class YAMLPrinter:
- def display(self, d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
+ @staticmethod
+ def display(d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
try:
import yaml # noqa
@@ -400,8 +402,8 @@ class YAMLPrinter:
"to use the yaml output feature"
)
+ @staticmethod
def display_list(
- self,
data: List[Union[str, gitlab.base.RESTObject]],
fields: List[str],
**kwargs: Any,