Ingest comdirect #5
+3
-2
@@ -47,14 +47,15 @@ def reader_comdirect(path: Path):
|
|||||||
elif expect_next == EXPECT_LINE.HEADER:
|
elif expect_next == EXPECT_LINE.HEADER:
|
||||||
header = re.findall(PATTERN_HEADER, line)
|
header = re.findall(PATTERN_HEADER, line)
|
||||||
if header:
|
if header:
|
||||||
result[account_name]["data"] = []
|
result[account_name] = []
|
||||||
expect_next = EXPECT_LINE.DATA
|
expect_next = EXPECT_LINE.DATA
|
||||||
elif expect_next == EXPECT_LINE.DATA:
|
elif expect_next == EXPECT_LINE.DATA:
|
||||||
data = re.findall(PATTERN_DATA, line)
|
data = re.findall(PATTERN_DATA, line)
|
||||||
if data:
|
if data:
|
||||||
result[account_name]["data"].append(
|
result[account_name].append(
|
||||||
{column: value for column, value in zip(header, data)}
|
{column: value for column, value in zip(header, data)}
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
expect_next = EXPECT_LINE.ACCOUNT_NAME
|
expect_next = EXPECT_LINE.ACCOUNT_NAME
|
||||||
else:
|
else:
|
||||||
expect_next = EXPECT_LINE.ACCOUNT_NAME
|
expect_next = EXPECT_LINE.ACCOUNT_NAME
|
||||||
|
|||||||
Reference in New Issue
Block a user