Removes non-serializable data. Allowed data types are strings, arrays,
 and hashes. All other types are converted to strings.
 TODO: move this onto Hash
338131
def clean_unserializable_data(data, stack = [])
      return "[possible infinite recursion halted]" if stack.any?{|item| item == data.object_id }

      if data.respond_to?(:to_hash)
        data.to_hash.inject({}) do |result, (key, value)|
          result.merge(key => clean_unserializable_data(value, stack + [data.object_id]))
        end
      elsif data.respond_to?(:to_ary)
        data.collect do |value|
          clean_unserializable_data(value, stack + [data.object_id])
        end
      else
        data.to_s
      end
    end
1293446
def serialize_detail(self, data):
        
        if data is None:
            return ''

        # Check for a ``Data``-like object. We should assume ``True`` (all
        # data gets prepared) unless it's explicitly marked as not.
        if not getattr(data, 'should_prepare', True):
            prepped_data = data.value
        else:
            prepped_data = self.prepare(data)

        return self.serializer.serialize(prepped_data)
168467
def delete(options = {}, invalidate = true)
      if invalidate
        self.invalidate
      end
      options = @options.merge(options)
      response = self.class.delete(@uri, options)
      if response.success?
        deserialize(response)
      else
        fail HttpError, response.response
      end
    end
1189515
def unset(entity, *types):
    
    if not types:
        types = (TypedField,)

    fields = list(entity._fields.keys())
    remove = (x for x in fields if isinstance(x, types))

    for field in remove:
        del entity._fields[field]
453195
public void clearInputs() {
        unCache();
        for (TransactionInput input : inputs) {
            input.setParent(null);
        }
        inputs.clear();
        // You wanted to reserialize, right?
        this.length = this.unsafeBitcoinSerialize().length;
    }
722490
def clean(self):
        ''''''
        if not self.urlhash or 'url' in self._get_changed_fields():
            self.urlhash = hash_url(self.url)
        super(Reuse, self).clean()
1299601
def unregistercls(self, schemacls=None, data_types=None):
        
        if schemacls is not None:

            # clean schemas by data type
            for data_type in list(self._schbytype):
                _schemacls = self._schbytype[data_type]
                if _schemacls is schemacls:
                    del self._schbytype[data_type]

        if data_types is not None:

            for data_type in data_types:
                if data_type in self._schbytype:
                    del self._schbytype[data_type]
263003
def reset(self, data={}):
        
        if data and (isinstance(data, dict) or isinstance(data, list)):
            self._json_data = data
        else:
            self._json_data = copy.deepcopy(self._raw_data)

        self.__reset_queries()
        return self
1110012
function __serializeObject(data, options=DEFAULT_OPTIONS) {
	let dataBuffers = [];
	let allKeys = (options.sort_key === true) ? Object.keys(data).sort() : Object.keys(data);
	// ignore undefined value
	for (let key of allKeys) {
		let subData = data[key];
		if (subData === undefined) continue;

		let subType = __getType(subData, options);
		let subTypeBuffer = __serializeType(subType);
		let keyBuffers = __serializeShortString(key);
		let subDataBuffers = __serializeData(subType, subData, options);
		dataBuffers.push(subTypeBuffer, ...keyBuffers, ...subDataBuffers);
	}
	let length = __getLengthByArrayBuffers(dataBuffers);
	let lengthData = new Uint32Array([length]);
	return [lengthData.buffer, ...dataBuffers];
}
688459
def remove(self, value):
        
        # Raise TypeError if value is not hashable
        hash(value)

        result = self.redis.srem(self.key, self._pickle(value))
        if not result:
            raise KeyError(value)
1035198
def keys_to_string(data):
    
    if isinstance(data, dict):
        for key in list(data.keys()):
            if isinstance(key, six.string_types):
                value = data[key]
                val = keys_to_string(value)
                del data[key]
                data[key.encode("utf8", "ignore")] = val
    return data
654318
def clean_data(input_value):

    ''' 
    '''

# pass normal json/yaml datatypes
    if input_value.__class__.__name__ in ['bool', 'str', 'float', 'int', 'NoneType']:
        pass

# transform byte data to base64 encoded string
    elif isinstance(input_value, bytes):
        from base64 import b64encode
        input_value = b64encode(input_value).decode()

# convert tuples and sets into lists
    elif isinstance(input_value, tuple) or isinstance(input_value, set):
        new_list = []
        new_list.extend(input_value)
        input_value = transform_data(clean_data, new_list)

# recurse through dictionaries and lists
    elif isinstance(input_value, dict) or isinstance(input_value, list):
        input_value = transform_data(clean_data, input_value)

# convert to string all python objects and callables
    else:
        input_value = str(input_value)

    return input_value
824656
def _remove_non_serializable_store_entries(store: Store) -> dict:
        
        cleaned_store_data = {}
        for key, value in store.items():
            if Script._is_serializable(key) and Script._is_serializable(value):
                cleaned_store_data[key] = value
            else:
                _logger.info("Skip non-serializable item in the local script store. Key: '{}', Value: '{}'. "
                             "This item cannot be saved and therefore will be lost when autokey quits.".format(
                                key, value
                ))
        return cleaned_store_data
863763
def unserialize(cls, string):
        
        id_s, created_s = string.split('_')
        return cls(int(id_s, 16),
                   datetime.utcfromtimestamp(int(created_s, 16)))
63950
private V removeFromDataIndexOfKey(int dataIndexOfKey) {
    int dataSize = this.size << 1;
    if (dataIndexOfKey < 0 || dataIndexOfKey >= dataSize) {
      return null;
    }
    V result = valueAtDataIndex(dataIndexOfKey + 1);
    Object[] data = this.data;
    int moved = dataSize - dataIndexOfKey - 2;
    if (moved != 0) {
      System.arraycopy(data, dataIndexOfKey + 2, data, dataIndexOfKey, moved);
    }
    this.size--;
    setData(dataSize - 2, null, null);
    return result;
  }
44429
private boolean removeUnreadable() {
		List<File> unreadable = inventory.removeUnreadable();
		unreadable.forEach(v->v.delete());
		return !unreadable.isEmpty();
	}
1170515
def delete_vector(self, hash_name, bucket_keys, data):
        
        lsh_keys = [self._format_mongo_key(hash_name, key)
                    for key in bucket_keys]
        self.mongo_object.remove({'lsh': {'$in': lsh_keys},
                                  'data': data})