Skip to content

Commit

Permalink
fix: using typing Dict
Browse files Browse the repository at this point in the history
  • Loading branch information
nichmor committed Apr 29, 2024
1 parent 4b703c6 commit e695b86
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ snapshot_update = "pytest --snapshot-update"


[environments]
test = ["test"]
test = ["test"]
14 changes: 6 additions & 8 deletions src/rattler_build_conda_compat/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import tomli
import github
import ruamel.yaml
from typing import Any, Mapping, Sequence
from typing import Any, Dict, Mapping, Sequence, List
import requests
from conda.models.version import VersionOrder
from functools import lru_cache
Expand Down Expand Up @@ -37,7 +37,7 @@ def _format_validation_msg(error: ValidationError):


@lru_cache
def get_recipe_schema() -> dict[Any, Any]:
def get_recipe_schema() -> Dict[Any, Any]:
return requests.get(SCHEMA_URL).json()


Expand Down Expand Up @@ -91,9 +91,7 @@ def lint_recipe_maintainers(maintainers_section, lints):
lints.append("Recipe maintainers should be a json list.")


def lint_recipe_tests(
test_section=dict(), outputs_section=list()
) -> (list[str], list[str]):
def lint_recipe_tests(test_section=dict(), outputs_section=list()):
TEST_KEYS = {"script", "python"}
lints = []
hints = []
Expand Down Expand Up @@ -121,19 +119,19 @@ def lint_recipe_tests(
return lints, hints


def lint_license_not_unknown(license: str, lints: list):
def lint_license_not_unknown(license: str, lints: List):
license = license.lower()
if "unknown" == license.strip():
lints.append("The recipe license cannot be unknown.")


def lint_build_number(build_section: dict, lints: list):
def lint_build_number(build_section: Dict, lints: List):
build_number = build_section.get("number", None)
if build_number is None:
lints.append("The recipe must have a `build/number` section.")


def lint_requirements_order(requirements_section: dict, lints: list):
def lint_requirements_order(requirements_section: Dict, lints: List):
seen_requirements = [k for k in requirements_section if k in REQUIREMENTS_ORDER]
requirements_order_sorted = sorted(seen_requirements, key=REQUIREMENTS_ORDER.index)
if seen_requirements != requirements_order_sorted:
Expand Down
4 changes: 2 additions & 2 deletions src/rattler_build_conda_compat/loader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from contextlib import contextmanager
import yaml
from typing import Any, Union
from typing import Any, Dict, Union


class RecipeLoader(yaml.BaseLoader):
Expand Down Expand Up @@ -87,7 +87,7 @@ def parse_recipe_config_file(path, namespace):
return remove_empty_keys(content)


def load_all_requirements(content) -> dict:
def load_all_requirements(content) -> Dict[str, Any]:
# with open(path) as f:
# content = yaml.load(f, Loader=yaml.BaseLoader)

Expand Down
2 changes: 1 addition & 1 deletion src/rattler_build_conda_compat/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def get_used_vars(self, force_top_level=False, force_global=False):

return set(used_vars)

def get_used_variant(self) -> dict:
def get_used_variant(self) -> Dict:
if "build_configuration" not in self.meta:
# it could be that we skip build for this platform
# so no variants have been discovered
Expand Down

0 comments on commit e695b86

Please sign in to comment.