Return True if the given leaf starts an async def/for/with statement. Note that `async def` can be either an `async_stmt` or `async_funcdef`, the latter is used when it has decorators.
(leaf: Leaf)
| 944 | |
| 945 | |
| 946 | def is_async_stmt_or_funcdef(leaf: Leaf) -> bool: |
| 947 | """Return True if the given leaf starts an async def/for/with statement. |
| 948 | |
| 949 | Note that `async def` can be either an `async_stmt` or `async_funcdef`, |
| 950 | the latter is used when it has decorators. |
| 951 | """ |
| 952 | return bool( |
| 953 | leaf.type == token.ASYNC |
| 954 | and leaf.parent |
| 955 | and leaf.parent.type in {syms.async_stmt, syms.async_funcdef} |
| 956 | ) |
| 957 | |
| 958 | |
| 959 | def is_type_comment(leaf: Leaf, mode: Mode) -> bool: |