MCPcopy Create free account
hub / github.com/PyO3/pyo3 / _iter_extern_libpython_blocks

Function _iter_extern_libpython_blocks

noxfile.py:1587–1609  ·  view source on GitHub ↗
(source: str)

Source from the content-addressed store, hash-verified

1585
1586
1587def _iter_extern_libpython_blocks(source: str) -> Iterator[str]:
1588 cursor = 0
1589 while True:
1590 start = source.find("extern_libpython!", cursor)
1591 if start == -1:
1592 return
1593
1594 block_start = source.find("{", start)
1595 if block_start == -1:
1596 return
1597
1598 depth = 0
1599 for idx in range(block_start, len(source)):
1600 if source[idx] == "{":
1601 depth += 1
1602 elif source[idx] == "}":
1603 depth -= 1
1604 if depth == 0:
1605 yield source[block_start + 1 : idx]
1606 cursor = idx + 1
1607 break
1608 else:
1609 return
1610
1611
1612def _cfg_attr_is_non_cpython_only(attr: str) -> bool:

Callers 1

Calls 1

findMethod · 0.45

Tested by

no test coverage detected