提交 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):
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):
if parent_name + member.__name__ in experimental_namespace:
return
cur_name = ".".join([parent_name, member.__name__])
if inspect.isclass(member):
queue_dict(member, cur_name)
for name, value in inspect.getmembers(member):
if hasattr(value, '__name__') and (not name.startswith("_") or
name == "__init__"):
visit_member(cur_name, value)
elif callable(member):
try:
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
])
queue_dict(member, cur_name)
elif inspect.isgetsetdescriptor(member):
return
else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册