コード例 #1
0
def load(stream, Loader=Loader):
    """
	Parse the first YAML document in a stream
	and produce the corresponding Python object.
	"""
    loader = Loader(stream)
    try:
        r = loader.get_single_data()
        return r, loader.haserrors
    finally:
        loader.dispose()
コード例 #2
0
def load(stream, Loader=Loader):
    '''Parse JSON value and produce the corresponding Python object

    :return:
        (hadproblem, object) where first argument is true if there were errors
        during loading JSON stream and second is the corresponding JSON object.
    '''
    loader = Loader(stream)
    try:
        r = loader.get_single_data()
        return r, loader.haserrors
    finally:
        loader.dispose()