Find the first escaped command (%foo, !foo, etc.) in the cell.
(cls, tokens_by_line)
| 368 | """Transformer for escaped commands like %foo, !foo, or /foo""" |
| 369 | @classmethod |
| 370 | def find(cls, tokens_by_line): |
| 371 | """Find the first escaped command (%foo, !foo, etc.) in the cell. |
| 372 | """ |
| 373 | for line in tokens_by_line: |
| 374 | if not line: |
| 375 | continue |
| 376 | ix = 0 |
| 377 | ll = len(line) |
| 378 | while ll > ix and line[ix].type in {tokenize.INDENT, tokenize.DEDENT}: |
| 379 | ix += 1 |
| 380 | if ix >= ll: |
| 381 | continue |
| 382 | if line[ix].string in ESCAPE_SINGLES: |
| 383 | return cls(line[ix].start) |
| 384 | |
| 385 | def transform(self, lines): |
| 386 | """Transform an escaped line found by the ``find()`` classmethod. |
nothing calls this directly
no outgoing calls
no test coverage detected