Skip to content

style(miles): hoist function-local imports to module top#25

Open
TianyeGGBond wants to merge 1 commit into
rlops:zhenyu/miles-mvp-e2efrom
TianyeGGBond:tianye/m11-hoist-imports
Open

style(miles): hoist function-local imports to module top#25
TianyeGGBond wants to merge 1 commit into
rlops:zhenyu/miles-mvp-e2efrom
TianyeGGBond:tianye/m11-hoist-imports

Conversation

@TianyeGGBond

Copy link
Copy Markdown
Collaborator

Context

Two cheap stdlib imports were done inside method bodies instead of at the
module top, which is out of step with the rest of these files (everything
else imports at the top). Neither has a circular-import reason to be local.

Change

  • pipeline/miles_model_update_service.py: drop the redundant
    import asyncio inside sync_selected_workers — the module already
    imports asyncio at the top.
  • pipeline/miles_coordinator.py: add import os at the top and replace
    the two import os as _os / _os.environ.get(...) sites
    (_expand_workers, _make_actor_scheduling_strategy) with os.environ.

No behavior change; +3 / -7 lines.

asyncio (miles_model_update_service) and os (miles_coordinator) were
imported inside method bodies. Both are already cheap stdlib imports with
no circular-import concern, so move them to the module top to match the
surrounding import style.

- miles_model_update_service.py: drop the redundant `import asyncio` inside
  sync_selected_workers (the module already imports asyncio at the top).
- miles_coordinator.py: add `import os` at the top and replace the two
  `import os as _os` / `_os.environ` sites with `os.environ`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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