Hashes vector v and stores it in all matching buckets in the storage.
        The data argument must be JSON-serializable. It is stored with the
        vector and will be returned in search results.
550229
def store_vector(self, v, data=None):
        
        # We will store the normalized vector (used during retrieval)
        nv = unitvec(v)
        # Store vector in each bucket of all hashes
        for lshash in self.lshashes:
            for bucket_key in lshash.hash_vector(v):
                #print 'Storying in bucket %s one vector' % bucket_key
                self.storage.store_vector(lshash.hash_name, bucket_key,
                                          nv, data)
1050364
def hash_vector(self, v, querying=False):
        

        bucket_keys = []

        if querying:
            # If we are querying, use the bucket key map
            for lshash in self.child_hashes:
                # Get regular bucket keys from hash
                for bucket_key in lshash.hash_vector(v, querying):
                    prefixed_key = lshash.hash_name+'_'+bucket_key
                    # Get entries from map (bucket keys with hamming distance of 1)
                    if prefixed_key in self.bucket_key_map:
                        bucket_keys.extend(self.bucket_key_map[prefixed_key].keys())
        else:
            # If we are indexing (storing) just use child hashes without permuted index
            for lshash in self.child_hashes:
                # Get regular bucket keys from hash
                for bucket_key in lshash.hash_vector(v, querying):
                    # Get permuted keys
                    perm_keys = self.permuted_keys(bucket_key)
                    # Put extact hit key into list
                    perm_keys.append(bucket_key)

                    # Append key for storage (not the permutations)
                    bucket_keys.append(lshash.hash_name+'_'+bucket_key)

                    # For every permutation register all the variants
                    for perm_key in perm_keys:
                        prefixed_key = lshash.hash_name+'_'+perm_key

                        # Make sure dictionary exists
                        if not prefixed_key in self.bucket_key_map:
                            self.bucket_key_map[prefixed_key] = {}

                        for variant in perm_keys:
                            prefixed_variant = lshash.hash_name+'_'+variant
                            self.bucket_key_map[prefixed_key][prefixed_variant] = 1

        # Return all the bucket keys
        return bucket_keys
357263
def ComputeHash(self, key):
        
        if key is None:
            raise ValueError("key is None.")

        hash_value = self._ComputeHash(key)
        return bytearray(pack('I', hash_value))
247843
def hash(self):
        '''
        
        '''
        hashed = super(Container, self).hash()
        for f in self._fields:
            f_hashed = f.hash()
            hashed = khash(hashed + f_hashed)
        return hashed
681837
def to_hash
      result = {}
      @lines.entries.each do |section|
        result[section.key] ||= {}
        section.entries.each do |option|
          opts = Array(option)
          val = opts.map { |o| o.respond_to?(:value) ? o.value : o }
          val = val.size > 1 ? val : val.first
          result[section.key][opts.first.key] = val
        end
      end
      result
    end
1031570
def hashone(self):
    ""
    rs = self.one()
    if not rs: 
      return {}
    else:
      finds = " ".join(self._find).split(' ')
      return dict(zip((x.replace('?','') for x in finds), rs))
224637
function loadMeshJSON(mesh,hashname, args){
  // add/get json store
  var json = mesh.json_store[hashname];
  if(!json)
    json = mesh.json_store[hashname] = {hashname:hashname,paths:[],keys:{}};

  if(args.keys)
    json.keys = args.keys;

  // only know a single csid/key
  if(args.csid && args.key)
  {
    json.keys[args.csid] = args.key;
  }

  // make sure no buffers
  Object.keys(json.keys).forEach(function(csid){
    if(Buffer.isBuffer(json.keys[csid]))
      json.keys[csid] = base32.encode(json.keys[csid]);
  });

  return json;
}
1304560
function hashHas(key) {
    var data = this.__data__;
    return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  }
798131
def hash_vector(self, v, querying=False):
        
        if scipy.sparse.issparse(v):
            # If vector is sparse, make sure we have the CSR representation
            # of the projection matrix
            if self.components_csr == None:
                self.components_csr = scipy.sparse.csr_matrix(self.components)
            # Make sure that we are using CSR format for multiplication
            if not scipy.sparse.isspmatrix_csr(v):
                v = scipy.sparse.csr_matrix(v)
            # Project vector onto all hyperplane normals
            projection = (self.components_csr.dot(v) / self.bin_width).floor().toarray()
        else:
            # Project vector onto components
            projection = numpy.dot(self.components, v)
            projection = numpy.floor(projection / self.bin_width)
        # Return key
        return ['_'.join([str(int(x)) for x in projection])]
913759
def hash_file(file_obj,
              hash_function=hashlib.md5):
    
    # before we read the file data save the current position
    # in the file (which is probably 0)
    file_position = file_obj.tell()
    # create an instance of the hash object
    hasher = hash_function()
    # read all data from the file into the hasher
    hasher.update(file_obj.read())
    # get a hex version of the result
    hashed = hasher.hexdigest()
    # return the file object to its original position
    file_obj.seek(file_position)

    return hashed
