(
src: str, version: tuple[int, int], *, type_comments: bool
)
| 129 | |
| 130 | |
| 131 | def _parse_single_version( |
| 132 | src: str, version: tuple[int, int], *, type_comments: bool |
| 133 | ) -> ast.AST: |
| 134 | filename = "<unknown>" |
| 135 | with warnings.catch_warnings(): |
| 136 | warnings.simplefilter("ignore", SyntaxWarning) |
| 137 | warnings.simplefilter("ignore", DeprecationWarning) |
| 138 | return ast.parse( |
| 139 | src, filename, feature_version=version, type_comments=type_comments |
| 140 | ) |
| 141 | |
| 142 | |
| 143 | def parse_ast(src: str) -> ast.AST: |