Skip to content

Commit

Permalink
fix: use lru_cache instead of cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nichmor committed Apr 29, 2024
1 parent b1894f1 commit 1e922a5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/rattler_build_conda_compat/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Any, Mapping, Sequence
import requests
from conda.models.version import VersionOrder
from functools import cache
from functools import lru_cache
from jsonschema import Draft202012Validator
from jsonschema import ValidationError
from textwrap import indent
Expand All @@ -26,15 +26,15 @@


def _format_validation_msg(error: ValidationError):
import pdb; pdb.set_trace()
return cleandoc(
f"""
In recipe.yaml: `{error.instance}`.
{indent(error.message, " " * 12 + "> ")}
In recipe.yaml: \n{indent(error.message, " " * 12 + "> ")}
"""
)


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

Expand All @@ -60,8 +60,8 @@ def lint_recipe_yaml_by_schema(recipe_file):
validator = Draft202012Validator(schema)

lints = []

for error in validator.iter_errors(meta):
for error in validator.iter_errors(meta):
lints.append(_format_validation_msg(error))
return lints

Expand Down

0 comments on commit 1e922a5

Please sign in to comment.