Convert a PartitionStrategy into a serialized expression. This can be used
to set a PartitionStrategy in an Avro property if the PartitionStrategy is
passed as an object.
430265
public static String toExpression(PartitionStrategy partitionStrategy) {
    List<FieldPartitioner> fieldPartitioners = partitionStrategy
        .getFieldPartitioners();
    if (fieldPartitioners.size() == 1) {
      return PartitionFunctions.toExpression(fieldPartitioners.get(0));
    }
    StringBuilder sb = new StringBuilder();
    sb.append("[");
    for (FieldPartitioner fieldPartitioner : fieldPartitioners) {
      if (sb.length() > 1) {
        sb.append(", ");
      }
      sb.append(PartitionFunctions.toExpression(fieldPartitioner));
    }
    sb.append("]");
    return sb.toString();
  }
1309177
@Override
    public final <B extends Data> B toData(Object obj) {
        return toData(obj, globalPartitioningStrategy);
    }
145561
def _dumps(self, obj):
        
        if not self.serialized:
            return obj
        return self.serializer.dumps(obj)
656325
public void serializeInsert(QueryMetadata metadata, RelationalPath<?> entity,
            List<Path<?>> columns, List<Expression<?>> values, SubQueryExpression<?> subQuery,
            SQLSerializer context) {
        context.serializeForInsert(metadata, entity, columns, values, subQuery);

        if (!metadata.getFlags().isEmpty()) {
            context.serialize(Position.END, metadata.getFlags());
        }
    }
65143
def serialize(cls, obj, buf, lineLength, validate=True):
        

        cls.generateImplicitParameters(obj)
        if validate:
            cls.validate(obj, raiseException=True)
        if obj.isNative:
            transformed = obj.transformFromNative()
            undoTransform = True
        else:
            transformed = obj
            undoTransform = False
        out = None
        outbuf = buf or six.StringIO()
        if obj.group is None:
            groupString = ''
        else:
            groupString = obj.group + '.'
        if obj.useBegin:
            foldOneLine(outbuf, "{0}BEGIN:{1}".format(groupString, obj.name),
                        lineLength)

        try:
            first_props = [s for s in cls.sortFirst if s in obj.contents \
                                    and not isinstance(obj.contents[s][0], Component)]
            first_components = [s for s in cls.sortFirst if s in obj.contents \
                                    and isinstance(obj.contents[s][0], Component)]
        except Exception:
            first_props = first_components = []
            # first_components = []

        prop_keys = sorted(list(k for k in obj.contents.keys() if k not in first_props \
                                         and not isinstance(obj.contents[k][0], Component)))
        comp_keys = sorted(list(k for k in obj.contents.keys() if k not in first_components \
                                        and isinstance(obj.contents[k][0], Component)))

        sorted_keys = first_props + prop_keys + first_components + comp_keys
        children = [o for k in sorted_keys for o in obj.contents[k]]

        for child in children:
            # validate is recursive, we only need to validate once
            child.serialize(outbuf, lineLength, validate=False)
        if obj.useBegin:
            foldOneLine(outbuf, "{0}END:{1}".format(groupString, obj.name),
                        lineLength)
        out = buf or outbuf.getvalue()
        if undoTransform:
            obj.transformToNative()
        return out
1123151
def serialize(exc):
    

    return {
        'exc_type': type(exc).__name__,
        'exc_path': get_module_path(type(exc)),
        'exc_args': list(map(safe_for_serialization, exc.args)),
        'value': safe_for_serialization(exc),
    }
262505
PartitionStrategy getSubpartitionStrategy(int startIndex) {
    if (startIndex == 0) {
      return this;
    }
    if (startIndex >= fieldPartitioners.size()) {
      return null;
    }
    return new PartitionStrategy(fieldPartitioners.subList(startIndex,
        fieldPartitioners.size()));
  }
908942
ConstructorFunction<Void, RecordFactory> createRecordFactoryConstructor(final SerializationService serializationService) {
        return notUsedArg -> {
            switch (mapConfig.getInMemoryFormat()) {
                case BINARY:
                    return new DataRecordFactory(mapConfig, serializationService, partitioningStrategy);
                case OBJECT:
                    return new ObjectRecordFactory(mapConfig, serializationService);
                default:
                    throw new IllegalArgumentException("Invalid storage format: " + mapConfig.getInMemoryFormat());
            }
        };
    }
1310038
def to_internal_value(self, data):
        
        if 'properties' in data:
            data = self.unformat_geojson(data)
        return super(GeoFeatureModelSerializer, self).to_internal_value(data)
