Skip to content

Commit 773bcc8

Browse files
MarkDaoustcopybara-github
authored andcommitted
Block the use of the builtin dict/tuple/list docstrings.
PiperOrigin-RevId: 652471051
1 parent 6680535 commit 773bcc8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tools/tensorflow_docs/api_generator/parser.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,20 @@ def _get_raw_docstring(py_object):
9292
obj_type = obj_type_lib.ObjType.get(py_object)
9393

9494
if obj_type is obj_type_lib.ObjType.TYPE_ALIAS:
95-
if inspect.getdoc(py_object) != inspect.getdoc(py_object.__origin__):
96-
result = inspect.getdoc(py_object)
97-
else:
95+
result = inspect.getdoc(py_object)
96+
if result == inspect.getdoc(py_object.__origin__):
9897
result = ''
9998
elif obj_type is obj_type_lib.ObjType.CLASS:
10099
if dataclasses.is_dataclass(py_object):
101100
result = _get_dataclass_docstring(py_object)
102101
else:
103102
result = inspect.getdoc(py_object) or ''
103+
if (
104+
result == inspect.getdoc(dict)
105+
or result == inspect.getdoc(list)
106+
or result == inspect.getdoc(tuple)
107+
):
108+
result = ''
104109
elif obj_type is obj_type_lib.ObjType.OTHER:
105110
result = ''
106111
else:

0 commit comments

Comments
 (0)