From 190d2d57bc8d2e3f43fbe6cbf649d878efdff878 Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Wed, 23 May 2018 13:55:32 -0700 Subject: [PATCH] Clear docstrings for auto-generated module files, and detach github links from generated files. PiperOrigin-RevId: 197783520 --- tensorflow/tools/docs/parser.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tensorflow/tools/docs/parser.py b/tensorflow/tools/docs/parser.py index 7363e4f..50c9052 100644 --- a/tensorflow/tools/docs/parser.py +++ b/tensorflow/tools/docs/parser.py @@ -615,6 +615,9 @@ def _parse_md_docstring(py_object, relative_path_to_root, reference_resolver): docstring, compatibility = _handle_compatibility(raw_docstring) docstring, function_details = _parse_function_details(docstring) + if 'Generated by: tensorflow/tools/api/generator' in docstring: + docstring = '' + return _DocstringInfo( docstring.split('\n')[0], docstring, function_details, compatibility) @@ -1597,7 +1600,8 @@ class _GeneratedFile(object): return True def __str__(self): - return 'Defined in `%s%s`.\n\n' % (self.path_prefix, self.path) + return 'Defined in generated file: `%s%s`.\n\n' % (self.path_prefix, + self.path) def _get_defined_in(py_object, parser_config): @@ -1634,6 +1638,8 @@ def _get_defined_in(py_object, parser_config): if re.match(r'.*/gen_[^/]*\.py$', path): return _GeneratedFile(path, parser_config) + if 'genfiles' in path or 'tools/api/generator' in path: + return _GeneratedFile(path, parser_config) elif re.match(r'.*_pb2\.py$', path): # The _pb2.py files all appear right next to their defining .proto file. return _ProtoFile(path[:-7] + '.proto', parser_config) -- 2.7.4