diff --git a/megalinter/config.py b/megalinter/config.py index dd01826606a..a1498eefc4c 100644 --- a/megalinter/config.py +++ b/megalinter/config.py @@ -1,11 +1,11 @@ #!/usr/bin/env python3 -from collections.abc import Mapping, Sequence import json import logging import os -from pathlib import Path, PurePath import shlex import tempfile +from collections.abc import Mapping, Sequence +from pathlib import Path, PurePath from typing import AnyStr, cast from urllib.parse import ParseResult, urlparse, urlunparse @@ -20,6 +20,7 @@ ) JsonObject = dict[str, JsonValue] + def init_config(workspace=None): global CONFIG_DATA, CONFIG_SOURCE if CONFIG_DATA is not None: @@ -91,12 +92,12 @@ def init_config(workspace=None): def combine_config( - workspace: str | None, - config: JsonObject, - combined_config: JsonObject, - config_source: str, - child_uri: ParseResult | None = None - ) -> str: + workspace: str | None, + config: JsonObject, + combined_config: JsonObject, + config_source: str, + child_uri: ParseResult | None = None, +) -> str: workspace_path = Path(workspace) if workspace else None parsed_uri: ParseResult | None = None extends = cast(str | Sequence[str], config["EXTENDS"]) @@ -124,7 +125,7 @@ def combine_config( extends_config_data, combined_config, config_source, - parsed_uri + parsed_uri, ) combined_config.update(config) return config_source @@ -132,9 +133,7 @@ def combine_config( def download_config(uri: AnyStr) -> JsonObject: r = requests.get(uri, allow_redirects=True) - assert ( - r.status_code == 200 - ), f"Unable to retrieve EXTENDS config file {uri!r}" + assert r.status_code == 200, f"Unable to retrieve EXTENDS config file {uri!r}" return yaml.safe_load(r.content)