already encoded to thrift-able object in ThriftFormatter
495880
private RowSet prepareFromRow(List<Object> rows, RowSet rowSet) throws Exception {
    for (Object row : rows) {
      rowSet.addRow((Object[]) row);
    }
    return rowSet;
  }
1191721
Object encodeOutcome(T t, Throwable x) {
    return (x == null) ? (t == null) ? NIL : t : encodeThrowable(x);
  }
672363
public static Object fromStorage(Object stored, Encoder encoder, Wrapper wrapper) {
      if (encoder == null || wrapper == null) {
         throw new IllegalArgumentException("Both Encoder and Wrapper must be provided!");
      }
      if (stored == null) return null;
      return encoder.fromStorage(wrapper.unwrap(stored));
   }
1176226
def _format_obj(self, item=None):
        
        # Order here matters, odd behavior with tuples
        if item is None:
            return getattr(self, 'number')(item)
        elif isinstance(item, self.str_):
            #: String
            return item + " "
        elif isinstance(item, bytes):
            #: Bytes
            return getattr(self, 'bytes')(item)
        elif isinstance(item, self.numeric_):
            #: Float, int, etc.
            return getattr(self, 'number')(item)
        elif isinstance(item, self.dict_):
            #: Dict
            return getattr(self, 'dict')(item)
        elif isinstance(item, self.list_):
            #: List
            return getattr(self, 'list')(item)
        elif isinstance(item, tuple):
            #: Tuple
            return getattr(self, 'tuple')(item)
        elif isinstance(item, types.GeneratorType):
            #: Generator
            return getattr(self, 'generator')(item)
        elif isinstance(item, self.set_):
            #: Set
            return getattr(self, 'set')(item)
        elif isinstance(item, deque):
            #: Deque
            return getattr(self, 'deque')(item)
        elif isinstance(item, Sequence):
            #: Sequence
            return getattr(self, 'sequence')(item)
        #: Any other object
        return getattr(self, 'object')(item)
34104
function encode(cache, API_URL, obj) {
  if (!obj) return null;
  if (!obj.href) return obj;

  var href = API_URL ?
    pack(obj.href, API_URL) :
    obj.href;

  var cached = cache.get(href);
  if (cached) return cached;

  var encoded = base64.encode(new Buffer(href)).toString();
  cache.set(href, encoded);
  return encoded;
}
618837
@Override
  public RecordMaterializer<T> prepareForRead(Configuration configuration,
                                              Map<String, String> keyValueMetaData, MessageType fileSchema,
                                              ReadSupport.ReadContext readContext) {
    ThriftMetaData thriftMetaData = ThriftMetaData.fromExtraMetaData(keyValueMetaData);
    try {
      if (thriftClass == null) {
        thriftClass = getThriftClass(keyValueMetaData, configuration);
      }

      ThriftType.StructType descriptor = null;
      if (thriftMetaData != null) {
        descriptor = thriftMetaData.getDescriptor();
      } else {
        ScroogeStructConverter schemaConverter = new ScroogeStructConverter();
        descriptor = schemaConverter.convert(thriftClass);
      }

      ThriftRecordConverter<T> converter = new ScroogeRecordConverter<T>(
        thriftClass,
        readContext.getRequestedSchema(),
        descriptor);
      return converter;
    } catch (Exception t) {
      throw new RuntimeException("Unable to create Thrift Converter for Thrift metadata " + thriftMetaData, t);
    }
  }
658160
def _encode_target(data, target, mapping=None):
    
    if mapping is None:
        mapping = {t: i for i, t in enumerate(sorted(data[target].unique()))}

    data[target] = data[target].apply(lambda t: mapping[t])
    return data, mapping
745931
def _encode_item(self, item):
        '''
        
        '''
        if self.encoding.__name__ == 'pickle':
            return self.encoding.dumps(item, protocol=-1)
        else:
            return self.encoding.dumps(item)
810794
protected void fillDecoded(URLItem[] raw, String encoding, boolean scriptProteced, boolean sameAsArray) throws UnsupportedEncodingException {
	clear();
	String name, value;
	// Object curr;
	for (int i = 0; i < raw.length; i++) {
	    name = raw[i].getName();
	    value = raw[i].getValue();
	    if (raw[i].isUrlEncoded()) {
		name = URLDecoder.decode(name, encoding, true);
		value = URLDecoder.decode(value, encoding, true);
	    }
	    // MUST valueStruct
	    if (name.indexOf('.') != -1) {

		StringList list = ListUtil.listToStringListRemoveEmpty(name, '.');
		if (list.size() > 0) {
		    Struct parent = this;
		    while (list.hasNextNext()) {
			parent = _fill(parent, list.next(), new CastableStruct(Struct.TYPE_LINKED), false, scriptProteced, sameAsArray);
		    }
		    _fill(parent, list.next(), value, true, scriptProteced, sameAsArray);
		}
	    }
	    // else
	    _fill(this, name, value, true, scriptProteced, sameAsArray);
	}
    }
