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)
| 472 | # TODO(aselle): Collect these into a big list for all modules and functions |
| 473 | # and make a rosetta stone page. |
| 474 | def _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 | |
| 493 | def _gen_pairs(items): |
no test coverage detected