module documentation

Undocumented

Function json_splitter Attempt to parse a json object from a buffer. If there is at least one object, return it and the rest of the buffer, otherwise return None.
Function json_stream Given a stream of text, return a stream of json objects. This handles streams which are inconsistently buffered (some entries may be newline delimited, and others are not).
Function line_splitter Undocumented
Function split_buffer Given a generator which yields strings and a splitter function, joins all input, splits on the separator and yields each chunk. Unlike string.split(), each chunk includes the trailing separator, except for the last one if none was found on the end of the input.
Function stream_as_text Given a stream of bytes or text, if any of the items in the stream are bytes convert them to text. This function can be removed once we return text streams instead of byte streams.
Variable json_decoder Undocumented
def json_splitter(buffer): (source)

Attempt to parse a json object from a buffer. If there is at least one object, return it and the rest of the buffer, otherwise return None.

def json_stream(stream): (source)

Given a stream of text, return a stream of json objects. This handles streams which are inconsistently buffered (some entries may be newline delimited, and others are not).

def line_splitter(buffer, separator='\n'): (source)

Undocumented

def split_buffer(stream, splitter=None, decoder=(lambda a: a)): (source)

Given a generator which yields strings and a splitter function, joins all input, splits on the separator and yields each chunk. Unlike string.split(), each chunk includes the trailing separator, except for the last one if none was found on the end of the input.

def stream_as_text(stream): (source)

Given a stream of bytes or text, if any of the items in the stream are bytes convert them to text. This function can be removed once we return text streams instead of byte streams.

json_decoder = (source)

Undocumented