1213304
def hash(self):
        '''
        
        '''
        hashed = super(Group, self).hash()
        return khash(hashed, frozenset(self._values))
1213887
def to_hash
            index_hash = Hash.new
            index_hash["json_claz"] = self.class.name
            index_hash["id"] = id
            index_hash["account_id"] = account_id
            index_hash["asm_id"] = asm_id
            index_hash["org_id"] = org_id
            index_hash["tosca_type"] = tosca_type
            index_hash["inputs"] = inputs
            index_hash["outputs"] = outputs
            index_hash["name"] = name
            index_hash["status"] = status
            index_hash["disk_id"] = disk_id
            index_hash["snap_id"] = snap_id
            index_hash["created_at"] = created_at
            index_hash["updated_at"] = updated_at
            index_hash["some_msg"] = some_msg
            index_hash
        end
712310
def delete_vector(self, hash_name, bucket_keys, data):
        
        for key in bucket_keys:
            bucket = self.get_bucket(hash_name, key)
            bucket[:] = [(v, id_data) for v, id_data
                         in bucket if id_data != data]
948648
function FeatureHashing(k) {
    // @Private variables
    var featureVector = {}, valueCount, length;

    // Init
    if (k > MAX_SAFE_INTEGER_HEX_LENGTH*4 || k < 1 || k !== (k|0)) { throw new Error("Feature vector bit length must be an integer between 1 and " + (MAX_SAFE_INTEGER_HEX_LENGTH*4) + "inclusive."); }
    length = Math.pow(2, k||18); // Feature vector hash of 2^18 is used in Vowpal Wabbit
    valueCount = 0;

    // @Privileged function (public w/ private variable access)
    this.add = add;
    function add(value) {
        var hashHex, hashInt, featureNumber;

        hashHex = crypto.createHash('md5').update(value).digest('hex');
        hashInt = parseInt(hashHex.slice(hashHex.length - MAX_SAFE_INTEGER_HEX_LENGTH), 16); // Low bits of the hash
        featureNumber = hashInt % length;

        if (featureVector[featureNumber] === undefined) { featureVector[featureNumber] = 1; }
        else { featureVector[featureNumber] += 1; }
        valueCount += 1;
    }

    // @Privileged function (public w/ private variable access)
    this.sparseFeatureVector = function() { return featureVector; }

    // @Privileged function (public w/ private variable access)
    this.sparseLength = function() { return Object.keys(featureVector).length; }

    // @Privileged function (public w/ private variable access)
    this.length = function() { return length; }

    // @Privileged function (public w/ private variable access)
    this.fillRatio = function() { return (length / Object.keys(featureVector).length) || 0; }

    // @Privileged function (public w/ private variable access)
    // Note: This includes collisions of the same string being sent multiple timess.
    this.collisions = function() { return valueCount - Object.keys(featureVector).length; }

    // @Privileged function (public w/ private variable access)
    // Note: This includes collisions of the same string being sent multiple timess.
    this.collisionRatio = function() { return (valueCount / Object.keys(featureVector).length - 1) || 0; }

    // @Privileged function (public w/ private variable access)
    this.valueCount = function() { return valueCount; }
}
1257916
public static HashinatorSnapshotData serializeConfiguredHashinator()
            throws IOException
    {
        Pair<Long, ? extends TheHashinator> currentInstance = instance.get();
        byte[] cookedData = currentInstance.getSecond().getCookedBytes();
        return new HashinatorSnapshotData(cookedData, currentInstance.getFirst());
    }
1044757
def _to_hash(value)
      if value.is_a?(Array)
        value.compact.map{ |v| _to_hash(v) }
      elsif value.is_a?(Hash)
        {}.tap do |hash|
          value.each { |k, v| hash[k] = _to_hash(v) }
        end
      elsif value.respond_to? :to_hash
        value.to_hash
      else
        value
      end
    end
443566
def jsonhash(obj, root=True, exclude=None, hash_func=_jsonhash_sha1):
    '''
    
    '''
    if isinstance(obj, Mapping):
        # assumption: using in against set() is faster than in against list()
        if root and exclude:
            obj = {k: v for k, v in obj.iteritems() if k not in exclude}
        # frozenset's don't guarantee order; use sorted tuples
        # which means different python interpreters can return
        # back frozensets with different hash values even when
        # the content of the object is exactly the same
        result = sorted(
            (k, jsonhash(v, False)) for k, v in obj.iteritems())
    elif isinstance(obj, list):
        # FIXME: should lists be sorted for consistent hashes?
        # when the object is the same, just different list order?
        result = tuple(jsonhash(e, False) for e in obj)
    else:
        result = obj
    if root:
        result = unicode(hash_func(result))
    return result