396681
def _EncodeDateField(field, value):
    """"""
    if field.repeated:
        result = [d.isoformat() for d in value]
    else:
        result = value.isoformat()
    return encoding.CodecResult(value=result, complete=True)
114735
def thrift_print(structure, offset=0):
    
    if not is_thrift_item(structure):
        return str(structure)
    s = str(structure.__class__) + '\n'
    for key in dir(structure):
        if key.startswith('_') or key in ['thrift_spec', 'read', 'write',
                                          'default_spec', 'validate']:
            continue
        s = s + ' ' * offset + key + ': ' + thrift_print(getattr(structure, key)
                                                         , offset+2) + '\n'
    return s
1011004
def serialize_uri(value):
    
    if isinstance(value, BNode):
        return value.n3()
    if isinstance(value, URIRef):
        return unicode(value)
    raise ValueError("Cannot get prepvalue for {0} of type {1}".format(value, value.__class__))
1212296
function Persistable (key, value) {
        const __self = this;
        __self.key = key;

        // Set value and type of object.
        if (value === undefined || value === null) {
            __self.value = undefined;
            __self.type = typeof undefined;
        } else if (value instanceof Array) {
            __self.value = [];
            value.forEach(function (e, i) {
                __self.value.push(new Persistable(key + '[' + i + ']', e));
            });
            __self.type = Type.ARRAY;
        } else {
            switch (typeof value) {
                case Type.STRING:
                case Type.NUMBER:
                case Type.BOOLEAN:
                    __self.value = value;
                    __self.type = typeof value;
                    break;
                case Type.OBJECT:
                    __self.value = [];
                    Object.keys(value).forEach(function (e) {
                        __self.value.push(new Persistable(key + '[' + e + ']', value[e]));
                    });
                    __self.type = typeof value;
                    break;
                default:
                    _logUnknownType(typeof value);
            }
        }

        __self.timestamp = Date.now();

        __self.toOriginal = function () {
            return _fromPersistable(__self);
        };
    }
646544
function stringifyStrictObjectMemory( v , runtime )
{
	var k , comma = false ;
	
	runtime.str += '{' ;
	
	for ( k in v )
	{
		if ( v[ k ] !== undefined && v.hasOwnProperty( k ) )
		//if ( v[ k ] !== undefined )	// Faster, but include properties of the prototype
		{
			if ( comma ) { runtime.str += ',' ; }
			stringifyString( k , runtime ) ;
			runtime.str += ':' ;
			stringifyAnyType( v[ k ] , runtime ) ;
			comma = true ;
		}
	}
	
	runtime.str += '}' ;
}
1291375
protected void _writeSimpleObject(Object value) throws IOException, JsonGenerationException {
	    /* 31-Dec-2009, tatu: Actually, we could just handle some basic
	     *    types even without codec. This can improve interoperability,
	     *    and specifically help with TokenBuffer.
	     */
	    if (value == null) {
	        writeNull();
	        return;
	    }
	    if (value instanceof String) {
	        writeString((String) value);
	        return;
	    }
	    if (value instanceof Number) {
	        Number n = (Number) value;
	        if (n instanceof Integer) {
	            writeNumber(n.intValue());
	            return;
	        } else if (n instanceof Long) {
	            writeNumber(n.longValue());
	            return;
	        } else if (n instanceof Double) {
	            writeNumber(n.doubleValue());
	            return;
	        } else if (n instanceof Float) {
	            writeNumber(n.floatValue());
	            return;
	        } else if (n instanceof Short) {
	            writeNumber(n.shortValue());
	            return;
	        } else if (n instanceof Byte) {
	            writeNumber(n.byteValue());
	            return;
	        } else if (n instanceof BigInteger) {
	            writeNumber((BigInteger) n);
	            return;
	        } else if (n instanceof BigDecimal) {
	            writeNumber((BigDecimal) n);
	            return;
	            
	        // then Atomic types
	            
	        } else if (n instanceof AtomicInteger) {
	            writeNumber(((AtomicInteger) n).get());
	            return;
	        } else if (n instanceof AtomicLong) {
	            writeNumber(((AtomicLong) n).get());
	            return;
	        }
	    } else if (value instanceof Boolean) {
	        writeBoolean(((Boolean) value).booleanValue());
	        return;
	    } else if (value instanceof AtomicBoolean) {
	        writeBoolean(((AtomicBoolean) value).get());
	        return;
	    }
	    throw new IllegalStateException("No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed "
	            +value.getClass().getName()+")");
	}
1234376
def encode_collection(collection, encoding='utf-8'):
    """"""

    if isinstance(collection, dict):
        return dict((encode_collection(key), encode_collection(value)) for key, value in collection.iteritems())
    elif isinstance(collection, list):
        return [encode_collection(element) for element in input]
    elif isinstance(collection, unicode):
        return collection.encode(encoding)
    else:
        return collection
402608
function serialize(obj) {
    if (!isObject(obj)) return obj;
    var pairs = [];
    for (var key in obj) {
        if (null != obj[key]) {
            pairs.push(encodeURIComponent(key)
                + '=' + encodeURIComponent(obj[key]));
        }
    }
    return pairs.join('&');
}