Commit a54c422f authored by John L. Villalovos's avatar John L. Villalovos
Browse files

chore: reformat code with skip_magic_trailing_comma = true

This way now and in the future it will automatically shrink multiple
lines as needed.
parent 4e90c113
Loading
Loading
Loading
Loading
+2 −12
Original line number Diff line number Diff line
@@ -7,13 +7,7 @@ import pprint
import textwrap
from collections.abc import Iterable
from types import ModuleType
from typing import (
    Any,
    ClassVar,
    Generic,
    TYPE_CHECKING,
    TypeVar,
)
from typing import Any, ClassVar, Generic, TYPE_CHECKING, TypeVar

import gitlab
from gitlab import types as g_types
@@ -21,11 +15,7 @@ from gitlab.exceptions import GitlabParsingError

from .client import Gitlab, GitlabList

__all__ = [
    "RESTObject",
    "RESTObjectList",
    "RESTManager",
]
__all__ = ["RESTObject", "RESTObjectList", "RESTManager"]


_URL_ATTRIBUTE_ERROR = (
+1 −8
Original line number Diff line number Diff line
@@ -8,14 +8,7 @@ import pathlib
import re
import sys
from types import ModuleType
from typing import (
    Any,
    Callable,
    cast,
    NoReturn,
    TYPE_CHECKING,
    TypeVar,
)
from typing import Any, Callable, cast, NoReturn, TYPE_CHECKING, TypeVar

from requests.structures import CaseInsensitiveDict

+7 −25
Original line number Diff line number Diff line
@@ -4,12 +4,7 @@ from __future__ import annotations

import os
import re
from typing import (
    Any,
    BinaryIO,
    cast,
    TYPE_CHECKING,
)
from typing import Any, BinaryIO, cast, TYPE_CHECKING
from urllib import parse

import requests
@@ -952,11 +947,7 @@ class Gitlab:
                f"`get_all=False` to the `list()` call."
            )
            show_caller = True
        utils.warn(
            message=message,
            category=UserWarning,
            show_caller=show_caller,
        )
        utils.warn(message=message, category=UserWarning, show_caller=show_caller)
        return items

    def http_post(
@@ -1097,12 +1088,7 @@ class Gitlab:
        post_data = post_data or {}

        result = self.http_request(
            "patch",
            path,
            query_data=query_data,
            post_data=post_data,
            raw=raw,
            **kwargs,
            "patch", path, query_data=query_data, post_data=post_data, raw=raw, **kwargs
        )
        if result.status_code in gitlab.const.NO_JSON_RESPONSE_CODES:
            return result
@@ -1383,13 +1369,11 @@ class GraphQL(_BaseGraphQL):

                if e.code == 401:
                    raise gitlab.exceptions.GitlabAuthenticationError(
                        response_code=e.code,
                        error_message=str(e),
                        response_code=e.code, error_message=str(e)
                    )

                raise gitlab.exceptions.GitlabHttpError(
                    response_code=e.code,
                    error_message=str(e),
                    response_code=e.code, error_message=str(e)
                )

            return result
@@ -1459,13 +1443,11 @@ class AsyncGraphQL(_BaseGraphQL):

                if e.code == 401:
                    raise gitlab.exceptions.GitlabAuthenticationError(
                        response_code=e.code,
                        error_message=str(e),
                        response_code=e.code, error_message=str(e)
                    )

                raise gitlab.exceptions.GitlabHttpError(
                    response_code=e.code,
                    error_message=str(e),
                    response_code=e.code, error_message=str(e)
                )

            return result
+1 −3
Original line number Diff line number Diff line
@@ -26,9 +26,7 @@ def _resolve_file(filepath: Path | str) -> str:
    return str(resolved)


def _get_config_files(
    config_files: list[str] | None = None,
) -> str | list[str]:
def _get_config_files(config_files: list[str] | None = None) -> str | list[str]:
    """
    Return resolved path(s) to config files if they exist, with precedence:
    1. Files passed in config_files
+3 −13
Original line number Diff line number Diff line
@@ -3,13 +3,7 @@ from __future__ import annotations
import enum
from collections.abc import Iterator
from types import ModuleType
from typing import (
    Any,
    Callable,
    Literal,
    overload,
    TYPE_CHECKING,
)
from typing import Any, Callable, Literal, overload, TYPE_CHECKING

import requests

@@ -261,9 +255,7 @@ class UpdateMixin(base.RESTManager[base.TObjCls]):
    # Update mixins attrs for easier implementation
    _update_method: UpdateMethod = UpdateMethod.PUT

    def _get_update_method(
        self,
    ) -> Callable[..., dict[str, Any] | requests.Response]:
    def _get_update_method(self) -> Callable[..., dict[str, Any] | requests.Response]:
        """Return the HTTP method to use.

        Returns:
@@ -931,9 +923,7 @@ class PromoteMixin(_RestObjectBase):
    _update_method: UpdateMethod = UpdateMethod.PUT
    manager: base.RESTManager[Any]

    def _get_update_method(
        self,
    ) -> Callable[..., dict[str, Any] | requests.Response]:
    def _get_update_method(self) -> Callable[..., dict[str, Any] | requests.Response]:
        """Return the HTTP method to use.

        Returns:
Loading