PCART  v1.4
Automated Repair of Python API Parameter Compatibility Issues
Namespaces | Functions
preprocess.py File Reference

Go to the source code of this file.

Namespaces

 preprocess
 Preprocess project source files for preparing API parameter compatibility issue detection and repair

 

Functions

def addDictAll (projPath, projName, filePath, copyRoot, runFileLst, libName, runPath, runCommand, pcresolveLookup=None)
 Code instrumentation for all API calls within a project source file 项目源文件所有API调用代码插桩 More...
 
def addDictSingle (callAPI, filePath, callKey)
 Code instrumentation for a single API call within a source file 源文件单个API调用代码插桩 More...
 
def codeProcess (projPath, runCommand, runPath, libName, workspace, pcresolveLookup=None)
 Code processing 代码预处理 More...
 
def convertLocalVar (filePath, libName)
 Convert the ListComp and DictComp statements to variable assignment statements 将列表推导式listComp和字典推导式DictComp转换为变量赋值表达式 More...
 
def convertTabsToSpaces (directory)
 Convert tabs to spaces in all Python files within a directory 将目录下所有Python文件中的制表符转换为空格 More...
 
def countBracket (s)
 Count the number of different types of brackets ((), [], {}) in a string 计算字符串中各类括号((), [], {})的个数 More...
 
def countSpace (s)
 Count the number of spaces at the beginning of a string 计算字符串的前面有多少个空格 More...
 
def expandConditionalReturn (filePath)
 Expand the single-line conditional return statement into a multi-line if-else structure
展开单行条件return语句为多行if-else结构 More...
 
def extractDecorator (root)
 Extract decorator API calls 抽取项目中第三方库装饰器调用 More...
 
def findAssignCall (root)
 Find assignment call statements 获取赋值调用语句 More...
 
def getAssignReceiverExpr (root, source, aliasName, lineno)
 Resolve the source expression assigned to a receiver alias 还原调用者别名在当前作用域内的赋值来源表达式 More...
 
def getDecoratorInsertIndex (codeLst, index)
 Get decorator block start index 获取装饰器块起始行号 More...
 
def getDictVar (root, ansLst)
 Get the local variable in the dictionary comprehension 获取字典推导式中的局部变量 More...
 
def getImportLine (codeLst)
 Determine the instrumentation line for import statements 确定import语句插桩行 More...
 
def getLibImportLst (projPath, libName)
 Get all lib-related import statements 获取所有第三方库相关的import语句 More...
 
def getListVar (root, ansLst)
 Get the local variable in the list comprehension 获取列表推导式中的局部变量 More...
 
def getSelfReceiverExpr (root, lineno, methodName)
 Resolve the visible base-class expression for an inherited self receiver 还原继承场景中self调用者可见的基类表达式 More...
 
def handleRunFile (file, runPath, runCommand)
 Code instrumentation for project run file 项目运行文件代码插桩 More...
 
def ignore_sym_links (directory, files)
 Determine the soft link files in a directory 确定文件夹中的软链接文件 More...
 
def modifyFromImport (filePath, importStatement)
 Save import statement to source file 将import语句保存到源码中 More...
 
def obtainDef (sourcePath)
 Extract class and function definitions from a source file 从源文件中提取类和函数定义 More...
 
def oneLine (filePath)
 Convert the multi-line parameter calls in the code into a single line to facilitate insertion into dictionary statements 把代码中换行写的参数调用,合并成一行,目的是便于插入字典语句 More...
 
def saveConstantAssign (astNode, constantVar, nonConstantVar, decoratorLst)
 Save assignment statement with constant values 保存常量赋值语句 More...
 
def saveStructure (projPath, libName)
 Save structure information of the project 保存项目的结构信息 More...
 
def scriptPath (scriptName)
 Get source script path from PCART repository 获取PCART仓库中的辅助脚本路径 More...
 
def writeRecordValue (filePath, pklRelPath, useCallsiteName)
 Write recordValue.py used by instrumented project files 写入插桩文件共享的recordValue.py. More...