MCPcopy
hub / github.com/psf/black / is_async_stmt_or_funcdef

Function is_async_stmt_or_funcdef

src/black/nodes.py:946–956  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

944
945
946def 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
959def is_type_comment(leaf: Leaf, mode: Mode) -> bool:

Callers 1

lineMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected