Return an array of hashed that contains some information about the classes that consume more than `max_size` bytess
503515
def big_classes(max_size=1.megabytes)
      return @big_classes if @big_classes
      @big_classes = {}
      ObjectInformation.where(:group_instance_id => self.id, :memsize.gt => max_size).all.each do |object|
        @big_classes[object.class_name] ||= {total_mem: 0, average: 0, count: 0}
        @big_classes[object.class_name][:total_mem] += object.memsize
        @big_classes[object.class_name][:count] += 1
      end
      @big_classes.each_pair do |klass, hash|
        @big_classes[klass][:average] = @big_classes[klass][:total_mem] / @big_classes[klass][:count]
      end
      @big_classes
    end
206753
def get_hash(fName, readSize, dire=pDir()):
    
    if not fileExists(fName, dire):
        return -1
    readSize = readSize * 1024 # bytes to be read
    fName = os.path.join(dire, fName) # name coupled with path
    with open(fName, 'rb') as f:
        size = os.path.getsize(fName)
        if size < readSize * 2:
            return -1
        data = f.read(readSize)
        f.seek(-readSize, os.SEEK_END)
        data += f.read(readSize)
    return md5(data).hexdigest()
95408
def get_ops_hashes(cls, impl, working_dir, start_block_height=None, end_block_height=None):
        
        if (start_block_height is None and end_block_height is not None) or (start_block_height is not None and end_block_height is None):
            raise ValueError("Need either both or neither start/end block height")

        con = cls.db_open(impl, working_dir)
        range_query = ' WHERE ops_hash IS NOT NULL'
        range_args = ()

        if start_block_height and end_block_height:
            range_query += ' AND block_id >= ? AND block_id < ?'
            range_args += (start_block_height,end_block_height)

        query = 'SELECT block_id,ops_hash FROM snapshots' + range_query + ';'
        args = range_args

        rows = cls.db_query_execute(con, query, range_args, verbose=False)
        ret = {}
        block_min = None
        block_max = None

        for r in rows:
            ret[r['block_id']] = r['ops_hash']

            if block_min is None or block_min > r['block_id']:
                block_min = r['block_id']

            if block_max is None or block_max < r['block_id']:
                block_max = r['block_id']

        con.close()
        
        # sanity check
        if block_min is not None and block_max is not None:
            for i in range(block_min,block_max+1):
                oh = ret.get(i, None)

                assert oh is not None, 'Missing ops hash for {}'.format(i)
                assert isinstance(ret[i], (str,unicode)), 'ops hash for {} is type {}'.format(i, type(ret[i]))

        return ret
1157744
def to_hash
      serialized_attributes = attributes.dup

      self.class.expandable_attributes.each_pair.select do |attribute_name, expanded_class|
        if expanded_class === attributes[attribute_name]
          serialized_attributes[attribute_name] = serialized_attributes[attribute_name].id
        end
      end

      serialized_attributes
    end
1138084
def object_list(generation)

      rvalue_size = GC::INTERNAL_CONSTANTS[:RVALUE_SIZE]
      helper = Helpers.new

      result = StatHash.new.compare_by_identity

      ObjectSpace.each_object do |obj|
        next unless ObjectSpace.allocation_generation(obj) == generation

        file = ObjectSpace.allocation_sourcefile(obj) || "(no name)"
        next if @ignore_files && @ignore_files =~ file
        next if @allow_files && !(@allow_files =~ file)

        klass = obj.class rescue nil
        unless Class === klass
          # attempt to determine the true Class when .class returns something other than a Class
          klass = Kernel.instance_method(:class).bind(obj).call
        end
        next if @trace && !trace.include?(klass)

        begin
          line       = ObjectSpace.allocation_sourceline(obj)
          location   = helper.lookup_location(file, line)
          class_name = helper.lookup_class_name(klass)
          gem        = helper.guess_gem(file)

          # we do memsize first to avoid freezing as a side effect and shifting
          # storage to the new frozen string, this happens on @hash[s] in lookup_string
          memsize = ObjectSpace.memsize_of(obj)
          string     = klass == String ? helper.lookup_string(obj) : nil

          # compensate for API bug
          memsize = rvalue_size if memsize > 100_000_000_000
          result[obj.__id__] = MemoryProfiler::Stat.new(class_name, gem, file, location, memsize, string)
        rescue
          # give up if any any error occurs inspecting the object
        end
      end

      result
    end
509148
def _get_hashed_params(self, page_text):
        """"""
        soup = BeautifulSoup(page_text, 'html.parser')
        return [tag['name'] for tag in soup.find_all('input', class_='sl')]
931419
def previous_hashes(self) -> Optional[Iterable[Hash32]]:
        
        return self.get_prev_hashes(self.header.parent_hash, self.chaindb)
819838
def Analyze(self, hashes):
    
    hash_analyses = []
    for digest in hashes:
      json_response = self._QueryHash(digest)
      hash_analysis = interface.HashAnalysis(digest, json_response)
      hash_analyses.append(hash_analysis)

    return hash_analyses
1106607
def get_raw(self):
        
        return [self.name, self.size, self.last_modified, self.location]
940938
public static int[] getHashBuckets(String key, int hashCount, int max, boolean applyWidth) {
        byte[] b;
        b = key.getBytes(StandardCharsets.UTF_8);
        return getHashBuckets(b, hashCount, max, applyWidth);
    }
136218
def keys(cls, name, hash_key, range_key=None, throughput=None):
        
        return cls(cls.KEYS, name, hash_key, range_key,
                   throughput=throughput)
761323
def array(self, size_chunk, start, bytesize):
        ''' 
        '''

        with open(self.img, 'rb') as f1:
            f1.seek(self.start_byte + start * self.bytesize)
            data = f1.read(size_chunk * self.bytesize)
            Z = np.fromstring(data, dtype=self.dtype, count=size_chunk)
            if self.grid == 'LOLA':
                return Z * float(self.SCALING_FACTOR)
            else:
                return Z
977017
def lru_cache(maxsize=128, typed=False):
    
    if maxsize is None:
        return _cache(_UnboundCache(), typed)
    else:
        return _cache(LRUCache(maxsize), typed)
1204284
def hash_data(obj):
    """"""
    collect = sha1()
    for text in bytes_iter(obj):
        if isinstance(text, six.text_type):
            text = text.encode('utf-8')
        collect.update(text)
    return collect.hexdigest()
919403
private long[] indexes(ByteBuffer key)
    {
        // we use the same array both for storing the hash result, and for storing the indexes we return,
        // so that we do not need to allocate two arrays.
        long[] indexes = reusableIndexes.get();
        hash(key, key.position(), key.remaining(), 0L, indexes);
        setIndexes(indexes[0], indexes[1], hashCount, bitset.capacity(), indexes);
        return indexes;
    }
200724
def long_hash(*buffers):
    
    hashed = hashlib.sha256()
    for buffer in buffers:
        hashed.update(buffer)
    return to_ascii(hashed.digest())[0:43]
899144
def with_sizes(self, *headers):
        ''''''
        if len(headers) != 5:
            raise ValueError('You need to provide this headers: class, method, times, total, average')

        summary = self.summary()

        for row in summary.values():
            sizes = [len(header) for header in headers]
            # Benchmark/Class column
            sizes[0] = max(sizes[0], len(row['name']))
            # Method column
            max_length = max(len(r['name']) for r in row['runs'].values())
            sizes[1] = max(sizes[1], max_length)
            # Times column
            sizes[2] = max(sizes[2], len(str(row['times'])))
            # Float columns
            for idx, field in [(3, 'total'), (4, 'mean')]:
                float_len = lambda r: len(self.float(r[field]))
                max_length = max(float_len(r) for r in row['runs'].values())
                sizes[idx] = max(sizes[idx], max_length)
            row['sizes'] = sizes

        return summary