Skip to content

Flatten over-nested single-file packages and __init__.py-only implementations under amber/src/main/python/core/util/ #4951

@Yicong-Huang

Description

@Yicong-Huang

Task Summary

Several core/util/<X>/<X>.py directories under amber/src/main/python/ exist only to host a single file, transplanting the Java/Scala "one class per directory" convention into Python where it adds noise without value:

  • core/util/runnable/runnable.py → should be core/util/runnable.py
  • core/util/stoppable/stoppable.py → should be core/util/stoppable.py
  • core/util/thread/atomic.py → should be core/util/atomic.py (or thread.py)
  • core/util/protocol/base_protocols.py → should be core/util/base_protocols.py
  • core/util/operator/__init__.py is 16 lines (license header only) — appears to be dead code

A related pattern: implementations written directly inside __init__.py rather than a named module:

  • core/util/expression_evaluator/__init__.py is 211 lines of evaluator implementation
  • core/util/virtual_identity/__init__.py is 99 lines of virtual-identity logic

__init__.py should re-export from a sibling module, not host the implementation.

Task Type

  • Refactor / Cleanup

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions