Skip to content

Commit

Permalink
_bytes_to_unicode for line data iteration on PackedCchFile
Browse files Browse the repository at this point in the history
  • Loading branch information
polsala committed Apr 2, 2024
1 parent b4a1fb6 commit 4fc4cb8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cchloader/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,16 @@ def __iter__(self):
def __next__(self):
return self.next()

@staticmethod
def _bytes_to_unicode(data):
return {x: y.decode() if isinstance(y, bytes) else y for x, y in data.items()}

def next(self):
for line in self.fd:
try:
# data, errors = self.parser.parse_line(line)
data, errors = self.parser.parse_line(line)
data = self._bytes_to_unicode(data)
# if errors:
# self.stats.errors.append(
# (self.stats.line_number, errors)
Expand Down

0 comments on commit 4fc4cb8

Please sign in to comment.