12 lines
229 B
Python
12 lines
229 B
Python
from __future__ import annotations
|
|
|
|
import ast
|
|
|
|
|
|
class PythonAstParser:
|
|
def parse_module(self, text: str) -> ast.AST | None:
|
|
try:
|
|
return ast.parse(text)
|
|
except SyntaxError:
|
|
return None
|