Skip to content

(style) ruff pass: import sorting, unused imports, typing-stub cleanup - #71

Open
rhoadesScholar wants to merge 1 commit into
v2.0_patchfrom
v2.0_patch_ruff
Open

(style) ruff pass: import sorting, unused imports, typing-stub cleanup#71
rhoadesScholar wants to merge 1 commit into
v2.0_patchfrom
v2.0_patch_ruff

Conversation

@rhoadesScholar

Copy link
Copy Markdown
Contributor

Split out of #70 so the functional changes there stay reviewable. No behavior changes — this is a ruff --fix pass over the Python sources.

Stacked on v2.0_patch: merge #70 first, or retarget this to v2.0 afterwards.

What's here

44 files, all Python/stubs (no Rust, no docs, no test logic):

  • Import sorting (I001) — stdlib / third-party / first-party grouping across daisy-py/python/daisy/, tests/, benchmarks/, examples/.
  • 3 duplicate-import dedupsbenchmarks/bench_dependency_graph.py, benchmarks/bench_worker_scaling.py, tests/test_worker_restarts.py each imported the same module twice.
  • 9 unused-import removals (F401) — pytest from tests/daisy_compat/test_clients_close.py, tests/daisy_compat/test_dead_workers.py, tests/test_tcp_client.py; threading from examples/mws.py and tests/test_tcp_client.py; subprocess/sys from tests/test_context_passing.py; tempfile from tests/test_done_marker.py; Block from tests/test_tcp_client.py.
  • 2 now-redundant # noqa removals (RUF100) — the suppressed rules no longer fire on those lines.
  • Callable moved typingcollections.abc (UP035) in _daisy.pyi.
  • Stub cleanups in _daisy.pyi — three redundant __repr__ declarations dropped (PYI029: stubs inherit object.__repr__), and timeout: float | int | object | Nonefloat | object | None (PYI041: int is redundant beside float under the numeric tower).

Verification that it's semantically neutral

An AST-level comparison of every changed file's import set (name + alias, order-insensitive) before vs. after confirms the only net changes are the 9 removals, the 3 dedups, and the Callable module move — everything else is pure reordering. Each removed name was checked to have zero remaining references (the one lingering Block match in tests/test_tcp_client.py is inside a comment).

Full suites pass on this branch and on v2.0_patch identically: pytest tests/ 204 passed / 1 xfailed, cargo test -p daisy-core 46 passed.

Not in scope

The tree is not lint-clean after this — ruff check . still reports 74 findings, dominated by BLE001 (18 blind excepts) and S110 (15 try/except/pass), most of which are deliberate best-effort cleanup paths in the logging and worker-teardown code. There's also no ruff config in pyproject.toml and no lint CI job, so none of this is enforced going forward. Happy to follow up with a pinned [tool.ruff] section plus a CI check if you want the invariant to hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KxYd8bCjgZLoESSe3smbwF

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