From f3110e5456a33204509b4b8a9555f60b392767f9 Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Mon, 25 Nov 2024 13:40:27 +0530 Subject: [PATCH] fix: use `with` to read pyproject.toml Also fix variable name Signed-off-by: Akhil Narang --- bench/utils/bench.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bench/utils/bench.py b/bench/utils/bench.py index 8a455d5f..b96417f8 100644 --- a/bench/utils/bench.py +++ b/bench/utils/bench.py @@ -114,10 +114,11 @@ def _generate_dev_deps_pattern(pyproject_path): from tomllib import loads requirements_pattern = "" - pyroject_config = loads(open(pyproject_path).read()) + with open(pyproject_path) as f: + pyproject_config = loads(f.read()) with contextlib.suppress(KeyError): - for pkg, version in pyroject_config["tool"]["bench"]["dev-dependencies"].items(): + for pkg, version in pyproject_config["tool"]["bench"]["dev-dependencies"].items(): op = "==" if "=" not in version else "" requirements_pattern += f"{pkg}{op}{version} " return requirements_pattern