1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

add input type checks

This commit is contained in:
Kelly Brazil
2021-11-30 09:41:16 -08:00
parent 975cf195cc
commit cfb58b1cf3

View File

@ -97,12 +97,14 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
Iterator object
"""
if not quiet:
jc.utils.compatibility(__name__, info.compatible)
if not quiet: jc.utils.compatibility(__name__, info.compatible)
if not hasattr(data, '__iter__') or isinstance(data, (str, bytes)):
raise TypeError("Input data must be a non-string iterable object.")
for line in data:
output_line = {}
try:
output_line = {}
if not isinstance(line, str): raise TypeError("Input line must be a 'str' object.")
#
# parse the input here