mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-11 21:26:44 +00:00
59 test files imported `unittest` and then `from unittest import mock`, giving the same names two spellings so a call site no longer says which one it follows. CodeQL flags this as py/import-and-import-from; at 59 occurrences it is the single largest item in the repo's code-scanning backlog. Keep `import unittest` and reach the submodule as `import unittest.mock as mock`. Both are ast.Import, which is what the rule asks for, and `mock.<attr>` call sites stay untouched — the diff is exactly one line per file and nothing else. The opposite direction would have been wrong here: PLR0402 rewrites `import a.b as c` into `from a import b`, i.e. straight back into the pattern CodeQL flags. It is deliberately absent from the ruff select list in pyproject.toml, so nothing in the toolchain will undo this. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>