-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.py
More file actions
23 lines (17 loc) · 730 Bytes
/
parser.py
File metadata and controls
23 lines (17 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from config import input_path, output_path
from utils import get_csv_files, get_transactions_from_file, write_transactions
from writers.writers import CsvWriter
def parse_csv_files():
transactions = []
for file_path in get_csv_files(input_path):
print(f'Reading file: {file_path}')
transactions += get_transactions_from_file(file_path)
print(f'{len(transactions)} transactions have been parsed')
return transactions
def process_files():
print('Processing is started')
transactions = parse_csv_files()
write_transactions(transactions=transactions, writers=[CsvWriter(output_dir_path=output_path)])
print('Processing is finished')
if __name__ == '__main__':
process_files()