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:
@ -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
|
||||
|
Reference in New Issue
Block a user