Python import 语句改写
coding.fix_from_imports
将文件中 `from X import Y` 形式的导入替换为 `import X`,并更新所有对应的使用处
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-02
- Stars
- ★ 155
- Forks
- 170
01 前言 Front Matter
- model
- haiku
- description
- Replace `from X import Y` imports with `import X` and update usages in a file
02 资源文件 3
- 参考文档evals/evals.json7.3 KB
- 参考文档references/guerrilla-marketing.md4.9 KB
- 参考文档references/ideas-by-category.md15.0 KB
03 SKILL.md 正文
-
Replace any Python statement like
from X import Ywith the formimport Xand then replace the uses ofYwithX.Y -
For aliased imports
from X import Y as Z, convert toimport Xand replace all uses ofZwithX.Y -
For nested module imports
from X.Y import Z, convert toimport X.Yand replace all uses ofZwithX.Y.Z -
The only ones that can stay as
from X import Yare:from __future__ import annotations from typing import Any, Dict, List, Optional, Tuple, Union, ... (any typing name) from IPython.display import display from pathlib import Path -
Do not use
# Re-export get_chat_model for backward compatibility. get_chat_model = langchain_API_utils.get_chat_modelbut replace all the callers
Verification
- [ ] Confirm no remaining
from X import Ystatements outside the allowed exceptions - [ ] Confirm every use of the imported name is updated to
X.Y(orX.Y.Zfor nested modules) - [ ] Confirm no backward-compatibility re-export aliases remain
04 同仓库更多 Skills
Docker 文件同步与模板对齐
tutorial_in_60_mins.propagate_docker_changes
同步教程和课程项目的 Docker 文件,使其与 project_template 保持一致。
Markdown 合并至 Jupyter Notebook
tutorial_in_60_mins.merge_markdown
将 Markdown 文件的内容合并到 Jupyter Notebook 中。
60 分钟教程格式规范化
tutorial_in_60_mins.format
格式化目录,使其遵循「Learn X in 60 Minutes」(60 分钟学会 X)教程约定。
60 分钟教程目录创建
tutorial_in_60_mins.create
按照「Learn X in 60 Minutes」(60 分钟学会 X)约定创建教程目录。
todo.reorg_in_progress
Reorganize ai_task_queue.md so in-progress tasks, not-started tasks, and mislabeled topic headers sit under the right H1 stage
todo.reorg_headers
Reorganize ai_task_queue.md .md so every H2 topic matches ALL TOPICS and every H3 task sits under the right topic, keeping its H1 stage