def serialize_function(function, concrete_functions): """Build a SavedFunction proto.""" proto = saved_object_graph_pb2.SavedFunction() function_spec_proto = _serialize_function_spec(function.function_spec) proto.function_spec.CopyFrom(function_spec_proto) for concrete_function in concrete_functions: proto.concrete_functions.append(concrete_function.name) return proto
def serialize_function(function): """Build a SavedFunction proto.""" coder = nested_structure_coder.StructureCoder() proto = saved_object_graph_pb2.SavedFunction() function_spec_proto = _serialize_function_spec(function.function_spec, coder) proto.function_spec.CopyFrom(function_spec_proto) all_concrete_functions = \ function._list_all_concrete_functions_for_serialization() # pylint: disable=protected-access for concrete_function in all_concrete_functions: proto.concrete_functions.append(concrete_function.name) return proto
def serialize_function(function, name_map): """Build a SavedFunction proto.""" proto = saved_object_graph_pb2.SavedFunction() function_spec_proto = _serialize_function_spec(function.function_spec) proto.function_spec.CopyFrom(function_spec_proto) all_concrete_functions = \ function._list_all_concrete_functions_for_serialization() # pylint: disable=protected-access for concrete_function in all_concrete_functions: proto.concrete_functions.append( name_map.get(compat.as_text(concrete_function.name), concrete_function.name)) return proto