1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-23 00:29:59 +02:00

simplify try/except by moving outside for loop

This commit is contained in:
Kelly Brazil
2022-02-02 15:59:12 -08:00
parent aceeb84507
commit be98c9b7f6

View File

@ -119,10 +119,11 @@ def parse(
"""
jc.utils.compatibility(__name__, info.compatible, quiet)
jc.utils.streaming_input_type_check(data)
line = ''
for line in data:
output_line: Dict = {}
try:
try:
for line in data:
output_line: Dict = {}
jc.utils.streaming_line_input_type_check(line)
# parse the content here
@ -134,5 +135,5 @@ def parse(
else:
raise ParseError('Not foo data')
except Exception as e:
yield stream_error(e, ignore_exceptions, line)
except Exception as e:
yield stream_error(e, ignore_exceptions, line)