Esempio n. 1
0
def create_method_call(method, args, output, call_type, execution, user_object):
    sargs = stable_serialize_call_arguments(execution, args)
    if call_type == 'output':
        call = MethodCall(method, sargs)
        call.set_output(execution.serialize(output))
        return call
    elif call_type == 'exception':
        call = MethodCall(method, sargs)
        call.set_exception(execution.serialize(output))
        return call
    elif call_type == 'generator':
        gobject = GeneratorObject(None, method, sargs, user_object)
        for syield in map(execution.serialize, output):
            gobject.add_call(GeneratorObjectInvocation(method, {}, syield))
        return gobject