(self, type: str)
| 259 | |
| 260 | @memoize |
| 261 | def expect(self, type: str) -> tokenize.TokenInfo | None: |
| 262 | tok = self._tokenizer.peek() |
| 263 | if tok.string == type: |
| 264 | return self._tokenizer.getnext() |
| 265 | if type in exact_token_types: |
| 266 | if tok.type == exact_token_types[type]: |
| 267 | return self._tokenizer.getnext() |
| 268 | if type in token.__dict__: |
| 269 | if tok.type == token.__dict__[type]: |
| 270 | return self._tokenizer.getnext() |
| 271 | if tok.type == token.OP and tok.string == type: |
| 272 | return self._tokenizer.getnext() |
| 273 | return None |
| 274 | |
| 275 | def expect_forced(self, res: Any, expectation: str) -> tokenize.TokenInfo | None: |
| 276 | if res is None: |
no test coverage detected