MCPcopy Index your code
hub / github.com/google/python-fire / _create_line_info

Function _create_line_info

fire/docstrings.py:510–530  ·  view source on GitHub ↗

Returns information about the current line and surrounding lines.

(line, next_line, previous_line)

Source from the content-addressed store, hash-verified

508
509
510def _create_line_info(line, next_line, previous_line):
511 """Returns information about the current line and surrounding lines."""
512 line_info = Namespace() # TODO(dbieber): Switch to an explicit class.
513 line_info.line = line
514 line_info.stripped = line.strip()
515 line_info.remaining_raw = line_info.line
516 line_info.remaining = line_info.stripped
517 line_info.indentation = len(line) - len(line.lstrip())
518 # TODO(dbieber): If next_line is blank, use the next non-blank line.
519 line_info.next.line = next_line
520 next_line_exists = next_line is not None
521 line_info.next.stripped = next_line.strip() if next_line_exists else None
522 line_info.next.indentation = (
523 len(next_line) - len(next_line.lstrip()) if next_line_exists else None)
524 line_info.previous.line = previous_line
525 previous_line_exists = previous_line is not None
526 line_info.previous.indentation = (
527 len(previous_line) -
528 len(previous_line.lstrip()) if previous_line_exists else None)
529 # Note: This counts all whitespace equally.
530 return line_info
531
532
533def _update_section_state(line_info, state):

Callers 1

parseFunction · 0.85

Calls 1

NamespaceClass · 0.85

Tested by

no test coverage detected