Skip to content
This repository was archived by the owner on Mar 26, 2023. It is now read-only.

Commit f15d61a

Browse files
authored
One hack away brings another hax
1 parent 5e6dab7 commit f15d61a

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

main.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ def _find_first_comicid(line, ln=None):
1818
try:
1919

2020
# QUIRK: dataset has a spew of typos and odds, so the regex has to be complex
21-
result = re.findall(r'^(\s|)((g[as]\w+|dr\w+|pg[a-zA-Z0-9_-]+|\w+)(\s|)(--|\.\.|- -|\*\*))', line, flags=re.I)
21+
result = re.findall(r'^((g[as]\w+|dr\w+|pg[a-zA-Z0-9_-]+|\w+)(\s|)(--|\.\.|- -|\*\*))', line, flags=re.I)
2222
if len(result) <= 0:
2323
raise IndexError("No match for regex", result, line)
2424
if len(result[0]) <= 0:
2525
raise IndexError("No group in match 0 in regex (undefined behaviour)", result[0], line)
2626

27-
return result[0][1:]
27+
return result[0]
2828

2929
except Exception as e:
3030

@@ -44,8 +44,10 @@ def cleanup(input_file, output):
4444
_skip_ahead = _skip_ahead - 1
4545
continue
4646

47+
line = lines[i].strip()
48+
4749
# find comicid (for merging lines together)
48-
comicid = _find_first_comicid(lines[i], ln=i)
50+
comicid = _find_first_comicid(line, ln=i)
4951

5052
_proc_line = ""
5153

@@ -57,12 +59,13 @@ def cleanup(input_file, output):
5759

5860
try:
5961
_sub_comicid = _find_first_comicid(_loop_line, ln=i + i2)
60-
except: # line has no comicid header? TODO: that even happens???
61-
print("WARNING: malfromed line, # %s :" % (i + i2))
62-
print(_loop_line)
63-
print("Root line # %s :" % i)
64-
print(lines[i].strip())
65-
# _proc_line += " " + _loop_line
62+
except: # line has no comicid header?
63+
print("WARNING: malfromed line #%s from %s" % (i + i2, i))
64+
if _loop_line == "-" * len(_loop_line) or _loop_line == "." * len(_loop_line):
65+
print("skip")
66+
else:
67+
pass
68+
#_proc_line += " " + _loop_line
6669
_skip_ahead += 1
6770
continue
6871

0 commit comments

Comments
 (0)