Skip to content

Fix flake8-bugbear B045 - #7557

Merged
ChrisPaulBennett merged 1 commit into
cylc:8.7.xfrom
MetRonnie:flake8
Oct 28, 2026
Merged

ChrisPaulBennett merged 1 commit into
cylc:8.7.xfrom
MetRonnie:flake8

Conversation

@MetRonnie

Copy link
Copy Markdown
Member

Loop control variable key overrides a variable in an enclosing loop

https://github.com/PyCQA/flake8-bugbear/releases/tag/26.10.27

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • No dependency changes
  • Tests, changelog, docs not needed
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

Loop control variable key overrides a variable in an enclosing loop
@MetRonnie MetRonnie added this to the 8.7.1 milestone Oct 27, 2026
@MetRonnie
MetRonnie requested a lite review from Copilot October 27, 2026 18:23
@MetRonnie MetRonnie self-assigned this Oct 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The reviewed changes address B045 without unresolved issues or behavioral changes.

No open issues 🎉

What changed in this PR

This pull request fixes flake8-bugbear B045 warnings by eliminating loop-variable shadowing while preserving existing workflow expansion and family definition behavior.

Changes:

  • Renames the inner workflow expansion variable in id_cli.py.
  • Simplifies ancestor iteration in data_store_mgr.py to avoid reusing enclosing loop variables.
  • Preserves existing token expansion and data-store behavior.
File Description
cylc/​flow/​id_cli.py Avoids shadowing the outer tokens loop variable during asynchronous workflow expansion.
cylc/​flow/​data_store_mgr.py Simplifies ancestor iteration to avoid loop-variable shadowing while retaining family definition generation.

Review effort: Lite

@MetRonnie

Copy link
Copy Markdown
Member Author

Test failures are unrelated - failure to install is due to #7549

@ChrisPaulBennett ChrisPaulBennett left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You beat me to it.
LGTM

@ChrisPaulBennett
ChrisPaulBennett merged commit a42debe into cylc:8.7.x Oct 28, 2026
31 of 39 checks passed
@MetRonnie
MetRonnie deleted the flake8 branch October 28, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants