Skip to content

chore: ruff auto-fix PIE807 — reimplemented-container-builtin - #42035

Closed
wesleysimplicio wants to merge 1 commit into
NousResearch:mainfrom
wesleysimplicio:chore/ruff-PIE807
Closed

wesleysimplicio wants to merge 1 commit into
NousResearch:mainfrom
wesleysimplicio:chore/ruff-PIE807

Conversation

@wesleysimplicio

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds the PIE807 rule to pyproject.toml and applies auto-fix across 59 files.

Replaces reimplemented container builtins with their literal equivalents — e.g., list(iterable), dict(iterable), set(iterable)[*iterable], etc., where the intention is clearly to build a list/dict/set literal.

Root cause

list(...), dict(...), and set(...) called with a non-keyword argument that is an iterable can often be expressed as a literal comprehension or starred expression, which is more idiomatic and avoids the call overhead. Leaving them as-is is correct but inconsistent.

Fix

  • Added PIE807 to [tool.ruff.lint] select in pyproject.toml.
  • Ran ruff check --select PIE807 --preview --fix . — 218 errors fixed across 59 files.

Why this shape

Same per-rule pattern as the existing ruff PRs (#31825#32027, #42034): one rule, one auto-fix, one commit. Keeps diffs focused and blame history clean.

Tests

  • ruff check passes with zero errors after the fix (rule is active in config).
  • No runtime behaviour changed — only syntactic transformations to container literal forms.
  • Existing pytest suite continues to pass.

Related PRs / issues

  • Part of the ongoing ruff rule enablement campaign.
  • No competing PRs found for PIE807.

@wesleysimplicio
wesleysimplicio requested a review from a team June 8, 2026 11:08
@alt-glitch alt-glitch added type/refactor Code restructuring, no behavior change P3 Low — cosmetic, nice to have labels Jun 8, 2026
@austinpickett

Copy link
Copy Markdown
Collaborator

See consolidation note on #42036 — these four ruff PRs overlap and should be combined into one before merging.

@wesleysimplicio

Copy link
Copy Markdown
Contributor Author

Closing in favor of consolidated PR (per austinpickett's request on #42036 — combining all four ruff PRs into one.)

@wesleysimplicio
wesleysimplicio deleted the chore/ruff-PIE807 branch June 12, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants