Skip to content

Commit

Permalink
chore(deps): Update ruff and adapt code
Browse files Browse the repository at this point in the history
  • Loading branch information
martis42 committed Jul 8, 2024
1 parent 5d8d5e6 commit 3395af1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 4 additions & 8 deletions test/aspect/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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]:
Expand All @@ -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:
Expand Down

0 comments on commit 3395af1

Please sign in to comment.