Skip to content

Commit ae9db14

Browse files
authored
Handle log file lines with unmatched delimiters. (#30)
1 parent 935a148 commit ae9db14

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

mtga_log.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ def get_last_keyword_block(self, keyword):
8787
if copy and line:
8888
bucket.append(line)
8989

90-
dict_levels += line.count('{') - line.count('}')
91-
list_levels += line.count('[') - line.count(']')
90+
if copy:
91+
dict_levels += line.count('{') - line.count('}')
92+
list_levels += line.count('[') - line.count(']')
9293

9394
if line.count('}') > 0 and dict_levels == 0 and list_levels == 0:
9495
copy = False

tests/test_mtga_output_log.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
RingDoorbell [fdHost:client.arenagame-a.east.magic-the-gathering-arena.com, fdPort:9405, contentHash:
2+
13
<== PlayerInventory.GetPlayerCardsV3(10)
24
{
35
"67682": "1",

0 commit comments

Comments
 (0)