ReMe/reme/extension/translate_ts.yaml

16 lines
No EOL
1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

translate_prompt: |
{ts_code}
请将上方提供的 TypeScriptTS代码转换为功能等价的 Python 代码,并满足以下要求:
1. 在代码最开始,通过注释简要说明你将如何进行代码转换,包括对 TS 特性的处理策略、Python 替代方案的选择依据等。
2. 接着使用注释形式提供一个整体大纲总结,简明扼要地说明该程序的核心逻辑、主要模块或关键步骤。
3. 为所有关键代码行添加丰富的中文注释,解释其作用、设计意图或与原 TS 代码的对应关系。
4. 保持代码结构清晰、符合 Python 编程规范(如 PEP 8并尽可能使用 Python 的惯用写法idiomatic Python
5. 若 TS 代码中使用了特定类型、接口或高级特性如泛型、装饰器、Promise 等),请在 Python 中采用合理的方式模拟或替代例如使用类型提示、async/await、dataclass 等)。
输出格式
```python
```
只输出代码,不要进行额外的总结