Return the next token *without* updating the index.
(self)
| 45 | return tok |
| 46 | |
| 47 | def peek(self) -> tokenize.TokenInfo: |
| 48 | """Return the next token *without* updating the index.""" |
| 49 | while self._index == len(self._tokens): |
| 50 | tok = next(self._tokengen) |
| 51 | if tok.type in (tokenize.NL, tokenize.COMMENT): |
| 52 | continue |
| 53 | if tok.type == token.ERRORTOKEN and tok.string.isspace(): |
| 54 | continue |
| 55 | if ( |
| 56 | tok.type == token.NEWLINE |
| 57 | and self._tokens |
| 58 | and self._tokens[-1].type == token.NEWLINE |
| 59 | ): |
| 60 | continue |
| 61 | self._tokens.append(tok) |
| 62 | if not self._path: |
| 63 | self._lines[tok.start[0]] = tok.line |
| 64 | return self._tokens[self._index] |
| 65 | |
| 66 | def diagnose(self) -> tokenize.TokenInfo: |
| 67 | if not self._tokens: |
no test coverage detected