Clear docstrings for auto-generated module files, and detach github links from genera...
authorMark Daoust <markdaoust@google.com>
Wed, 23 May 2018 20:55:32 +0000 (13:55 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Wed, 23 May 2018 20:58:24 +0000 (13:58 -0700)
PiperOrigin-RevId: 197783520

tensorflow/tools/docs/parser.py

index 7363e4f..50c9052 100644 (file)
@@ -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)