595286
def serialize_operations(self, operations):
        """"""

        serialized_ops = []
        for operation in operations:
            serializer = self.get_serializer_class(operation.__class__)
            serialized_ops.append(serializer(operation).data)
        return serialized_ops
588192
public static SerializedObjectValueBuilder serializedObjectValue(String value, boolean isTransient) {
    return (SerializedObjectValueBuilder) serializedObjectValue().serializedValue(value).setTransient(isTransient);
  }
741452
@Override
    public Stream partitionAggregate(Fields inputFields, Aggregator agg, Fields functionFields) {
        projectionValidation(inputFields);
        return _topology.addSourcedNode(this,
                new ProcessorNode(_topology.getUniqueStreamId(),
                    _name,
                    functionFields,
                    functionFields,
                    new AggregateProcessor(inputFields, agg)));
    }
183720
def serialize(self, subject, *objects_or_combinators):
        
        ec_s = rdflib.BNode()
        if self.operator is not None:
            if subject is not None:
                yield subject, self.predicate, ec_s
            yield from oc(ec_s)
            yield from self._list.serialize(ec_s, self.operator, *objects_or_combinators)
        else:
            for thing in objects_or_combinators:
                if isinstance(thing, Combinator):
                    object = rdflib.BNode()
                    #anything = list(thing(object))
                    #if anything:
                        #[print(_) for _ in anything]
                    hasType = False
                    for t in thing(object):
                        if t[1] == rdf.type:
                            hasType = True
                        yield t

                    if not hasType:
                        yield object, rdf.type, owl.Class
                else:
                    object = thing

                yield subject, self.predicate, object
769518
@Override
    public void serialize(Map<MetadataType, MetadataComponent> components, DataOutputPlus out) throws IOException
    {
        ValidationMetadata validation = (ValidationMetadata) components.get(MetadataType.VALIDATION);
        StatsMetadata stats = (StatsMetadata) components.get(MetadataType.STATS);
        CompactionMetadata compaction = (CompactionMetadata) components.get(MetadataType.COMPACTION);

        assert validation != null && stats != null && compaction != null && validation.partitioner != null;

        EstimatedHistogram.serializer.serialize(stats.estimatedRowSize, out);
        EstimatedHistogram.serializer.serialize(stats.estimatedColumnCount, out);
        ReplayPosition.serializer.serialize(stats.replayPosition, out);
        out.writeLong(stats.minTimestamp);
        out.writeLong(stats.maxTimestamp);
        out.writeInt(stats.maxLocalDeletionTime);
        out.writeDouble(validation.bloomFilterFPChance);
        out.writeDouble(stats.compressionRatio);
        out.writeUTF(validation.partitioner);
        out.writeInt(compaction.ancestors.size());
        for (Integer g : compaction.ancestors)
            out.writeInt(g);
        StreamingHistogram.serializer.serialize(stats.estimatedTombstoneDropTime, out);
        out.writeInt(stats.sstableLevel);
        out.writeInt(stats.minColumnNames.size());
        for (ByteBuffer columnName : stats.minColumnNames)
            ByteBufferUtil.writeWithShortLength(columnName, out);
        out.writeInt(stats.maxColumnNames.size());
        for (ByteBuffer columnName : stats.maxColumnNames)
            ByteBufferUtil.writeWithShortLength(columnName, out);
    }
817520
def to_internal_value(self, data):
        
        if "session_event" in data:
            data["helper_metadata"]["session_event"] = data["session_event"]

        return super(InboundSerializer, self).to_internal_value(data)
921964
def serialize(self, serializable: Optional[Union[SerializableType, List[SerializableType]]]) \
            -> PrimitiveJsonType:
        
        if serializable is None:
            # Implements #17
            return None
        elif isinstance(serializable, List):
            return [self.serialize(item) for item in serializable]
        else:
            serialized = self._create_serialized_container()

            for mapping in self._property_mappings:
                if mapping.object_property_getter is not None and mapping.serialized_property_setter is not None:
                    value = mapping.object_property_getter(serializable)
                    if not (mapping.optional and value is None):
                        if isinstance(value, type(mapping.collection_factory([]))):
                            value = list(mapping.collection_iter(value))
                        encoded_value = self._serialize_property_value(value, mapping.serializer_cls)
                        mapping.serialized_property_setter(serialized, encoded_value)

            return serialized
528344
def serialize(cls, obj):
        

        cls._initialize()
        serializer = cls._get_serializer(type(obj))

        if serializer == cls:
            return cls._serialize_default(obj)
        else:
            return serializer.serialize(obj)