Parse the object's docstring and return a `_DocstringInfo`. This function clears @@'s from the docstring, and replaces @{} references with markdown links. For links within the same set of docs, the `relative_path_to_root` for a docstring on the page for `full_name` can be set to: ```pyt
(py_object, relative_path_to_root, reference_resolver)
| 602 | |
| 603 | |
| 604 | def _parse_md_docstring(py_object, relative_path_to_root, reference_resolver): |
| 605 | """Parse the object's docstring and return a `_DocstringInfo`. |
| 606 | |
| 607 | This function clears @@'s from the docstring, and replaces @{} references |
| 608 | with markdown links. |
| 609 | |
| 610 | For links within the same set of docs, the `relative_path_to_root` for a |
| 611 | docstring on the page for `full_name` can be set to: |
| 612 | |
| 613 | ```python |
| 614 | relative_path_to_root = os.path.relpath( |
| 615 | path='.', start=os.path.dirname(documentation_path(full_name)) or '.') |
| 616 | ``` |
| 617 | |
| 618 | Args: |
| 619 | py_object: A python object to retrieve the docs for (class, function/method, |
| 620 | or module). |
| 621 | relative_path_to_root: The relative path from the location of the current |
| 622 | document to the root of the Python API documentation. This is used to |
| 623 | compute links for "@{symbol}" references. |
| 624 | reference_resolver: An instance of ReferenceResolver. |
| 625 | |
| 626 | Returns: |
| 627 | A _DocstringInfo object, all fields will be empty if no docstring was found. |
| 628 | """ |
| 629 | # TODO(wicke): If this is a partial, use the .func docstring and add a note. |
| 630 | raw_docstring = _get_raw_docstring(py_object) |
| 631 | |
| 632 | raw_docstring = reference_resolver.replace_references( |
| 633 | raw_docstring, relative_path_to_root) |
| 634 | |
| 635 | atat_re = re.compile(r' *@@[a-zA-Z_.0-9]+ *$') |
| 636 | raw_docstring = '\n'.join( |
| 637 | line for line in raw_docstring.split('\n') if not atat_re.match(line)) |
| 638 | |
| 639 | docstring, compatibility = _handle_compatibility(raw_docstring) |
| 640 | docstring, function_details = _parse_function_details(docstring) |
| 641 | |
| 642 | if 'Generated by: tensorflow/tools/api/generator' in docstring: |
| 643 | docstring = '' |
| 644 | |
| 645 | return _DocstringInfo( |
| 646 | docstring.split('\n')[0], docstring, function_details, compatibility) |
| 647 | |
| 648 | |
| 649 | def _get_arg_spec(func): |
no test coverage detected