Uses line_info to determine the current section of the docstring. Updates state and line_info.remaining. Args: line_info: Information about the current line. state: The state of the parser.
(line_info, state)
| 531 | |
| 532 | |
| 533 | def _update_section_state(line_info, state): |
| 534 | """Uses line_info to determine the current section of the docstring. |
| 535 | |
| 536 | Updates state and line_info.remaining. |
| 537 | |
| 538 | Args: |
| 539 | line_info: Information about the current line. |
| 540 | state: The state of the parser. |
| 541 | """ |
| 542 | section_updated = False |
| 543 | |
| 544 | google_section_permitted = _google_section_permitted(line_info, state) |
| 545 | google_section = google_section_permitted and _google_section(line_info) |
| 546 | if google_section: |
| 547 | state.section.format = Formats.GOOGLE |
| 548 | state.section.title = google_section |
| 549 | line_info.remaining = _get_after_google_header(line_info) |
| 550 | line_info.remaining_raw = line_info.remaining |
| 551 | section_updated = True |
| 552 | |
| 553 | rst_section = _rst_section(line_info) |
| 554 | if rst_section: |
| 555 | state.section.format = Formats.RST |
| 556 | state.section.title = rst_section |
| 557 | line_info.remaining = _get_after_directive(line_info) |
| 558 | line_info.remaining_raw = line_info.remaining |
| 559 | section_updated = True |
| 560 | |
| 561 | numpy_section = _numpy_section(line_info) |
| 562 | if numpy_section: |
| 563 | state.section.format = Formats.NUMPY |
| 564 | state.section.title = numpy_section |
| 565 | line_info.remaining = '' |
| 566 | line_info.remaining_raw = line_info.remaining |
| 567 | section_updated = True |
| 568 | |
| 569 | if section_updated: |
| 570 | state.section.new = True |
| 571 | state.section.indentation = line_info.indentation |
| 572 | state.section.line1_indentation = line_info.next.indentation |
| 573 | else: |
| 574 | state.section.new = False |
| 575 | |
| 576 | |
| 577 | def _google_section_permitted(line_info, state): |
no test coverage detected