From dfe43347f0cf88b4cbf7bc2cbeb2a6da5544ab11 Mon Sep 17 00:00:00 2001 From: Peter Van Dyken Date: Wed, 13 Dec 2023 11:32:35 -0500 Subject: [PATCH] Narrow PERF ruleset --- pyproject.toml | 3 ++- snakebids/core/input_generation.py | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a6186368..3d24e363 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -166,12 +166,13 @@ select = [ # "PTH", # flake8-use-pathlib "TRY", # tryceratops "FLY", # flynt - "PERF", # Perflint "D", # pydocstyle "PL", # pylint "RUF", # ruff "T100", # debugger "I", # isort + # Other perf rules give more false positives than benefits + "PERF101", # do not cast iterable to list ] ignore = [ "PLR0913", diff --git a/snakebids/core/input_generation.py b/snakebids/core/input_generation.py index 00203f38..03ba996a 100644 --- a/snakebids/core/input_generation.py +++ b/snakebids/core/input_generation.py @@ -451,8 +451,7 @@ def write_derivative_json(snakemake: Snakemake, **kwargs: dict[str, Any]) -> Non This function requires input.json and output.json to be defined, as it will read and write json files """ - with open(snakemake.input.json, encoding="utf-8") as input_json: - sidecar = json.load(input_json) + sidecar = json.loads(Path(snakemake.input.json).read_text()) sidecar.update( {