ITADN

Clean up unused imports and improve type hints

#324Pull Requestthangckt 创建于 2025-11-27
T
thangcktcommented
This pull request primarily cleans up unused imports and improves code readability across several entrypoint modules in the `dpgen2` package. It also introduces minor enhancements to type hints and default argument handling for better code clarity and robustness. **Codebase cleanup and readability:** * Removed unused imports (such as `os`, `glob`, `pickle`, `dpdata`, etc.) from multiple files including `main.py`, `showkey.py`, `status.py`, `submit.py`, and `workflow.py` to streamline the codebase. [[1]](diffhunk://#diff-566f49ecd2afbc4c7a22cd2f576a706a0fea95bed20f560240e328541830494dL4-L19) [[2]](diffhunk://#diff-dc5e3ffd275993a4866b65927e0972ad7c65aac2e195b3ca9fdb43254278f265L1-L8) [[3]](diffhunk://#diff-70638d2beeba19acd9b8de0bdf0bf976ba14b6f5e5f8dd24b1f84aaf23840425L4-L6) [[4]](diffhunk://#diff-518b16955e40ff2d3d6308e0dff9a6800306adecead3255ccf8c71a146723588L2-L7) [[5]](diffhunk://#diff-74c1d2a47b53b85b573096163113600a7dd410f2a410bc9699e90c26af23d226L2-R2) * Simplified assertion error messages and improved string formatting for logging statements in `submit.py` and `watch.py`. [[1]](diffhunk://#diff-518b16955e40ff2d3d6308e0dff9a6800306adecead3255ccf8c71a146723588L591-R583) [[2]](diffhunk://#diff-b80b08ddd1a5fe0cc9352de549f54b44ca1fbd63fd6e1300c756818bf2ef2dfdL46-R67) **Type hint and argument improvements:** * Updated type hints for optional dictionary arguments in `watch.py` and `workflow.py` to use `Optional[Dict] | None`, and ensured proper default initialization using `wf_config = wf_config or {}`. [[1]](diffhunk://#diff-b80b08ddd1a5fe0cc9352de549f54b44ca1fbd63fd6e1300c756818bf2ef2dfdL46-R67) [[2]](diffhunk://#diff-74c1d2a47b53b85b573096163113600a7dd410f2a410bc9699e90c26af23d226L41-R38) * Minor formatting improvements for argument parsing and function calls for better readability in `main.py`. [[1]](diffhunk://#diff-566f49ecd2afbc4c7a22cd2f576a706a0fea95bed20f560240e328541830494dL87-R77) [[2]](diffhunk://#diff-566f49ecd2afbc4c7a22cd2f576a706a0fea95bed20f560240e328541830494dL384-R372) **General code style enhancements:** * Removed unnecessary tuple and union type imports, and cleaned up type hints in `submit.py` and `status.py`. [[1]](diffhunk://#diff-518b16955e40ff2d3d6308e0dff9a6800306adecead3255ccf8c71a146723588L18-L23) [[2]](diffhunk://#diff-70638d2beeba19acd9b8de0bdf0bf976ba14b6f5e5f8dd24b1f84aaf23840425L4-L6) [[3]](diffhunk://#diff-b80b08ddd1a5fe0cc9352de549f54b44ca1fbd63fd6e1300c756818bf2ef2dfdL7) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit **Refactor** - Removed unused imports and dependencies from configuration entry points across multiple modules - Improved workflow configuration parameter handling by switching from empty dict to None-based defaults with internal initialization - Enhanced code consistency through standardized message formatting throughout the codebase - Refined workflow status tracking conditional logic <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
合并状态:未合并 1 条评论