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

add doc strings

This commit is contained in:
Kelly Brazil
2021-11-30 11:57:04 -08:00
parent e8e4b46021
commit 1168259bc2

View File

@ -239,16 +239,19 @@ def stream_error(e, ignore_exceptions, line):
def input_type_check(data): def input_type_check(data):
"""Ensure input data is a string"""
if not isinstance(data, str): if not isinstance(data, str):
raise TypeError("Input data must be a 'str' object.") raise TypeError("Input data must be a 'str' object.")
def streaming_input_type_check(data): def streaming_input_type_check(data):
"""Ensure input data is an iterable, but not a string or bytes"""
if not hasattr(data, '__iter__') or isinstance(data, (str, bytes)): if not hasattr(data, '__iter__') or isinstance(data, (str, bytes)):
raise TypeError("Input data must be a non-string iterable object.") raise TypeError("Input data must be a non-string iterable object.")
def streaming_line_input_type_check(line): def streaming_line_input_type_check(line):
"""Ensure each line is a string"""
if not isinstance(line, str): if not isinstance(line, str):
raise TypeError("Input line must be a 'str' object.") raise TypeError("Input line must be a 'str' object.")