How to use the pyupgrade.Block function in pyupgrade

To help you get started, we’ve selected a few pyupgrade examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asottile / pyupgrade / pyupgrade.py View on Github external
def _find_if_else_block(tokens, i):
    # type: (List[Token], int) -> Tuple[Block, Block]
    if_block = Block.find(tokens, i)
    i = if_block.end
    while tokens[i].src != 'else':
        i += 1
    else_block = Block.find(tokens, i, trim_end=True)
    return if_block, else_block

pyupgrade

A tool to automatically upgrade syntax for newer versions.

MIT
Latest version published 1 month ago

Package Health Score

85 / 100
Full package analysis

Similar packages