summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gitlab/client.py11
-rw-r--r--gitlab/types.py6
-rw-r--r--gitlab/v4/cli.py10
-rw-r--r--pyproject.toml1
4 files changed, 17 insertions, 11 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,
diff --git a/pyproject.toml b/pyproject.toml
index c46edd3..986c7ca 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -57,7 +57,6 @@ disable = [
"missing-class-docstring",
"missing-function-docstring",
"missing-module-docstring",
- "no-self-use",
"protected-access",
"redefined-builtin",
"redefined-outer-name",