Skip to content

chore: prefix unused loop control variables with underscore (ruff B007)#170

Open
alexzhu0 wants to merge 1 commit into
FlowElement-ai:mainfrom
alexzhu0:chore/rename-unused-loop-vars-b007
Open

chore: prefix unused loop control variables with underscore (ruff B007)#170
alexzhu0 wants to merge 1 commit into
FlowElement-ai:mainfrom
alexzhu0:chore/rename-unused-loop-vars-b007

Conversation

@alexzhu0
Copy link
Copy Markdown
Contributor

@alexzhu0 alexzhu0 commented May 8, 2026

Summary

Cosmetic fix for B007 — when a loop variable is discarded (typical in tuple-unpacking from .items(), enumerate(), or graph edges), prefixing with _ signals intent to readers and matches PEP 8's convention for ignored bindings. No runtime change.

Coverage

10 of 11 B007 hits across the codebase. The remaining one (process_data_items.py:266) is a false positiveresult is read after the async for loop as the return value (the idiom is to drain the generator and keep the last yielded value). Left untouched intentionally.

Files Changed

File Change
adapters/hybrid/neptune_analytics/NeptuneAnalyticsAdapter.py i_i in vector-padding enumerate
api/v1/delete/node_deletion.py src_props, rel_name_src_props, _rel_name (only dst_props is read)
config/settings/persist_env.py old_value_old_value
memory/procedural/validators/procedural_validator.py (×2) edge_edge (only the pack is read)
retrieval/procedural_retriever.py (×2) pid_pid in dict iteration
retrieval/time/query_time_parser.py ptype_ptype
tests/unit/auth/test_permission_concurrency.py i_i in stress-loop

Verification

ruff check <touched files> --select B007  # All checks passed!
python -m py_compile <touched files>      # OK

Method: 9 hits applied via ruff --fix --unsafe-fixes --select B007, 1 manual (_ptype). All diffs reviewed by hand to confirm the variable is genuinely unused in each scope.

Pure cosmetic fix: when a tuple-unpacking or enumerate loop discards a
variable, the underscore prefix signals intent to readers and silences
B007. No runtime behavior change.

Touches 6 files across adapters, api, config, memory, retrieval, tests.
All 11 occurrences flagged by `ruff --select B007` are addressed:
9 via `ruff --fix --unsafe-fixes`, 2 reviewed and applied manually
(the third remaining hit is a false positive — `result` is read after
the async-for loop as the return value, kept as-is).
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.

1 participant