|
PCART
v1.4
Automated Repair of Python API Parameter Compatibility Issues
|
Generate repair patches without rewriting the source AST. More...
Functions | |
| def | applyEdits (sourceBytes, edits) |
| Apply non-overlapping edits using UTF-8 byte offsets from the original AST 根据原始AST的UTF-8字节位置应用不重叠的修复 More... | |
| def | makePatchEdit (record, fixedAPI, repairStatus) |
| Collect one unambiguous repair result with its original source span 收集唯一修复表达式及其原始源码范围 More... | |
| def | writeRepairArtifacts (projPath, projName, edits, reportDir) |
| Write independent category patches and a Successful-only project copy 写出三类独立补丁及仅含Successful修复的项目副本 More... | |
Generate repair patches without rewriting the source AST.
Uses existing callsite spans and repair results to generate independent Successful/Unknown/Failed patches. Only Successful edits enter the copied project; original files and source bytes outside edited spans stay unchanged. 使用已有调用点范围和修复结果生成三类独立补丁,仅将Successful修复写入 项目副本,不修改原项目,保留替换范围之外的原始源码字节。
| def patch.applyEdits | ( | sourceBytes, | |
| edits | |||
| ) |
Apply non-overlapping edits using UTF-8 byte offsets from the original AST 根据原始AST的UTF-8字节位置应用不重叠的修复
Unsafe edits are skipped and logged; a syntax-invalid file is not emitted. 不安全的修复跳过并记录日志,合并后语法无效的文件不输出。
| sourceBytes | Original UTF-8 source file bytes, optionally with BOM |
| edits | List of edit dictionaries for this source file |
Definition at line 58 of file patch.py.
| def patch.makePatchEdit | ( | record, | |
| fixedAPI, | |||
| repairStatus | |||
| ) |
Collect one unambiguous repair result with its original source span 收集唯一修复表达式及其原始源码范围
| record | Structured callsite record with original call text and source span |
| fixedAPI | Fixed API call expression returned by repairTask |
| repairStatus | Repair status: Successful, Unknown, or Failed |
Definition at line 29 of file patch.py.
| def patch.writeRepairArtifacts | ( | projPath, | |
| projName, | |||
| edits, | |||
| reportDir | |||
| ) |
Write independent category patches and a Successful-only project copy 写出三类独立补丁及仅含Successful修复的项目副本
Every category is compared with the original project, not another category. 各类别均与原项目比较,不在其他类别补丁上叠加。
| projPath | Original project root path |
| projName | Project directory name used in fixed_project output |
| edits | List of collected edit dictionaries from all project files |
| reportDir | Internal report directory for the current run command |
Definition at line 138 of file patch.py.