Get the index of the first assignment in the line ('=' not inside brackets) Note: We don't try to support multiple special assignment (a = b = %foo)
(token_line)
| 104 | |
| 105 | |
| 106 | def _find_assign_op(token_line) -> Union[int, None]: |
| 107 | """Get the index of the first assignment in the line ('=' not inside brackets) |
| 108 | |
| 109 | Note: We don't try to support multiple special assignment (a = b = %foo) |
| 110 | """ |
| 111 | paren_level = 0 |
| 112 | for i, ti in enumerate(token_line): |
| 113 | s = ti.string |
| 114 | if s == '=' and paren_level == 0: |
| 115 | return i |
| 116 | if s in {'(','[','{'}: |
| 117 | paren_level += 1 |
| 118 | elif s in {')', ']', '}'}: |
| 119 | if paren_level > 0: |
| 120 | paren_level -= 1 |
| 121 | |
| 122 | def find_end_of_continued_line(lines, start_line: int): |
| 123 | """Find the last line of a line explicitly extended using backslashes. |
no outgoing calls