(tlist)
| 132 | class SpacesAroundOperatorsFilter: |
| 133 | @staticmethod |
| 134 | def _process(tlist): |
| 135 | |
| 136 | ttypes = (T.Operator, T.Comparison) |
| 137 | tidx, token = tlist.token_next_by(t=ttypes) |
| 138 | while token: |
| 139 | nidx, next_ = tlist.token_next(tidx, skip_ws=False) |
| 140 | if next_ and next_.ttype != T.Whitespace: |
| 141 | tlist.insert_after(tidx, sql.Token(T.Whitespace, ' ')) |
| 142 | |
| 143 | pidx, prev_ = tlist.token_prev(tidx, skip_ws=False) |
| 144 | if prev_ and prev_.ttype != T.Whitespace: |
| 145 | tlist.insert_before(tidx, sql.Token(T.Whitespace, ' ')) |
| 146 | tidx += 1 # has to shift since token inserted before it |
| 147 | |
| 148 | # assert tlist.token_index(token) == tidx |
| 149 | tidx, token = tlist.token_next_by(t=ttypes, idx=tidx) |
| 150 | |
| 151 | def process(self, stmt): |
| 152 | [self.process(sgroup) for sgroup in stmt.get_sublists()] |
nothing calls this directly
no test coverage detected