Source code for pyfileconf.io.file.load.parsers.py

from typing import Tuple, List
import ast

from pyfileconf.io.file.load.parsers.base import FileParser

AstModuleAndStrListTuple = Tuple[ast.Module, List[str]]

[docs]class PythonFileParser(FileParser):
[docs] def load(self) -> AstModuleAndStrListTuple: # type: ignore # Get text of file file_lines = super().load() # Parse into ast module: ast.Module = ast.parse(''.join(file_lines)) return module, file_lines