提交 85b49d84 编写于 作者: T tianshuo78520a 提交者: Tao Luo

fix the api.spec file does not get the class comment problem (#18439)

* fix the api.spec file does not get the class comment problem

* cat new.spec

* check api.spec

* test=develop
上级 357311fd
此差异已折叠。
...@@ -37,28 +37,36 @@ def md5(doc): ...@@ -37,28 +37,36 @@ def md5(doc):
return hash.hexdigest() return hash.hexdigest()
def queue_dict(member, cur_name):
try:
doc = ('document', md5(member.__doc__))
if inspect.isclass(member):
args = member.__module__ + "." + member.__name__
else:
args = inspect.getargspec(member)
all = (args, doc)
member_dict[cur_name] = all
except TypeError: # special for PyBind method
if cur_name in check_modules_list:
return
member_dict[cur_name] = " ".join([
line.strip() for line in pydoc.render_doc(member).split('\n')
if "->" in line
])
def visit_member(parent_name, member): def visit_member(parent_name, member):
if parent_name + member.__name__ in experimental_namespace: if parent_name + member.__name__ in experimental_namespace:
return 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)
for name, value in inspect.getmembers(member): for name, value in inspect.getmembers(member):
if hasattr(value, '__name__') and (not name.startswith("_") or if hasattr(value, '__name__') and (not name.startswith("_") or
name == "__init__"): name == "__init__"):
visit_member(cur_name, value) visit_member(cur_name, value)
elif callable(member): elif callable(member):
try: queue_dict(member, cur_name)
doc = ('document', md5(member.__doc__))
args = inspect.getargspec(member)
all = (args, doc)
member_dict[cur_name] = all
except TypeError: # special for PyBind method
if cur_name in check_modules_list:
return
member_dict[cur_name] = " ".join([
line.strip() for line in pydoc.render_doc(member).split('\n')
if "->" in line
])
elif inspect.isgetsetdescriptor(member): elif inspect.isgetsetdescriptor(member):
return return
else: else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册