MCPcopy Index your code
hub / github.com/RustPython/RustPython / setup_positions

Function setup_positions

Lib/traceback.py:890–899  ·  view source on GitHub ↗

Get the lineno/col position of the end of `expr`. If `force_valid` is True, forces the position to be a valid character (e.g. if the position is beyond the end of the line, move to the next line)

(expr, force_valid=True)

Source from the content-addressed store, hash-verified

888 return lineno, col
889
890 def setup_positions(expr, force_valid=True):
891 """Get the lineno/col position of the end of `expr`. If `force_valid` is True,
892 forces the position to be a valid character (e.g. if the position is beyond the
893 end of the line, move to the next line)
894 """
895 # -2 since end_lineno is 1-indexed and because we added an extra
896 # bracket + newline to `segment` when calling ast.parse
897 lineno = expr.end_lineno - 2
898 col = normalize(lineno, expr.end_col_offset)
899 return next_valid_char(lineno, col) if force_valid else (lineno, col)
900
901 statement = tree.body[0]
902 match statement:

Calls 2

next_valid_charFunction · 0.85
normalizeFunction · 0.70

Tested by

no test coverage detected