提交 f86bc57d 编写于 作者: Y Yong Zheng Xin 提交者: Frédéric Branchaud-Charron

PEP8 styled files in docs/ (#10713)

### Summary
Modify `docs/autogen.py` so it complies to PEP8 line length rule (line length = 85).

### Related Issues

### PR Overview

- [ ] This PR requires new unit tests [y/n] (make sure tests are included)
- [ ] This PR requires to update the documentation [y/n] (make sure the docs are up-to-date)
- [X] This PR is backwards compatible [y/n]
- [ ] This PR changes the current API [y/n] (all API changes need to be approved by fchollet)
上级 6489c457
......@@ -383,7 +383,10 @@ def get_class_signature(cls):
except (TypeError, AttributeError):
# in case the class inherits from object and does not
# define __init__
class_signature = clean_module_name(cls.__module__) + '.' + cls.__name__ + '()'
class_signature = "{clean_module_name}.{cls_name}()".format(
clean_module_name=clean_module_name(cls.__module__),
cls_name=cls.__name__
)
return post_process_signature(class_signature)
......@@ -442,7 +445,8 @@ def count_leading_spaces(s):
def process_list_block(docstring, starting_point, leading_spaces, marker):
ending_point = docstring.find('\n\n', starting_point)
block = docstring[starting_point:None if ending_point == -1 else ending_point - 1]
block = docstring[starting_point:(None if ending_point == -1 else
ending_point - 1)]
# Place marker for later reinjection.
docstring = docstring.replace(block, marker)
lines = block.split('\n')
......@@ -590,9 +594,11 @@ def render_function(function, method=True):
subblocks = []
signature = get_function_signature(function, method=method)
if method:
signature = signature.replace(clean_module_name(function.__module__) + '.', '')
signature = signature.replace(
clean_module_name(function.__module__) + '.', '')
else:
signature = signature.replace(clean_module_name(function.__module__) + '.', '', 1)
signature = signature.replace(
clean_module_name(function.__module__) + '.', '', 1)
subblocks.append('### ' + function.__name__ + '\n')
subblocks.append(code_snippet(signature))
docstring = function.__doc__
......@@ -675,7 +681,8 @@ if __name__ == '__main__':
if os.path.exists(path):
template = read_file(path)
assert '{{autogenerated}}' in template, ('Template found for ' + path +
' but missing {{autogenerated}} tag.')
' but missing {{autogenerated}}'
' tag.')
mkdown = template.replace('{{autogenerated}}', mkdown)
print('...inserting autogenerated content into template:', path)
else:
......
......@@ -14,8 +14,6 @@ norecursedirs= build
pep8ignore=* E402 \
* E731 \
docs/autogen.py E501 \
docs/__init__.py E501 \
examples/addition_rnn.py E501 \
examples/antirectifier.py E501 \
examples/babi_memnn.py E501 \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册