From 64aa86dd399ac87bbe6e1a3f2f16aa1bc52e0a57 Mon Sep 17 00:00:00 2001 From: Mauricio Villegas <5780272+mauvilsa@users.noreply.github.com> Date: Thu, 25 Jul 2024 11:04:05 +0200 Subject: [PATCH] Fix sed commands and update versions --- .pre-commit-config.yaml | 14 +++++++------- jsonargparse/_postponed_annotations.py | 2 +- jsonargparse/_stubs_resolver.py | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d4451c28..6b16e61f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.0 + rev: v0.5.4 hooks: - id: ruff args: ["--fix"] @@ -40,14 +40,14 @@ repos: - id: yesqa - repo: https://github.com/crate-ci/typos - rev: v1.22.9 + rev: v1.23.3 hooks: - id: typos args: [] verbose: true - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.1 + rev: v1.11.0 hooks: - id: mypy files: jsonargparse.*/.*.py @@ -88,7 +88,7 @@ repos: if [ "$CHANGELOG" != "$EXPECTED" ] && [ $(echo $BUMPVERSION_NEW_VERSION | grep -cE "[0-9.]+(\.dev|rc)[0-9]+") = 0 ]; then if [ $(grep -c "^v$BUMPVERSION_NEW_VERSION " CHANGELOG.rst) = 1 ]; then echo "Updating the date for v$BUMPVERSION_NEW_VERSION in CHANGELOG.rst"; - sed -ir "s|^v$BUMPVERSION_NEW_VERSION .*|$EXPECTED|" CHANGELOG.rst; + sed -i "s|^v$BUMPVERSION_NEW_VERSION .*|$EXPECTED|" CHANGELOG.rst; git add CHANGELOG.rst; else echo "Expected release in CHANGELOG.rst to be "$EXPECTED" or not have a definitive date."; @@ -137,9 +137,9 @@ repos: cd "$TEST_DIR"; pip install "pydantic<2"; pytest test_dataclass_like.py; - sed -ir "s|import pydantic|import pydantic.v1 as pydantic|" test_dataclass_like.py; - sed -ir "s|^annotated = .*|annotated = False|" test_dataclass_like.py; - sed -ir "s|test_pydantic_types|_test_pydantic_types|" test_dataclass_like.py; + sed -i "s|import pydantic|import pydantic.v1 as pydantic|" test_dataclass_like.py; + sed -i "s|^annotated = .*|annotated = False|" test_dataclass_like.py; + sed -i "s|test_pydantic_types|_test_pydantic_types|" test_dataclass_like.py; pip install "pydantic>=2"; pytest test_dataclass_like.py;' stages: [pre-push] diff --git a/jsonargparse/_postponed_annotations.py b/jsonargparse/_postponed_annotations.py index e5a62790..d1a5e112 100644 --- a/jsonargparse/_postponed_annotations.py +++ b/jsonargparse/_postponed_annotations.py @@ -51,7 +51,7 @@ def visit_BinOp(self, node: ast.BinOp) -> Union[ast.BinOp, ast.Subscript]: self.append_union_elts(node.right, elts) out_node = ast.Subscript( value=self.new_name_load(union_map), - slice=ast.Index( + slice=ast.Index( # type: ignore[arg-type,call-arg] value=ast.Tuple(elts=elts, ctx=ast.Load()), ctx=ast.Load(), ), diff --git a/jsonargparse/_stubs_resolver.py b/jsonargparse/_stubs_resolver.py index 1ae774c4..a303f5d7 100644 --- a/jsonargparse/_stubs_resolver.py +++ b/jsonargparse/_stubs_resolver.py @@ -50,8 +50,8 @@ def find(self, node: ast.AST, module_path: str) -> Dict[str, Tuple[Optional[str] def ast_annassign_to_assign(node: ast.AnnAssign) -> ast.Assign: return ast.Assign( targets=[node.target], - value=node.value, - type_ignores=[], + value=node.value, # type: ignore[arg-type] + type_ignores=[], # type: ignore[call-arg] lineno=node.lineno, end_lineno=node.lineno, )