| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d0b0811 commit 80aadaf
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -515,7 +515,8 @@ def _set_auth_info(self) -> None: | |||
| 515 | 515 | self.http_username, self.http_password | |
| 516 | 516 | ) | |
| 517 | 517 | ||
| 518 | - def enable_debug(self) -> None: | ||
| 518 | + @staticmethod | ||
| 519 | + def enable_debug() -> None: | ||
| 519 | 520 | import logging | |
| 520 | 521 | from http.client import HTTPConnection # noqa | |
| 521 | 522 | ||
@@ -534,7 +535,8 @@ def _get_session_opts(self) -> Dict[str, Any]: | |||
| 534 | 535 | "verify": self.ssl_verify, | |
| 535 | 536 | } | |
| 536 | 537 | ||
| 537 | - def _get_base_url(self, url: Optional[str] = None) -> str: | ||
| 538 | + @staticmethod | ||
| 539 | + def _get_base_url(url: Optional[str] = None) -> str: | ||
| 538 | 540 | """Return the base URL with the trailing slash stripped. | |
| 539 | 541 | If the URL is a Falsy value, return the default URL. | |
| 540 | 542 | Returns: | |
@@ -558,7 +560,8 @@ def _build_url(self, path: str) -> str: | |||
| 558 | 560 | return path | |
| 559 | 561 | return f"{self._url}{path}" | |
| 560 | 562 | ||
| 561 | - def _check_redirects(self, result: requests.Response) -> None: | ||
| 563 | + @staticmethod | ||
| 564 | + def _check_redirects(result: requests.Response) -> None: | ||
| 562 | 565 | # Check the requests history to detect 301/302 redirections. | |
| 563 | 566 | # If the initial verb is POST or PUT, the redirected request will use a | |
| 564 | 567 | # GET request, leading to unwanted behaviour. | |
@@ -583,8 +586,8 @@ def _check_redirects(self, result: requests.Response) -> None: | |||
| 583 | 586 | ) | |
| 584 | 587 | ) | |
| 585 | 588 | ||
| 589 | + @staticmethod | ||
| 586 | 590 | def _prepare_send_data( | |
| 587 | - self, | ||
| 588 | 591 | files: Optional[Dict[str, Any]] = None, | |
| 589 | 592 | post_data: Optional[Union[Dict[str, Any], bytes]] = None, | |
| 590 | 593 | raw: bool = False, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -103,10 +103,12 @@ def get_for_api(self) -> str: | |||
| 103 | 103 | ||
| 104 | 104 | ||
| 105 | 105 | class FileAttribute(GitlabAttribute): | |
| 106 | - def get_file_name(self, attr_name: Optional[str] = None) -> Optional[str]: | ||
| 106 | + @staticmethod | ||
| 107 | + def get_file_name(attr_name: Optional[str] = None) -> Optional[str]: | ||
| 107 | 108 | return attr_name | |
| 108 | 109 | ||
| 109 | 110 | ||
| 110 | 111 | class ImageAttribute(FileAttribute): | |
| 111 | - def get_file_name(self, attr_name: Optional[str] = None) -> str: | ||
| 112 | + @staticmethod | ||
| 113 | + def get_file_name(attr_name: Optional[str] = None) -> str: | ||
| 112 | 114 | return f"{attr_name}.png" if attr_name else "image.png" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -371,13 +371,14 @@ def get_dict( | |||
| 371 | 371 | ||
| 372 | 372 | ||
| 373 | 373 | class JSONPrinter: | |
| 374 | - def display(self, d: Union[str, Dict[str, Any]], **kwargs: Any) -> None: | ||
| 374 | + @staticmethod | ||
| 375 | + def display(d: Union[str, Dict[str, Any]], **kwargs: Any) -> None: | ||
| 375 | 376 | import json # noqa | |
| 376 | 377 | ||
| 377 | 378 | print(json.dumps(d)) | |
| 378 | 379 | ||
| 380 | + @staticmethod | ||
| 379 | 381 | def display_list( | |
| 380 | - self, | ||
| 381 | 382 | data: List[Union[str, gitlab.base.RESTObject]], | |
| 382 | 383 | fields: List[str], | |
| 383 | 384 | **kwargs: Any, | |
@@ -388,7 +389,8 @@ def display_list( | |||
| 388 | 389 | ||
| 389 | 390 | ||
| 390 | 391 | class YAMLPrinter: | |
| 391 | - def display(self, d: Union[str, Dict[str, Any]], **kwargs: Any) -> None: | ||
| 392 | + @staticmethod | ||
| 393 | + def display(d: Union[str, Dict[str, Any]], **kwargs: Any) -> None: | ||
| 392 | 394 | try: | |
| 393 | 395 | import yaml # noqa | |
| 394 | 396 | ||
@@ -400,8 +402,8 @@ def display(self, d: Union[str, Dict[str, Any]], **kwargs: Any) -> None: | |||
| 400 | 402 | "to use the yaml output feature" | |
| 401 | 403 | ) | |
| 402 | 404 | ||
| 405 | + @staticmethod | ||
| 403 | 406 | def display_list( | |
| 404 | - self, | ||
| 405 | 407 | data: List[Union[str, gitlab.base.RESTObject]], | |
| 406 | 408 | fields: List[str], | |
| 407 | 409 | **kwargs: Any, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,7 +57,6 @@ disable = [ | |||
| 57 | 57 | "missing-class-docstring", | |
| 58 | 58 | "missing-function-docstring", | |
| 59 | 59 | "missing-module-docstring", | |
| 60 | - "no-self-use", | ||
| 61 | 60 | "protected-access", | |
| 62 | 61 | "redefined-builtin", | |
| 63 | 62 | "redefined-outer-name", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments