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

Function _handle_compatibility

tensorflow/tools/docs/parser.py:474–490  ·  view source on GitHub ↗

Parse and remove compatibility blocks from the main docstring. Args: doc: The docstring that contains compatibility notes" Returns: a tuple of the modified doc string and a hash that maps from compatibility note type to the text of the note.

(doc)

Source from the content-addressed store, hash-verified

472# TODO(aselle): Collect these into a big list for all modules and functions
473# and make a rosetta stone page.
474def _handle_compatibility(doc):
475 """Parse and remove compatibility blocks from the main docstring.
476
477 Args:
478 doc: The docstring that contains compatibility notes"
479
480 Returns:
481 a tuple of the modified doc string and a hash that maps from compatibility
482 note type to the text of the note.
483 """
484 compatibility_notes = {}
485 match_compatibility = re.compile(r'[ \t]*@compatibility\((\w+)\)\s*\n'
486 r'((?:[^@\n]*\n)+)'
487 r'\s*@end_compatibility')
488 for f in match_compatibility.finditer(doc):
489 compatibility_notes[f.group(1)] = f.group(2)
490 return match_compatibility.subn(r'', doc)[0], compatibility_notes
491
492
493def _gen_pairs(items):

Callers 1

_parse_md_docstringFunction · 0.85

Calls 2

compileMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected