MCPcopy Index your code
hub / github.com/python/cpython / next_valid_char

Function next_valid_char

Lib/traceback.py:871–879  ·  view source on GitHub ↗

Gets the next valid character index in `lines`, if the current location is not valid. Handles empty lines.

(lineno, col)

Source from the content-addressed store, hash-verified

869 return _byte_offset_to_character_offset(lines[lineno], offset)
870
871 def next_valid_char(lineno, col):
872 """Gets the next valid character index in `lines`, if
873 the current location is not valid. Handles empty lines.
874 """
875 while lineno < len(lines) and col >= len(lines[lineno]):
876 col = 0
877 lineno += 1
878 assert lineno < len(lines) and col < len(lines[lineno])
879 return lineno, col
880
881 def increment(lineno, col):
882 """Get the next valid character index in `lines`."""

Callers 3

incrementFunction · 0.85
nextlineFunction · 0.85
setup_positionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…