Skip to content

Ruff check - #937

Merged
gertjanvanzwieten merged 10 commits into
mainfrom
next
Sep 21, 2026
Merged

gertjanvanzwieten merged 10 commits into
mainfrom
next

Conversation

@gertjanvanzwieten

Copy link
Copy Markdown
Contributor

No description provided.

@gertjanvanzwieten

Copy link
Copy Markdown
Contributor Author

See #938 for failing MKL tests.

joostvanzwieten
joostvanzwieten previously approved these changes Sep 3, 2026
Comment thread src/nutils/evaluable.py Outdated
def _multiply(self, other):
if isinstance(other, Choose) and self.index == other.index:
return Choose(self.index, self.choices * other.choices)
return Choose(self.index, tuple(c1 * c2 for c1, c2 in zip(self.choices, other.choices)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we check here that self and other have the same number of items?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed and I also added the equivalent ._add simplification plus unit tests.

This patch changes the imports in matrix._auto from "from .x import assemble"
to "from . import x as _backend; assemble = _backend.assemble". The new,
lengthier form serves to make assemble's role as a module attribute clear to
tools like ruff check, which would otherwise suggest to remove the seemingly
unused import statements.
This patch contains all the fixes that ruff can apply automatically, such as
removing unused imports and unused format strings.
This patch fixes all issues flagged by ruff check --select F811:
redefined-while-unused.
This patches fixes all issues flagged by ruff check --select F841:
unused-variable.
This patch enables the test_normals tests, which were inactive due to missing
test_ prefixes, and fixes some issues caused by deprecated syntax.
This patch fixes most issues flagged by ruff check --select F821:
undefined-name, with the exeption of false positives. These are variables that
are undefined only in the first iteration of a loop, or type annotations that
avoid circular imports.
This patch fixes all issues flagged by ruff check --select E721:
type-comparison, which favours "is" and "is not" over "==" and "!=" when
comparing type objects.
This patch fixes all issues flagged by ruff check --select E711: not-is-test,
which favours "is None" over "== None".
This patch fixes all issues flagged by ruff check --select F401: unused-import.
This patch fixes all issues flagged by ruff check --select E701:
multiple-statements-on-one-line-colon.
@gertjanvanzwieten gertjanvanzwieten changed the title Miscellaneous small improvements Ruff check Sep 18, 2026
@gertjanvanzwieten

Copy link
Copy Markdown
Contributor Author

Rebased on top of #939 and limited to ruff fixes, remaining changes to follow in a separate PR.

@gertjanvanzwieten
gertjanvanzwieten merged commit 92b75d9 into main Sep 21, 2026
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants