1 Star 0 Fork 471

xiongying/Paddle

forked from PaddlePaddle/Paddle 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
diff_api.py 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
seemingwang 提交于 2021-04-02 13:58 +08:00 . graph engine (#31226)
#!/usr/bin/env python
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
import difflib
import sys
with open(sys.argv[1], 'r') as f:
origin = f.read()
origin = origin.splitlines()
with open(sys.argv[2], 'r') as f:
new = f.read()
new = new.splitlines()
differ = difflib.Differ()
result = differ.compare(origin, new)
error = False
diffs = []
for each_diff in result:
if each_diff[0] in ['-', '?']: # delete or change API is not allowed
error = True
elif each_diff[0] == '+':
error = True
if each_diff[0] != ' ':
diffs.append(each_diff)
'''
If you modify/add/delete the API files, including code and comment,
please follow these steps in order to pass the CI:
1. cd ${paddle_path}, compile paddle;
2. pip install build/python/dist/(build whl package);
3. run "python tools/print_signatures.py paddle.fluid> paddle/fluid/API.spec"
'''
if error:
print('API Difference is: ')
for each_diff in diffs:
print(each_diff)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/VisionDeveloper/Paddle.git
git@gitee.com:VisionDeveloper/Paddle.git
VisionDeveloper
Paddle
Paddle
develop

搜索帮助