diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 664e556e..b3b32647 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-added-large-files args: ['--maxkb=25'] @@ -25,7 +25,7 @@ repos: - id: python-no-log-warn - id: text-unicode-replacement-char - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.4 + rev: v0.13.2 hooks: - id: ruff-format - id: ruff-check @@ -55,7 +55,7 @@ repos: - id: nbstripout exclude: (docs) - repo: https://github.com/crate-ci/typos - rev: v1.34.0 + rev: v1 hooks: - id: typos exclude: (\.ipynb) diff --git a/pyproject.toml b/pyproject.toml index d76c64a9..17d9f8fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -122,7 +122,6 @@ ignore = [ "COM812", # Comply with ruff-format. "ISC001", # Comply with ruff-format. "FBT", - "PD901", # Avoid generic df for dataframes. "S101", # raise errors for asserts. "S603", # Call check with subprocess.run. "S607", # Call subprocess.run with partial executable path. diff --git a/src/_pytask/build.py b/src/_pytask/build.py index 7c912d59..b5ccf0bf 100644 --- a/src/_pytask/build.py +++ b/src/_pytask/build.py @@ -254,7 +254,7 @@ def build( # noqa: C901, PLR0912, PLR0913 session = Session.from_config(config_) - except (ConfigurationError, Exception): + except (ConfigurationError, Exception): # noqa: BLE001 console.print(Traceback(sys.exc_info())) session = Session(exit_code=ExitCode.CONFIGURATION_FAILED) diff --git a/src/_pytask/click.py b/src/_pytask/click.py index e52ca571..215a8c05 100644 --- a/src/_pytask/click.py +++ b/src/_pytask/click.py @@ -174,7 +174,7 @@ def parse_args(self, ctx: Context, args: list[str]) -> list[str]: opts, args, param_order = parser.parse_args(args=args) for param in _iter_params_for_processing(param_order, self.get_params(ctx)): - value, args = param.handle_parse_result(ctx, opts, args) + _value, args = param.handle_parse_result(ctx, opts, args) if args and not ctx.allow_extra_args and not ctx.resilient_parsing: ctx.fail( diff --git a/src/_pytask/collect_command.py b/src/_pytask/collect_command.py index 2e953e5c..6b7b8f6a 100644 --- a/src/_pytask/collect_command.py +++ b/src/_pytask/collect_command.py @@ -63,7 +63,7 @@ def collect(**raw_config: Any | None) -> NoReturn: config = pm.hook.pytask_configure(pm=pm, raw_config=raw_config) session = Session.from_config(config) - except (ConfigurationError, Exception): # pragma: no cover + except (ConfigurationError, Exception): # noqa: BLE001 # pragma: no cover session = Session(exit_code=ExitCode.CONFIGURATION_FAILED) console.print_exception() diff --git a/src/_pytask/dag_command.py b/src/_pytask/dag_command.py index 3c5ac1ec..8127735f 100644 --- a/src/_pytask/dag_command.py +++ b/src/_pytask/dag_command.py @@ -87,7 +87,7 @@ def dag(**raw_config: Any) -> int: config = pm.hook.pytask_configure(pm=pm, raw_config=raw_config) session = Session.from_config(config) - except (ConfigurationError, Exception): # pragma: no cover + except (ConfigurationError, Exception): # noqa: BLE001 # pragma: no cover console.print_exception() session = Session(exit_code=ExitCode.CONFIGURATION_FAILED) @@ -183,7 +183,7 @@ def build_dag(raw_config: dict[str, Any]) -> nx.DiGraph: session = Session.from_config(config) - except (ConfigurationError, Exception): # pragma: no cover + except (ConfigurationError, Exception): # noqa: BLE001 # pragma: no cover console.print_exception() session = Session(exit_code=ExitCode.CONFIGURATION_FAILED) diff --git a/src/_pytask/mark/__init__.py b/src/_pytask/mark/__init__.py index e2586a46..9d49b6e0 100644 --- a/src/_pytask/mark/__init__.py +++ b/src/_pytask/mark/__init__.py @@ -59,7 +59,7 @@ def markers(**raw_config: Any) -> NoReturn: config = pm.hook.pytask_configure(pm=pm, raw_config=raw_config) session = Session.from_config(config) - except (ConfigurationError, Exception): # pragma: no cover + except (ConfigurationError, Exception): # noqa: BLE001 # pragma: no cover console.print_exception() session = Session(exit_code=ExitCode.CONFIGURATION_FAILED) diff --git a/src/_pytask/profile.py b/src/_pytask/profile.py index 5063e511..60884708 100644 --- a/src/_pytask/profile.py +++ b/src/_pytask/profile.py @@ -121,7 +121,7 @@ def profile(**raw_config: Any) -> NoReturn: config = pm.hook.pytask_configure(pm=pm, raw_config=raw_config) session = Session.from_config(config) - except (ConfigurationError, Exception): # pragma: no cover + except (ConfigurationError, Exception): # noqa: BLE001 # pragma: no cover session = Session(exit_code=ExitCode.CONFIGURATION_FAILED) console.print(Traceback(sys.exc_info())) diff --git a/tests/test_capture.py b/tests/test_capture.py index e0c0f6b2..380b31aa 100644 --- a/tests/test_capture.py +++ b/tests/test_capture.py @@ -188,7 +188,7 @@ def test_capturing_basic_api(self, method): assert outerr == ("", "") print("hello") capman.suspend() - out, err = capman.read() + out, _err = capman.read() if method == CaptureMethod.NO: assert old == (sys.stdout, sys.stderr, sys.stdin) else: @@ -196,7 +196,7 @@ def test_capturing_basic_api(self, method): capman.resume() print("hello") capman.suspend() - out, err = capman.read() + out, _err = capman.read() if method != CaptureMethod.NO: assert out == "hello\n" capman.stop_capturing() @@ -624,7 +624,7 @@ def test_capture_results_accessible_by_attribute(self): def test_capturing_readouterr_unicode(self): with self.getcapture() as cap: print("hxąć") - out, err = cap.readouterr() + out, _err = cap.readouterr() assert out == "hxąć\n" def test_reset_twice_error(self): @@ -656,8 +656,8 @@ def test_capturing_error_recursive(self): print("cap1") with self.getcapture() as cap2: print("cap2") - out2, err2 = cap2.readouterr() - out1, err1 = cap1.readouterr() + out2, _err2 = cap2.readouterr() + out1, _err1 = cap1.readouterr() assert out1 == "cap1\n" assert out2 == "cap2\n" @@ -702,8 +702,8 @@ def test_capturing_error_recursive(self): print("cap1") with self.getcapture() as cap2: print("cap2") - out2, err2 = cap2.readouterr() - out1, err1 = cap1.readouterr() + out2, _err2 = cap2.readouterr() + out1, _err1 = cap1.readouterr() assert out1 == "cap1\ncap2\n" assert out2 == "cap2\n" diff --git a/tests/test_compat.py b/tests/test_compat.py index 10bc0f26..df4aaf9f 100644 --- a/tests/test_compat.py +++ b/tests/test_compat.py @@ -149,5 +149,5 @@ def test_no_version_raises(monkeypatch): sys.modules[name] = module monkeypatch.setitem(_MINIMUM_VERSIONS, name, "1.0.0") - with pytest.raises(ImportError, match="Can't determine .* fakemodule"): + with pytest.raises(ImportError, match=r"Can't determine .* fakemodule"): import_optional_dependency(name) diff --git a/tests/test_dag_utils.py b/tests/test_dag_utils.py index aaeefa41..a33c04c7 100644 --- a/tests/test_dag_utils.py +++ b/tests/test_dag_utils.py @@ -153,7 +153,7 @@ def test_raise_error_for_cycle_in_graph(dag): "115f685b0af2aef0c7317a0b48562f34cfb7a622549562bd3d34d4d948b4fdab", "55c6cef62d3e62d5f8fc65bb846e66d8d0d3ca60608c04f6f7b095ea073a7dcf", ) - with pytest.raises(ValueError, match="The DAG contains cycles."): + with pytest.raises(ValueError, match=r"The DAG contains cycles\."): TopologicalSorter.from_dag(dag)