(source: str)
| 1585 | |
| 1586 | |
| 1587 | def _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 | |
| 1612 | def _cfg_attr_is_non_cpython_only(attr: str) -> bool: |
no test coverage detected