From 3395af13d67c0bc15e06f08a7e239f45d56a36be Mon Sep 17 00:00:00 2001 From: Martin Medler Date: Mon, 8 Jul 2024 22:33:59 +0200 Subject: [PATCH] chore(deps): Update ruff and adapt code --- .pre-commit-config.yaml | 2 +- ruff.toml | 1 - test/aspect/result.py | 12 ++++-------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 63fb8bde..64221618 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: ] - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.4.7 + rev: v0.5.1 hooks: - id: ruff-format # Linting diff --git a/ruff.toml b/ruff.toml index 90394328..6c4cd7e1 100644 --- a/ruff.toml +++ b/ruff.toml @@ -25,7 +25,6 @@ ignore = [ "NPY", # numpy "PD", # pandas "PT", # pytest - "TRIO", # trio # This documentation style is too opinionated and too verbose, given our Python code is an implementation detail. "D", # Users are not expected to see exceptions. Optimizing the trace is not worth more complex code. diff --git a/test/aspect/result.py b/test/aspect/result.py index 3ae2d52a..3169d554 100644 --- a/test/aspect/result.py +++ b/test/aspect/result.py @@ -76,7 +76,7 @@ def matches_expectation(self, return_code: int, dwyu_output: str) -> bool: output=output_lines, ): return False - if not ExpectedResult._has_expected_errors( + if not ExpectedResult._has_expected_errors( # noqa: SIM103 expected_errors=self.deps_which_should_be_private, error_category=CATEGORY_NON_PRIVATE_DEPS, output=output_lines, @@ -88,9 +88,7 @@ def matches_expectation(self, return_code: int, dwyu_output: str) -> bool: def _has_correct_status(self, return_code: int, output: str) -> bool: if self.success and return_code == 0: return True - if not self.success and return_code != 0 and DWYU_FAILURE in output: - return True - return False + return not self.success and return_code != 0 and DWYU_FAILURE in output @staticmethod def _get_error_lines(idx_category: int, output: list[str]) -> list[str]: @@ -112,12 +110,10 @@ def _has_expected_errors(expected_errors: list[str], error_category: str, output if idx_category is None: return False - if not ExpectedResult._has_errors( + return ExpectedResult._has_errors( error_lines=ExpectedResult._get_error_lines(idx_category=idx_category, output=output), expected_errors=expected_errors, - ): - return False - return True + ) @staticmethod def _find_line_with(lines: list[str], val: str) -> int | None: