Skip to content

Commit

Permalink
[MegaLinter] Apply linters fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurt-von-Laven authored and megalinter-bot committed Apr 9, 2023
1 parent 29a746e commit 0f80c9d
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions megalinter/config.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -20,6 +20,7 @@
)
JsonObject = dict[str, JsonValue]


def init_config(workspace=None):
global CONFIG_DATA, CONFIG_SOURCE
if CONFIG_DATA is not None:
Expand Down Expand Up @@ -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"])
Expand Down Expand Up @@ -124,17 +125,15 @@ def combine_config(
extends_config_data,
combined_config,
config_source,
parsed_uri
parsed_uri,
)
combined_config.update(config)
return config_source


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)


Expand Down

0 comments on commit 0f80c9d

Please sign in to comment.