| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4e90c11 commit 2100aa4
102 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,25 +7,15 @@ | |||
| 7 | 7 | import textwrap | |
| 8 | 8 | from collections.abc import Iterable | |
| 9 | 9 | from types import ModuleType | |
| 10 | - from typing import ( | ||
| 11 | - Any, | ||
| 12 | - ClassVar, | ||
| 13 | - Generic, | ||
| 14 | - TYPE_CHECKING, | ||
| 15 | - TypeVar, | ||
| 16 | - ) | ||
| 10 | + from typing import Any, ClassVar, Generic, TYPE_CHECKING, TypeVar | ||
| 17 | 11 | ||
| 18 | 12 | import gitlab | |
| 19 | 13 | from gitlab import types as g_types | |
| 20 | 14 | from gitlab.exceptions import GitlabParsingError | |
| 21 | 15 | ||
| 22 | 16 | from .client import Gitlab, GitlabList | |
| 23 | 17 | ||
| 24 | - __all__ = [ | ||
| 25 | - "RESTObject", | ||
| 26 | - "RESTObjectList", | ||
| 27 | - "RESTManager", | ||
| 28 | - ] | ||
| 18 | + __all__ = ["RESTObject", "RESTObjectList", "RESTManager"] | ||
| 29 | 19 | ||
| 30 | 20 | ||
| 31 | 21 | _URL_ATTRIBUTE_ERROR = ( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,14 +8,7 @@ | |||
| 8 | 8 | import re | |
| 9 | 9 | import sys | |
| 10 | 10 | from types import ModuleType | |
| 11 | - from typing import ( | ||
| 12 | - Any, | ||
| 13 | - Callable, | ||
| 14 | - cast, | ||
| 15 | - NoReturn, | ||
| 16 | - TYPE_CHECKING, | ||
| 17 | - TypeVar, | ||
| 18 | - ) | ||
| 11 | + from typing import Any, Callable, cast, NoReturn, TYPE_CHECKING, TypeVar | ||
| 19 | 12 | ||
| 20 | 13 | from requests.structures import CaseInsensitiveDict | |
| 21 | 14 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,12 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | import os | |
| 6 | 6 | import re | |
| 7 | - from typing import ( | ||
| 8 | - Any, | ||
| 9 | - BinaryIO, | ||
| 10 | - cast, | ||
| 11 | - TYPE_CHECKING, | ||
| 12 | - ) | ||
| 7 | + from typing import Any, BinaryIO, cast, TYPE_CHECKING | ||
| 13 | 8 | from urllib import parse | |
| 14 | 9 | ||
| 15 | 10 | import requests | |
@@ -952,11 +947,7 @@ def should_emit_warning() -> bool: | |||
| 952 | 947 | f"`get_all=False` to the `list()` call." | |
| 953 | 948 | ) | |
| 954 | 949 | show_caller = True | |
| 955 | - utils.warn( | ||
| 956 | - message=message, | ||
| 957 | - category=UserWarning, | ||
| 958 | - show_caller=show_caller, | ||
| 959 | - ) | ||
| 950 | + utils.warn(message=message, category=UserWarning, show_caller=show_caller) | ||
| 960 | 951 | return items | |
| 961 | 952 | ||
| 962 | 953 | def http_post( | |
@@ -1097,12 +1088,7 @@ def http_patch( | |||
| 1097 | 1088 | post_data = post_data or {} | |
| 1098 | 1089 | ||
| 1099 | 1090 | result = self.http_request( | |
| 1100 | - "patch", | ||
| 1101 | - path, | ||
| 1102 | - query_data=query_data, | ||
| 1103 | - post_data=post_data, | ||
| 1104 | - raw=raw, | ||
| 1105 | - **kwargs, | ||
| 1091 | + "patch", path, query_data=query_data, post_data=post_data, raw=raw, **kwargs | ||
| 1106 | 1092 | ) | |
| 1107 | 1093 | if result.status_code in gitlab.const.NO_JSON_RESPONSE_CODES: | |
| 1108 | 1094 | return result | |
@@ -1383,13 +1369,11 @@ def execute(self, request: str | graphql.Source, *args: Any, **kwargs: Any) -> A | |||
| 1383 | 1369 | ||
| 1384 | 1370 | if e.code == 401: | |
| 1385 | 1371 | raise gitlab.exceptions.GitlabAuthenticationError( | |
| 1386 | - response_code=e.code, | ||
| 1387 | - error_message=str(e), | ||
| 1372 | + response_code=e.code, error_message=str(e) | ||
| 1388 | 1373 | ) | |
| 1389 | 1374 | ||
| 1390 | 1375 | raise gitlab.exceptions.GitlabHttpError( | |
| 1391 | - response_code=e.code, | ||
| 1392 | - error_message=str(e), | ||
| 1376 | + response_code=e.code, error_message=str(e) | ||
| 1393 | 1377 | ) | |
| 1394 | 1378 | ||
| 1395 | 1379 | return result | |
@@ -1459,13 +1443,11 @@ async def execute( | |||
| 1459 | 1443 | ||
| 1460 | 1444 | if e.code == 401: | |
| 1461 | 1445 | raise gitlab.exceptions.GitlabAuthenticationError( | |
| 1462 | - response_code=e.code, | ||
| 1463 | - error_message=str(e), | ||
| 1446 | + response_code=e.code, error_message=str(e) | ||
| 1464 | 1447 | ) | |
| 1465 | 1448 | ||
| 1466 | 1449 | raise gitlab.exceptions.GitlabHttpError( | |
| 1467 | - response_code=e.code, | ||
| 1468 | - error_message=str(e), | ||
| 1450 | + response_code=e.code, error_message=str(e) | ||
| 1469 | 1451 | ) | |
| 1470 | 1452 | ||
| 1471 | 1453 | return result | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,9 +26,7 @@ def _resolve_file(filepath: Path | str) -> str: | |||
| 26 | 26 | return str(resolved) | |
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | - def _get_config_files( | ||
| 30 | - config_files: list[str] | None = None, | ||
| 31 | - ) -> str | list[str]: | ||
| 29 | + def _get_config_files(config_files: list[str] | None = None) -> str | list[str]: | ||
| 32 | 30 | """ | |
| 33 | 31 | Return resolved path(s) to config files if they exist, with precedence: | |
| 34 | 32 | 1. Files passed in config_files | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,13 +3,7 @@ | |||
| 3 | 3 | import enum | |
| 4 | 4 | from collections.abc import Iterator | |
| 5 | 5 | from types import ModuleType | |
| 6 | - from typing import ( | ||
| 7 | - Any, | ||
| 8 | - Callable, | ||
| 9 | - Literal, | ||
| 10 | - overload, | ||
| 11 | - TYPE_CHECKING, | ||
| 12 | - ) | ||
| 6 | + from typing import Any, Callable, Literal, overload, TYPE_CHECKING | ||
| 13 | 7 | ||
| 14 | 8 | import requests | |
| 15 | 9 | ||
@@ -261,9 +255,7 @@ class UpdateMixin(base.RESTManager[base.TObjCls]): | |||
| 261 | 255 | # Update mixins attrs for easier implementation | |
| 262 | 256 | _update_method: UpdateMethod = UpdateMethod.PUT | |
| 263 | 257 | ||
| 264 | - def _get_update_method( | ||
| 265 | - self, | ||
| 266 | - ) -> Callable[..., dict[str, Any] | requests.Response]: | ||
| 258 | + def _get_update_method(self) -> Callable[..., dict[str, Any] | requests.Response]: | ||
| 267 | 259 | """Return the HTTP method to use. | |
| 268 | 260 | ||
| 269 | 261 | Returns: | |
@@ -931,9 +923,7 @@ class PromoteMixin(_RestObjectBase): | |||
| 931 | 923 | _update_method: UpdateMethod = UpdateMethod.PUT | |
| 932 | 924 | manager: base.RESTManager[Any] | |
| 933 | 925 | ||
| 934 | - def _get_update_method( | ||
| 935 | - self, | ||
| 936 | - ) -> Callable[..., dict[str, Any] | requests.Response]: | ||
| 926 | + def _get_update_method(self) -> Callable[..., dict[str, Any] | requests.Response]: | ||
| 937 | 927 | """Return the HTTP method to use. | |
| 938 | 928 | ||
| 939 | 929 | Returns: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,10 +11,7 @@ class RequiredOptional: | |||
| 11 | 11 | exclusive: tuple[str, ...] = () | |
| 12 | 12 | ||
| 13 | 13 | def validate_attrs( | |
| 14 | - self, | ||
| 15 | - *, | ||
| 16 | - data: dict[str, Any], | ||
| 17 | - excludes: list[str] | None = None, | ||
| 14 | + self, *, data: dict[str, Any], excludes: list[str] | None = None | ||
| 18 | 15 | ) -> None: | |
| 19 | 16 | if excludes is None: | |
| 20 | 17 | excludes = [] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,11 +9,7 @@ | |||
| 9 | 9 | import urllib.parse | |
| 10 | 10 | import warnings | |
| 11 | 11 | from collections.abc import Iterator, MutableMapping | |
| 12 | - from typing import ( | ||
| 13 | - Any, | ||
| 14 | - Callable, | ||
| 15 | - Literal, | ||
| 16 | - ) | ||
| 12 | + from typing import Any, Callable, Literal | ||
| 17 | 13 | ||
| 18 | 14 | import requests | |
| 19 | 15 | ||
@@ -208,11 +204,7 @@ def _transform_types( | |||
| 208 | 204 | return data, files | |
| 209 | 205 | ||
| 210 | 206 | ||
| 211 | - def copy_dict( | ||
| 212 | - *, | ||
| 213 | - src: dict[str, Any], | ||
| 214 | - dest: dict[str, Any], | ||
| 215 | - ) -> None: | ||
| 207 | + def copy_dict(*, src: dict[str, Any], dest: dict[str, Any]) -> None: | ||
| 216 | 208 | for k, v in src.items(): | |
| 217 | 209 | if isinstance(v, dict): | |
| 218 | 210 | # NOTE(jlvillal): This provides some support for the `hash` type | |
@@ -284,10 +276,7 @@ def warn( | |||
| 284 | 276 | if show_caller: | |
| 285 | 277 | message += warning_from | |
| 286 | 278 | warnings.warn( | |
| 287 | - message=message, | ||
| 288 | - category=category, | ||
| 289 | - stacklevel=stacklevel, | ||
| 290 | - source=source, | ||
| 279 | + message=message, category=category, stacklevel=stacklevel, source=source | ||
| 291 | 280 | ) | |
| 292 | 281 | ||
| 293 | 282 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -133,9 +133,7 @@ def do_create(self) -> gitlab.base.RESTObject: | |||
| 133 | 133 | cli.die("Impossible to create object", e) | |
| 134 | 134 | return result | |
| 135 | 135 | ||
| 136 | - def do_list( | ||
| 137 | - self, | ||
| 138 | - ) -> gitlab.base.RESTObjectList | list[gitlab.base.RESTObject]: | ||
| 136 | + def do_list(self) -> gitlab.base.RESTObjectList | list[gitlab.base.RESTObject]: | ||
| 139 | 137 | if TYPE_CHECKING: | |
| 140 | 138 | assert isinstance(self.mgr, gitlab.mixins.ListMixin) | |
| 141 | 139 | message_details = gitlab.utils.WarnMessageData( | |
@@ -210,8 +208,7 @@ def do_update(self) -> dict[str, Any]: | |||
| 210 | 208 | ||
| 211 | 209 | ||
| 212 | 210 | def _populate_sub_parser_by_class( | |
| 213 | - cls: type[gitlab.base.RESTObject], | ||
| 214 | - sub_parser: _SubparserType, | ||
| 211 | + cls: type[gitlab.base.RESTObject], sub_parser: _SubparserType | ||
| 215 | 212 | ) -> None: | |
| 216 | 213 | mgr_cls_name = f"{cls.__name__}Manager" | |
| 217 | 214 | mgr_cls = getattr(gitlab.v4.objects, mgr_cls_name) | |
@@ -228,9 +225,7 @@ def _populate_sub_parser_by_class( | |||
| 228 | 225 | continue | |
| 229 | 226 | ||
| 230 | 227 | sub_parser_action = sub_parser.add_parser( | |
| 231 | - action_name, | ||
| 232 | - conflict_handler="resolve", | ||
| 233 | - help=help_text, | ||
| 228 | + action_name, conflict_handler="resolve", help=help_text | ||
| 234 | 229 | ) | |
| 235 | 230 | action_parsers[action_name] = sub_parser_action | |
| 236 | 231 | sub_parser_action.add_argument("--sudo", required=False) | |
@@ -415,8 +410,7 @@ def extend_parser(parser: argparse.ArgumentParser) -> argparse.ArgumentParser: | |||
| 415 | 410 | mgr_cls_name = f"{cls.__name__}Manager" | |
| 416 | 411 | mgr_cls = getattr(gitlab.v4.objects, mgr_cls_name) | |
| 417 | 412 | object_group = subparsers.add_parser( | |
| 418 | - arg_name, | ||
| 419 | - help=f"API endpoint: {mgr_cls._path}", | ||
| 413 | + arg_name, help=f"API endpoint: {mgr_cls._path}" | ||
| 420 | 414 | ) | |
| 421 | 415 | ||
| 422 | 416 | object_subparsers = object_group.add_subparsers( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,10 +7,7 @@ | |||
| 7 | 7 | from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin | |
| 8 | 8 | from gitlab.types import RequiredOptional | |
| 9 | 9 | ||
| 10 | - __all__ = [ | ||
| 11 | - "ApplicationAppearance", | ||
| 12 | - "ApplicationAppearanceManager", | ||
| 13 | - ] | ||
| 10 | + __all__ = ["ApplicationAppearance", "ApplicationAppearanceManager"] | ||
| 14 | 11 | ||
| 15 | 12 | ||
| 16 | 13 | class ApplicationAppearance(SaveMixin, RESTObject): | |
@@ -35,7 +32,7 @@ class ApplicationAppearanceManager( | |||
| 35 | 32 | "message_background_color", | |
| 36 | 33 | "message_font_color", | |
| 37 | 34 | "email_header_and_footer_enabled", | |
| 38 | - ), | ||
| 35 | + ) | ||
| 39 | 36 | ) | |
| 40 | 37 | ||
| 41 | 38 | @exc.on_http_error(exc.GitlabUpdateError) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,10 +2,7 @@ | |||
| 2 | 2 | from gitlab.mixins import CreateMixin, DeleteMixin, ListMixin, ObjectDeleteMixin | |
| 3 | 3 | from gitlab.types import RequiredOptional | |
| 4 | 4 | ||
| 5 | - __all__ = [ | ||
| 6 | - "Application", | ||
| 7 | - "ApplicationManager", | ||
| 8 | - ] | ||
| 5 | + __all__ = ["Application", "ApplicationManager"] | ||
| 9 | 6 | ||
| 10 | 7 | ||
| 11 | 8 | class Application(ObjectDeleteMixin, RESTObject): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments