MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _get_raw_docstring

Function _get_raw_docstring

tensorflow/tools/docs/parser.py:127–144  ·  view source on GitHub ↗

Get the docs for a given python object. Args: py_object: A python object to retrieve the docs for (class, function/method, or module). Returns: The docstring, or the empty string if no docstring was found.

(py_object)

Source from the content-addressed store, hash-verified

125
126
127def _get_raw_docstring(py_object):
128 """Get the docs for a given python object.
129
130 Args:
131 py_object: A python object to retrieve the docs for (class, function/method,
132 or module).
133
134 Returns:
135 The docstring, or the empty string if no docstring was found.
136 """
137 # For object instances, tf_inspect.getdoc does give us the docstring of their
138 # type, which is not what we want. Only return the docstring if it is useful.
139 if (tf_inspect.isclass(py_object) or tf_inspect.ismethod(py_object) or
140 tf_inspect.isfunction(py_object) or tf_inspect.ismodule(py_object) or
141 isinstance(py_object, property)):
142 return tf_inspect.getdoc(py_object) or ''
143 else:
144 return ''
145
146
147# A regular expression for capturing a @{symbol} reference.

Callers 1

_parse_md_docstringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected