Skip to content

Commit

Permalink
Update json_helper.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Sep 23, 2019
1 parent b604e87 commit cdc36db
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/ensae_projects/hackathon/json_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@brief Helpers for the hackathon 2017 (Label Emmaüs).
"""
import os
from io import StringIO, BytesIO
from io import BytesIO
import ijson
from pyquickhelper.loghelper import noLOG

Expand Down Expand Up @@ -91,11 +91,7 @@ def enumerate_json_items(filename, encoding=None, fLOG=noLOG):
for el in enumerate_json_items(f, encoding=encoding, fLOG=fLOG):
yield el
elif isinstance(filename, str):
st = StringIO(filename)
for el in enumerate_json_items(st, encoding=encoding, fLOG=fLOG):
yield el
elif isinstance(filename, bytes):
st = BytesIO(filename)
st = BytesIO(filename.encode('utf-8'))
for el in enumerate_json_items(st, encoding=encoding, fLOG=fLOG):
yield el
else:
Expand Down

0 comments on commit cdc36db

Please sign in to comment.