Skip to content

Commit b855d0f

Browse files
Save errors per cchfile
1 parent 6cfb8f8 commit b855d0f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

cchloader/file.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class CchFile(object):
7777
def __init__(self, path, fd=None, parser=None, strict=False):
7878
self.path = path
7979
self.resume_line_number = 0
80+
self.errors = []
8081
if parser is None:
8182
self.parser = get_parser(self.path)(strict=strict)
8283
else:
@@ -111,13 +112,10 @@ def _bytes_to_unicode(data):
111112
def next(self):
112113
for line in self.fd:
113114
try:
114-
# data, errors = self.parser.parse_line(line)
115115
data, errors = self.parser.parse_line(line)
116116
data = self._bytes_to_unicode(data)
117-
# if errors:
118-
# self.stats.errors.append(
119-
# (self.stats.line_number, errors)
120-
# )
117+
if errors:
118+
self.errors = list(set(self.errors + errors.items()))
121119
return data
122120
except Exception as exc:
123121
logger.critical(

0 commit comments

Comments
 (0)