Fix F402: rename loop var to avoid shadowing SQLAlchemy table import #34

Closed
Barcode Betty wants to merge 1 commits from barcode-betty/fix-lint-f402 into dev
Member

Summary

Fix ruff lint error F402 in tests/test_encrypted_json.py.

The problem

PR #32 introduced a loop variable named table in the engine fixture to strip PostgreSQL server_defaults for SQLite compatibility:

for table in Base.metadata.tables.values():
    for col in table.columns.values():

However, table is also the name of an imported SQLAlchemy class. Ruff rule F402 fires when a loop variable shadows an import from the same scope.

The fix

Rename the loop variable from tabletbl.

Testing

  • ruff check tests/test_encrypted_json.py passes locally
  • CI should show lint job passing

cc @cpfarhood

## Summary Fix ruff lint error F402 in `tests/test_encrypted_json.py`. ### The problem PR #32 introduced a loop variable named `table` in the `engine` fixture to strip PostgreSQL server_defaults for SQLite compatibility: ```python for table in Base.metadata.tables.values(): for col in table.columns.values(): ``` However, `table` is also the name of an imported SQLAlchemy class. Ruff rule F402 fires when a loop variable shadows an import from the same scope. ### The fix Rename the loop variable from `table` → `tbl`. ### Testing - `ruff check tests/test_encrypted_json.py` passes locally - CI should show lint job passing --- cc @cpfarhood
Barcode Betty added 1 commit 2026-05-24 18:19:02 +00:00
Fix F402: rename loop var 'table' to 'tbl' to avoid shadowing SQLAlchemy table import
CI / lint (pull_request) Successful in 5s
CI / typecheck (pull_request) Failing after 20s
CI / test (pull_request) Failing after 31s
CI / build-and-push (pull_request) Has been skipped
CI / deploy-dev (pull_request) Has been skipped
CI / deploy-uat (pull_request) Has been skipped
dd8ed4aec1
The for loop variable 'table' shadows the imported SQLAlchemy table()
from line 8. Ruff rule F402 fires when a loop variable shadows an import.
Rename to 'tbl'.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Owner

Closing: F402 lint fix superseded by PR #42 (CAR-1132 comprehensive fix) which includes this fix plus SQLite UUID and server_default fixes.

Closing: F402 lint fix superseded by PR #42 (CAR-1132 comprehensive fix) which includes this fix plus SQLite UUID and server_default fixes.
Coupon Carl closed this pull request 2026-06-03 11:08:46 +00:00
Some checks are pending
CI / lint (pull_request) Successful in 5s
CI / typecheck (pull_request) Failing after 20s
CI / test (pull_request) Failing after 31s
CI / build-and-push (pull_request) Has been skipped
CI / deploy-dev (pull_request) Has been skipped
CI / deploy-uat (pull_request) Has been skipped

Pull request closed

Sign in to join this conversation.