Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
3715379c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
3715379c
编写于
3月 06, 2020
作者:
Z
zhangchunle
提交者:
GitHub
3月 06, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Getting diff apis for tools/sampcd_processor.py (#22817)
上级
0d463d3b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
11 deletion
+45
-11
tools/sampcd_processor.py
tools/sampcd_processor.py
+45
-11
未找到文件。
tools/sampcd_processor.py
浏览文件 @
3715379c
...
...
@@ -445,13 +445,9 @@ def test(file_list):
return
process_result
def
get_filenames
(
path
):
def
get_filenames
():
'''
Given a path ``path``, this function will
get the modules that pending for check.
Args:
path(path): the path of API.spec
this function will get the modules that pending for check.
Returns:
...
...
@@ -461,11 +457,11 @@ def get_filenames(path):
filenames
=
[]
global
methods
methods
=
[]
API_spec
=
'%s/%s'
%
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
getcwd
(),
".."
)),
path
)
get_incrementapi
()
API_spec
=
'dev_pr_diff_api.spec'
with
open
(
API_spec
)
as
f
:
for
line
in
f
.
readlines
():
api
=
line
.
split
(
' '
,
1
)[
0
]
api
=
line
.
replace
(
'
\n
'
,
''
)
try
:
module
=
eval
(
api
).
__module__
except
AttributeError
:
...
...
@@ -499,9 +495,40 @@ def get_filenames(path):
method
=
method
+
name
if
method
not
in
methods
:
methods
.
append
(
method
)
os
.
remove
(
API_spec
)
return
filenames
def
get_incrementapi
():
'''
this function will get the apis that difference between API_DEV.spec and API_PR.spec.
'''
def
get_api_md5
(
path
):
api_md5
=
{}
API_spec
=
'%s/%s'
%
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
getcwd
(),
".."
)),
path
)
with
open
(
API_spec
)
as
f
:
for
line
in
f
.
readlines
():
api
=
line
.
split
(
' '
,
1
)[
0
]
md5
=
line
.
split
(
"'document', "
)[
1
].
replace
(
')'
,
''
).
replace
(
'
\n
'
,
''
)
api_md5
[
api
]
=
md5
return
api_md5
dev_api
=
get_api_md5
(
'paddle/fluid/API_DEV.spec'
)
pr_api
=
get_api_md5
(
'paddle/fluid/API_PR.spec'
)
with
open
(
'dev_pr_diff_api.spec'
,
'w'
)
as
f
:
for
key
in
pr_api
:
if
key
in
dev_api
:
if
dev_api
[
key
]
!=
pr_api
[
key
]:
f
.
write
(
key
)
f
.
write
(
'
\n
'
)
else
:
f
.
write
(
key
)
f
.
write
(
'
\n
'
)
'''
Important constant lists:
...
...
@@ -720,9 +747,16 @@ else:
if
not
os
.
path
.
isdir
(
"./samplecode_temp"
):
os
.
mkdir
(
"./samplecode_temp"
)
cpus
=
multiprocessing
.
cpu_count
()
filenames
=
get_filenames
(
'paddle/fluid/API_PR.spec'
)
filenames
.
remove
(
'../python/paddle/fluid/core_avx.py'
)
filenames
=
get_filenames
()
if
len
(
filenames
)
==
0
:
print
(
"-----API_PR.spec is the same as API_DEV.spec-----"
)
exit
(
0
)
elif
'../python/paddle/fluid/core_avx.py'
in
filenames
:
filenames
.
remove
(
'../python/paddle/fluid/core_avx.py'
)
print
(
"API_PR is diff from API_DEV: %s"
%
filenames
)
one_part_filenum
=
int
(
math
.
ceil
(
len
(
filenames
)
/
cpus
))
if
one_part_filenum
==
0
:
one_part_filenum
=
1
divided_file_list
=
[
filenames
[
i
:
i
+
one_part_filenum
]
for
i
in
range
(
0
,
len
(
filenames
),
one_part_filenum
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录