google-docstring-assistant
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGoogle Docstring Assistant
Google Docstring 助手
Quick start
快速开始
- Write docstrings using the Google Python Style Guide structure (Args, Returns, Raises, Examples, Attributes, etc.).
- Keep sections as headers followed by indented blocks; break sections by resuming unindented text.
- When types are annotated in code, omit them in docstrings unless clarity is improved.
- Use blocks with literal blocks (
Examples) for commands or code snippets.:: - Document module-level variables consistently (all in or inline), and list TODOs in a
Attributessection.Todo - See for full guidance and examples.
references/google_docstring_rules.md
- 遵循Google Python风格指南的结构(Args、Returns、Raises、Examples、Attributes等)编写文档字符串。
- 章节以标题形式呈现,后跟缩进块;恢复无缩进文本即可分隔章节。
- 当代码中已标注类型时,除非能提升清晰度,否则文档字符串中无需重复标注类型。
- 使用块搭配文字块(
Examples)来展示命令或代码片段。:: - 统一记录模块级变量(全部放在中或内联记录),并在
Attributes章节中列出待办事项。Todo - 完整指南和示例请查看。
references/google_docstring_rules.md
Workflow
工作流程
-
Choose sections
- Functions: include ,
Args, andReturnsas needed.Raises - Modules/classes: use and
Attributeswhen relevant; keep formatting consistent.Todo
- Functions: include
-
Write clearly
- One docstring per object; keep it concise and informative.
- Use indentation under each section header; separate sections by returning to unindented text.
- Prefer Google-style wording; avoid duplicating annotated types unless helpful.
-
Examples and scripts
- Use with indented literal blocks for shell commands or code snippets.
Examples: - Include multi-line descriptions when needed; keep formatting readable.
- Use
-
选择章节
- 函数:根据需要包含、
Args和Returns。Raises - 模块/类:相关时使用和
Attributes;保持格式一致。Todo
- 函数:根据需要包含
-
清晰撰写
- 每个对象对应一个文档字符串;保持简洁且信息丰富。
- 在每个章节标题下使用缩进;通过回到无缩进文本来分隔章节。
- 优先使用Google风格的表述;除非有帮助,否则避免重复已标注的类型。
-
示例与脚本
- 使用搭配缩进的文字块来展示Shell命令或代码片段。
Examples: - 必要时使用多行描述;保持格式可读性。
- 使用
Reference
参考资料
- : full style description and examples.
references/google_docstring_rules.md
- :完整的风格说明和示例。
references/google_docstring_rules.md