|
| def | buildRunCommand (runCommand, envPath) |
| | Build subprocess argv for project run command 为被测项目运行命令构造subprocess argv. More...
|
| |
| def | cmp (version) |
| | Normalize and compare version strings 归一化并比较版本号字符串 More...
|
| |
| def | departAPI (s) |
| | Split API call string based on parameter passing 根据参数传递拆分API调用字符串 More...
|
| |
| def | departAPI2 (s, separator='.') |
| | Split API call string based on separator "." 根据"."拆分API调用字符串 More...
|
| |
| def | findPythonDir (basePath) |
| | Get Python interpreter path 获取Python解释器路径 More...
|
| |
| def | getArtifactDisplayName (artifactId) |
| | Return readable artifact display name 返回可读运行产物展示名 More...
|
| |
| def | getArtifactHash (artifactId) |
| | Return artifact hash from an artifact id 从运行产物id中提取hash. More...
|
| |
| def | getAst (filePath, strFlag=0) |
| | Get AST for code 将代码转化为Ast树 More...
|
| |
| def | getFileName (fileName, extension) |
| | Normalize file name 给文件取名字 More...
|
| |
| def | getImportLst (filePath) |
| | Extract import statements from a source file (currently torch-specific) 从源码文件中提取import语句(目前仅筛选torch相关) More...
|
| |
| def | getLastAPIParameter (apiStr) |
| | Get parameter(s) of the last API from the API call string 获取最后一个API参数 More...
|
| |
| def | getParameter (p_string, separator=',', space=1) |
| | Split parameter string into list of separated parameters 将参数字符串拆分成单个的参数 More...
|
| |
| def | getRunFile (runCommand) |
| | Extract the .py script filename from a run command 从运行命令中提取.py脚本文件名 More...
|
| |
| def | getSourceCodePath (configPath) |
| | Get source code path of the lib 获取库源码路径 More...
|
| |
| def | getVersionLst (libPath) |
| | Get all version numbers from a library package directory 给定库的路径,获得该库的所有版本号 More...
|
| |
| def | isDynamic (dic) |
| | Check if a match dictionary contains dynamic (string) match results 检查匹配字典是否包含动态(字符串)匹配结果 More...
|
| |
| def | isPyLauncher (command) |
| | Check whether command is Windows py launcher 判断命令是否为Windows py启动器 More...
|
| |
| def | isPythonExecutable (command) |
| | Check whether command is a Python executable name/path 判断命令是否为Python解释器名称或路径 More...
|
| |
| def | loadConfig (configPath) |
| | Load PCART's configuration file 加载PCART配置文件 More...
|
| |
| def | normalizeRunCommand (runCommand) |
| | Normalize project run command 归一化被测项目运行命令 More...
|
| |
| def | removeParameter (s, flag=0) |
| | Remove parameter(s) from API call string 去掉API中的参数部分 More...
|
| |
| def | resolveConfigFilePath (config, repoRoot) |
| | Resolve PCART config file path 解析PCART配置文件路径 More...
|
| |
| def | resolveConfigValuePath (repoRoot, path) |
| | Resolve path value loaded from PCART config 解析PCART配置字段中的路径值 More...
|
| |
| def | resolveConsoleExecutable (envPath, commandName) |
| | Resolve console script executable from a virtual environment 从虚拟环境中解析console script可执行文件 More...
|
| |
| def | resolveLibSourceCodePath (envPath, libName) |
| | Resolve the source package directory for a library in a virtual environment 从虚拟环境中解析库源码目录 More...
|
| |
| def | resolvePythonExecutable (envPath) |
| | Resolve Python executable from a virtual environment root 从虚拟环境根目录解析 Python 解释器路径 More...
|
| |
| def | save2txt (lst, libName, runCommand, savePath) |
| | Save PCART report 保存PCART报告 More...
|
| |
| def | shortenArtifactFileName (fileName, extension) |
| | Shorten artifact file name while preserving full hash 缩短运行产物文件名并保留完整hash. More...
|
| |
| def | stripPyLauncherOption (tokens) |
| | Remove version option after py launcher 去除py启动器后的版本选项 More...
|
| |
| def | writeLine (width, s, fw) |
| | Format output 格式化输出 More...
|
| |
Provide utility functions for processing API calls and source files.
Collection of shared utility functions: AST parsing, parameter string splitting/parsing (getParameter, departAPI, departAPI2), configuration loading, run command normalization and executable resolution, report formatting (save2txt), and AST transformation (ConditionalReturnTransformer). 共享工具函数集合:AST解析、参数字符串拆分/解析(getParameter、departAPI、 departAPI2)、配置加载、运行命令归一化和可执行文件解析、报告格式化 (save2txt)、AST转换(ConditionalReturnTransformer)。
Split API call string based on parameter passing 根据参数传递拆分API调用字符串
For example, a.b(x).c(y).d(z) --> ['a.b(x)', 'a.b(x).c(y)', 'a.b(x).c(y).d(z)'] 比如a.b(x).c(y).d(z)拆成3个API,分别是['a.b(x)', 'a.b(x).c(y)', 'a.b(x).c(y).d(z)'] 还有特殊的调用形式a.b['x'](y)
- Parameters
-
- Returns
- ansLst The split result
Definition at line 292 of file tool.py.
| def tool.departAPI2 |
( |
|
s, |
|
|
|
separator = '.' |
|
) |
| |
Split API call string based on separator "." 根据"."拆分API调用字符串
For example, a.b(x).c(y).d(z) --> ['a', 'b(x)', 'c(y)', 'd(z)'] 比如a.b(x).c(y).d(z)拆成4个API,分别是['a', 'b(x)', 'c(y)', 'd(z)']
- Parameters
-
| s | The API call string |
| separator | The separator symbol: . |
- Returns
- ansLst The split result
Definition at line 340 of file tool.py.
| def tool.getLastAPIParameter |
( |
|
apiStr | ) |
|
Get parameter(s) of the last API from the API call string 获取最后一个API参数
For example, a(x).b(x=c.d(1),y=b((1,2),5),w).c(1,2,3,4) --> 1,2,3,4 比如,a(x).b(x=c.d(1),y=b((1,2),5),w).c(1,2,3,4),获取c的参数1,2,3,4
- Parameters
-
| apiStr | The API call string |
- Returns
- ans The parameter(s) of the last API
Definition at line 262 of file tool.py.
| def tool.getParameter |
( |
|
p_string, |
|
|
|
separator = ',', |
|
|
|
space = 1 |
|
) |
| |
Split parameter string into list of separated parameters 将参数字符串拆分成单个的参数
apiName(x,y="<bold>Hello, World!</bold>",z:int,w=(p1,p2={1,(1m,23)}),device: Union[Device, int] = None, abbreviated: bool ={'a','b'}) -> str 默认按逗号进行拆分,也可按'.'进行拆分,比如a.b.c 拆分参数的时候没有考虑到x="hello,wolrd"带冒号的情况,会错误拆成两个
- Parameters
-
| p_string | Parameter string |
| separator | The separator, ',' is the default value |
| space | Determine whether to remove the space in the parameter string |
- Returns
- parameters List of separated parameters
Definition at line 85 of file tool.py.