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)
| 904 | return lineno, col |
| 905 | |
| 906 | def setup_positions(expr, force_valid=True): |
| 907 | """Get the lineno/col position of the end of `expr`. If `force_valid` is True, |
| 908 | forces the position to be a valid character (e.g. if the position is beyond the |
| 909 | end of the line, move to the next line) |
| 910 | """ |
| 911 | # -2 since end_lineno is 1-indexed and because we added an extra |
| 912 | # bracket + newline to `segment` when calling ast.parse |
| 913 | lineno = expr.end_lineno - 2 |
| 914 | col = normalize(lineno, expr.end_col_offset) |
| 915 | return next_valid_char(lineno, col) if force_valid else (lineno, col) |
| 916 | |
| 917 | statement = tree.body[0] |
| 918 | match statement: |
no test coverage detected
searching dependent graphs…