|
PCART
v1.4
Automated Repair of Python API Parameter Compatibility Issues
|
Dynamic mapping and static mapping of API parameter definitions
More...
Functions | |
| def | dynamicMatch (callAPI, runCommand, runPath, projName, copyFile, version, virtualEnv, lock, errLst, curr=1, *callKey, runtimePaths) |
| Dynamic mapping of API signatures API签名动态匹配 More... | |
| def | fuzzymatch (formatAPI, libName, version, builtinFlag) |
| Static mapping of API signatures API签名静态匹配 More... | |
| def | hasSaveFailedManifest (pklKey, *runtimePaths) |
| Check whether a callsite candidate manifest records pkl save failure 检查调用点候选清单是否记录了pkl保存失败 More... | |
| def | isAlias (callApi, assignDict) |
| Check whether the last name in an API call is an alias 判断一个callAPI最后一个名字是否为库中的别名 More... | |
| def | mapAPI (callAPI, runCommand, runPath, formatAPI, projName, libName, copyFile, version, virtualEnv, lock, errLst, curr=1, *callKey, runtimePaths) |
| Construct the mapping between the invoked API and the lib API to obtain its signature 建立invoked API与 lib API之间的映射关系,从而获取其参数定义 More... | |
| def | saveDynamicMatchSnapshot (pklKey, version, curr, dynamicMatchDict, pklFile=None, *runtimePaths) |
| Save dynamic match result snapshot 保存动态匹配结果快照 More... | |
Dynamic mapping and static mapping of API parameter definitions
Core mapping module: dynamicMatch() reconstructs API callables from runtime pkl data and uses inspect.signature() to extract signatures; fuzzymatch() provides static fallback via fuzzy name matching. mapAPI() orchestrates the two-tier strategy and manages pkl regeneration, manifest tracking, and result snapshots. 核心映射模块:dynamicMatch()从运行时pkl数据重建API可调用对象并使用 inspect.signature()提取签名;fuzzymatch()通过模糊名称匹配提供静态回退。 mapAPI()编排两级策略,管理pkl重新生成、manifest跟踪和结果快照。
| def map.dynamicMatch | ( | callAPI, | |
| runCommand, | |||
| runPath, | |||
| projName, | |||
| copyFile, | |||
| version, | |||
| virtualEnv, | |||
| lock, | |||
| errLst, | |||
curr = 1, |
|||
| * | callKey, | ||
| runtimePaths | |||
| ) |
Dynamic mapping of API signatures API签名动态匹配
| callAPI | The called API |
| runCommand | The run command of the project |
| runPath | The relative path of the run file |
| projName | Project name |
| copyFile | project's copied file |
| version | The lib's version |
| virtualEnv | The lib's virtual environment |
| lock | The lock flag |
| errLst | Error list |
| curr | Current version flag, default is 1 |
| callKey | Unique callsite artifact id |
| runtimePaths | Runtime artifact paths for the current PCART workspace |
Definition at line 164 of file map.py.
| def map.fuzzymatch | ( | formatAPI, | |
| libName, | |||
| version, | |||
| builtinFlag | |||
| ) |
Static mapping of API signatures API签名静态匹配
| formatAPI | The called API |
| libName | The upgraded lib |
| version | The upgraded lib's version |
| builtinFlag | Built-in API flag |
Definition at line 57 of file map.py.
| def map.hasSaveFailedManifest | ( | pklKey, | |
| * | runtimePaths | ||
| ) |
Check whether a callsite candidate manifest records pkl save failure 检查调用点候选清单是否记录了pkl保存失败
| pklKey | The callsite key used to locate the manifest |
| runtimePaths | Runtime artifact paths for the current PCART workspace |
Definition at line 129 of file map.py.
| def map.isAlias | ( | callApi, | |
| assignDict | |||
| ) |
Check whether the last name in an API call is an alias 判断一个callAPI最后一个名字是否为库中的别名
| callApi | The called API to be checked |
| assignDict | The assign dict stores the alias of APIs |
Definition at line 34 of file map.py.
| def map.mapAPI | ( | callAPI, | |
| runCommand, | |||
| runPath, | |||
| formatAPI, | |||
| projName, | |||
| libName, | |||
| copyFile, | |||
| version, | |||
| virtualEnv, | |||
| lock, | |||
| errLst, | |||
curr = 1, |
|||
| * | callKey, | ||
| runtimePaths | |||
| ) |
Construct the mapping between the invoked API and the lib API to obtain its signature 建立invoked API与 lib API之间的映射关系,从而获取其参数定义
先进行动态匹配,动态匹配的结果是保存在api_dynamic.json文件中的 动态匹配的成功包括3步:1.加载PKL; 2.动态脚本执行成功,3.动态获取参数成功(部分内置api无法获取参数)
| callAPI | The called API |
| runCommand | The run command of the project |
| runPath | The relative path of the run file |
| formatAPI | The restored API string used for static matching |
| projName | Project name |
| libName | The lib's name |
| copyFile | project's copied file |
| version | The lib's version |
| virtualEnv | The lib's virtual environment |
| lock | The lock flag |
| errLst | Error list |
| curr | Current version flag, default is 1 |
| callKey | Unique callsite artifact id |
| runtimePaths | Runtime artifact paths for the current PCART workspace |
Definition at line 328 of file map.py.
| def map.saveDynamicMatchSnapshot | ( | pklKey, | |
| version, | |||
| curr, | |||
| dynamicMatchDict, | |||
pklFile = None, |
|||
| * | runtimePaths | ||
| ) |
Save dynamic match result snapshot 保存动态匹配结果快照
| pklKey | The callsite key used to locate the pkl/json data |
| version | The lib version used in this dynamic match |
| curr | Current version flag, 1 for current and 0 for target |
| dynamicMatchDict | Dynamic match result loaded from dynamicMatch.py |
| pklFile | The pkl candidate file used by this dynamic match |
| runtimePaths | Runtime artifact paths for the current PCART workspace |
Definition at line 97 of file map.py.