Catch StopIteration exception for python 3.7 compatibility.

LT1AB
Bryan Riel 2019-02-07 10:30:20 -08:00
parent 64113c7030
commit 126e957fe6
1 changed files with 7 additions and 4 deletions

View File

@ -46,10 +46,13 @@ from .reserved import glyphs
def _unwrap_lines(gline, wrap=glyphs.WRAP): def _unwrap_lines(gline, wrap=glyphs.WRAP):
"""given a read_stream() generator, yield UNWRAPPED RDF lines""" """given a read_stream() generator, yield UNWRAPPED RDF lines"""
while True: while True:
line = next(gline) try:
while line.endswith(wrap): line = next(gline)
line = line[:-len(wrap)] + next(gline) while line.endswith(wrap):
yield line line = line[:-len(wrap)] + next(gline)
yield line
except StopIteration:
return
## file name --> unwrapped lines ## file name --> unwrapped lines
# \param src A file name # \param src A file name