首页 全部提示词 Coding

分析任意代码文件

Analyze any code file

文本 @rajeshb3265 539 字符 在 prompts.chat 查看 译文有问题?

中文译文

以一位初次接触该文件的资深 Python 开发者的视角,分析所提供的 Python 文件。

用简单易懂的语言进行讲解,同时保留技术语境。

内容需涵盖:

  1. 用途 — 这个文件做什么,为什么存在。
  2. 流程 — 解释从入口点到结束的主要执行流程。
  3. 函数/类 — 解释重要的函数/类,它们的输入、输出和职责。
  4. 依赖 — 解释重要的导入项,以及它所交互的外部 API、文件、数据库、服务或模块。
  5. 数据流 — 解释重要数据如何在函数/类之间移动、变化和传递。
  6. 条件与循环 — 解释重要的 if/else、循环、重试、异常和判断点。
  7. 副作用 — 识别文件写入、数据库/API 调用、状态变更、外部操作等。
  8. 风险与问题 — 识别 bug、边界情况、不必要的复杂性、耦合或可维护性问题。
  9. 总结 — 给出一段简短的、开发者容易记住的分步流程。

重点理解实际代码和执行流程,而不是仅仅逐行描述。不要臆造无法从文件中确定的行为。如果某些内容依赖于未提供的其他文件/模块,请明确指出。

保持讲解结构清晰、简洁、易于跟随。优先讲解重要逻辑,而非琐碎的语法细节。

English original

Analyze the provided Python file like a senior/veteran Python developer who is seeing it for the first time.

Explain it in simple, easy-to-understand language while preserving the technical context.

Cover:

  1. Purpose — what this file does and why it exists.
  2. Flow — explain the main execution flow from entry point to completion.
  3. Functions/Classes — explain the important functions/classes, their inputs, outputs, and responsibilities.
  4. Dependencies — explain important imports, external APIs, files, databases, services, or modules it interacts with.
  5. Data Flow — explain how important data moves, changes, and is passed between functions/classes.
  6. Conditions & Loops — explain important if/else, loops, retries, exceptions, and decision points.
  7. Side Effects — identify file writes, database/API calls, state changes, external operations, etc.
  8. Risks & Issues — identify bugs, edge cases, unnecessary complexity, coupling, or maintainability concerns.
  9. Summary — give a short step-by-step flow that a developer can remember easily.

Focus on understanding the actual code and execution flow, not merely describing each line. Do not invent behavior that cannot be determined from the file. If something depends on another file/module that is not provided, clearly mention it.

Keep the explanation structured, concise, and easy to follow. Prioritize important logic over trivial syntax.