search_python_output
Search text or regular expressions in Python execution output streams. Supports stream selection, query modes, and context lines.
Instructions
在一个 execution 的指定输出流中搜索文本或正则表达式。
选择与匹配
execution 的选择规则与 python_execution_status 相同;可选的
stream 值与 read_python_output 相同。query_mode="literal"
按字面文本匹配,query_mode="regex" 要求 query 是有效正则,
query_mode="auto" 先按正则解释,仅在编译失败时回退到字面匹配。
命中上下文
每条命中保留原始所选流行号,并以 M 标记;前后上下文行以
C 标记。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | 要匹配的字面文本或正则表达式。 | |
| stream | No | 输出流;默认 ``combined``,其余值为 ``stdout``、``stderr``、 ``result`` 与 ``traceback``。 | combined |
| execution | No | 要搜索的正整数执行编号。省略时使用当前记录,随后 使用最近记录。 | |
| max_chars | No | 每个返回行允许显示的最大字符数;必须为正数,且只 裁切响应文本。 | |
| query_mode | No | 匹配解释方式:``literal``、``regex`` 或 ``auto``; 默认 ``auto``。 | auto |
| ignore_case | No | 为 true 时忽略大小写。 | |
| context_after | No | 每个命中之后附加的相邻行数;必须大于或等于 0。 | |
| context_before | No | 每个命中之前附加的相邻行数;必须大于或等于 0。 |