def start(): if validate_properties(config.get_properties()): logger.info('Starting application') parser = Parser(config) parser.run() else: logger.info('Something went wrong')
def get_metadata_of_incoming_statements(incoming_dir: Path, ) -> list[IncomingStatement]: incoming_statements = [] for bankpath in sorted(incoming_dir.iterdir()): if not bankpath.is_dir(): continue bank = bankpath.name bank_parsers = parsers.get(bank) if bank_parsers is None: print('unknown bank:', bank, file=sys.stderr) continue filenames = sorted(bankpath.iterdir()) if filenames: print('importing bank statements from', bank) for src_file in filenames: try: extension = src_file.suffix.lower() Parser = bank_parsers[extension] except KeyError: continue parser = Parser(src_file) m = parser.parse_metadata() print(f'{m.start_date} → {m.end_date}: {src_file}') incoming_statements.append(IncomingStatement( statement_path=src_file, parser=parser, metadata=m, )) return incoming_statements
def convert_data_to_table_format(): logger.info("transform") storage = FileStorage(SCRAPPED_FILE) # transform gathered data from json file to pandas DataFrame and save as csv parser = Parser(storage) parser.parse(TABLE_FORMAT_FILE)
def test_parse(self): instance = None try: instance = Parser(files_folder="..\\wrong_path\\to\\files_folder") except SystemExit: pass finally: self.assertEqual(instance, None)
def test_parsing_return_statement(): source_code = """ return a; """ lexer = Lexer(source_code) program = Parser(lexer).exec_program() assert program.statements[0]._token_iteral == "Return with a"
def test_parsing_infix_expression(): source_code = """ 1-2+3; """ lexer = Lexer(source_code) program = Parser(lexer).exec_program() print("===========\n") print(program.statements[0]._token_iteral) print("===========\n")
def test_parsing_let_statement(): source_code = """ let a = 122; let b = 1; """ lexer = Lexer(source_code) program = Parser(lexer).exec_program() [print(x) for x in lexer.tokens] # [print(x._token_iteral) for x in program.statements] print(program.statements[0].token_iteral) assert len(program._statements) == 2 assert program.statements[ 0].token_iteral == "This is a Let statement, left is an identifer: a, right size is value of 122"
def main(): filename = process_arguments() with open(filename) as filebuffer: try: lex = Lexer(filebuffer) parser = Parser(lex) parser.P() except EndOfFileError: print "Syntax error at line " + str(lex.line) except CompilerSyntaxError as e: print e except CompilerLexError as e: print e
def setup(self, orm_client): self.bd = orm_client self.builder = OrmBuilder(orm_client) self.parser = Parser() self.biggest_request, self.client_error, self.server_error = self.parser.parse_logs( log_path='access.log', result='access.log', save_bd=True)
from generation.generators.frontend.user_generator import UserGenerator as UserModuleGenerator from generation.generators.frontend.shopping_cart_generator import ShoppingCartGenerator as SCGenerator from generation.generators.frontend.auth_generator import AuthGenerator from generation.generators.frontend.home_generator import HomeGenerator from generation.generators.frontend.starter_generator import StarterGenerator from generation.generators.frontend.profile_generator import ProfileGenerator from generation.generators.frontend.product_generator import ProductGenerator from generation.generators.frontend.item_generator import ItemGenerator from generation.generators.frontend.category_generator import CategoryGenerator as CategoryGeneratorFront if __name__ == '__main__': try: shutil.rmtree('./output') except Exception: pass parser = Parser() model = parser.parse(os.path.join(root, "metamodel"), 'scala-angular.tx', 'project.scan', True) main_generator = MainGenerator() model_generator = ModelGenerator(main_generator) table_generator = TableGenerator(main_generator) repository_generator = RepositoryGenerator(main_generator) service_generator = ServiceGenerator(main_generator) controller_generator = ControllerGenerator(main_generator) dto_generator = DTOGenerator(main_generator) jwt_generator = JWTGenerator(main_generator) module_generator = ModuleGenerator(main_generator) conf_generator = ConfGenerator(main_generator) sbt_generator = SbtGenerator(main_generator) category_generator = CategoryGenerator(main_generator) order_generator = OrderGenerator(main_generator)
def __init__(self): self.__load_config() self.parser = Parser() self.csv_maker = CsvMaker() self.page_number = 1
def setUpClass(cls): """ We are using this class variable during entire testing. """ ParserTest.parser = Parser(files_folder="example_files")
def index_data(self): start = time() parser = Parser() self.get_all_files(self.root, parser) end = time() print(end - start)
def page_items(self): return [Parser(e) for e in self.soup.select(Locators.ITEM)]