From bf42469844796fc03e9b97a5be46b72545a58d2d Mon Sep 17 00:00:00 2001 From: Danipulok Date: Tue, 1 Sep 2026 22:25:03 +0000 Subject: [PATCH] chore(ruff): take `target-version` from `requires-python` --- pyproject.toml | 1 - pytest_examples/run_code.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e5472f3..1abb840 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,6 @@ xfail_strict = true [tool.ruff] line-length = 120 -target-version = "py39" include = ["pytest_examples/**/*.py", "tests/**/*.py", "examples/**/*.py"] exclude = ["tests/cases_update/*.py"] diff --git a/pytest_examples/run_code.py b/pytest_examples/run_code.py index 4b2d446..3bdca2c 100644 --- a/pytest_examples/run_code.py +++ b/pytest_examples/run_code.py @@ -358,12 +358,12 @@ def expr_last_line(c: ast.expr) -> int: return maybe_plus_1(c, expr_last_line(c.args[-1])) else: return c.lineno - elif isinstance(c, (ast.List, ast.Tuple, ast.Set)): + elif isinstance(c, ast.List | ast.Tuple | ast.Set): if c.elts: return maybe_plus_1(c, expr_last_line(c.elts[-1])) else: return c.lineno - elif isinstance(c, (ast.ListComp, ast.SetComp, ast.DictComp, ast.GeneratorExp)): + elif isinstance(c, ast.ListComp | ast.SetComp | ast.DictComp | ast.GeneratorExp): gen = c.generators[-1] if gen.ifs: return maybe_plus_1(c, expr_last_line(gen.ifs[-1]))