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)
| 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: |
no test coverage detected