Merge pull request #3 from briel/stopiteration

Catch StopIteration exception for python 3.7 compatibility.
LT1AB
Bryan V Riel 2019-02-07 15:25:51 -08:00 committed by GitHub Enterprise
commit 42c76f5374
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