未验证 提交 7a790188 编写于 作者: Z Zeng Jinle 提交者: GitHub

Refine print_signatures.py to remove ComposeNotAligned (#20411)

* refine print_signatures.py to remove ComposeNotAligned, test=develop

* remove experimental_namespace, test=develop
上级 5a7142ac
...@@ -455,8 +455,6 @@ function assert_api_not_changed() { ...@@ -455,8 +455,6 @@ function assert_api_not_changed() {
sed -i 's/arg0: str/arg0: unicode/g' new.spec sed -i 's/arg0: str/arg0: unicode/g' new.spec
sed -i "s/\(.*Transpiler.*\).__init__ (ArgSpec(args=\['self'].*/\1.__init__ /g" new.spec sed -i "s/\(.*Transpiler.*\).__init__ (ArgSpec(args=\['self'].*/\1.__init__ /g" new.spec
fi fi
# ComposeNotAligned has significant difference between py2 and py3
sed -i '/.*ComposeNotAligned.*/d' new.spec
python ${PADDLE_ROOT}/tools/diff_api.py ${PADDLE_ROOT}/paddle/fluid/API.spec new.spec python ${PADDLE_ROOT}/tools/diff_api.py ${PADDLE_ROOT}/paddle/fluid/API.spec new.spec
......
...@@ -28,7 +28,12 @@ import hashlib ...@@ -28,7 +28,12 @@ import hashlib
member_dict = collections.OrderedDict() member_dict = collections.OrderedDict()
experimental_namespace = {"paddle.fluid.LoDTensorset"} # APIs that should not be printed into API.spec
omitted_list = [
"paddle.fluid.LoDTensor.set", # Do not know why it should be omitted
"paddle.fluid.io.ComposeNotAligned",
"paddle.fluid.io.ComposeNotAligned.__init__",
]
def md5(doc): def md5(doc):
...@@ -38,6 +43,9 @@ def md5(doc): ...@@ -38,6 +43,9 @@ def md5(doc):
def queue_dict(member, cur_name): def queue_dict(member, cur_name):
if cur_name in omitted_list:
return
try: try:
doc = ('document', md5(member.__doc__)) doc = ('document', md5(member.__doc__))
if inspect.isclass(member): if inspect.isclass(member):
...@@ -47,8 +55,6 @@ def queue_dict(member, cur_name): ...@@ -47,8 +55,6 @@ def queue_dict(member, cur_name):
all = (args, doc) all = (args, doc)
member_dict[cur_name] = all member_dict[cur_name] = all
except TypeError: # special for PyBind method except TypeError: # special for PyBind method
if cur_name in check_modules_list:
return
member_dict[cur_name] = " ".join([ member_dict[cur_name] = " ".join([
line.strip() for line in pydoc.render_doc(member).split('\n') line.strip() for line in pydoc.render_doc(member).split('\n')
if "->" in line if "->" in line
...@@ -56,8 +62,6 @@ def queue_dict(member, cur_name): ...@@ -56,8 +62,6 @@ def queue_dict(member, cur_name):
def visit_member(parent_name, member): def visit_member(parent_name, member):
if parent_name + member.__name__ in experimental_namespace:
return
cur_name = ".".join([parent_name, member.__name__]) cur_name = ".".join([parent_name, member.__name__])
if inspect.isclass(member): if inspect.isclass(member):
queue_dict(member, cur_name) queue_dict(member, cur_name)
...@@ -75,8 +79,6 @@ def visit_member(parent_name, member): ...@@ -75,8 +79,6 @@ def visit_member(parent_name, member):
def visit_all_module(mod): def visit_all_module(mod):
if (mod.__name__ in experimental_namespace):
return
for member_name in ( for member_name in (
name name
for name in (mod.__all__ if hasattr(mod, "__all__") else dir(mod)) for name in (mod.__all__ if hasattr(mod, "__all__") else dir(mod))
...@@ -90,7 +92,6 @@ def visit_all_module(mod): ...@@ -90,7 +92,6 @@ def visit_all_module(mod):
visit_member(mod.__name__, instance) visit_member(mod.__name__, instance)
check_modules_list = ["paddle.reader.ComposeNotAligned.__init__"]
modules = sys.argv[1].split(",") modules = sys.argv[1].split(",")
for m in modules: for m in modules:
visit_all_module(importlib.import_module(m)) visit_all_module(importlib.import_module(m))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册