Returns the chunk following this chunk in the list of free chunks.
556160
def fwd_chunk(self):
        
        raise NotImplementedError("%s not implemented for %s" % (self.fwd_chunk.__func__.__name__,
                                                                 self.__class__.__name__))
532039
def chunks(seq, chunk_size):
    # type: (Sequence[T], int) -> Iterable[Sequence[T]]
    
    return (seq[i:i + chunk_size] for i in range(0, len(seq), chunk_size))
157657
def n_chunks(self):
        
        return self._data_source.n_chunks(self.chunksize, stride=self.stride, skip=self.skip)
527139
function (chunks) {
	var groupedChunks = [];
	var inCommentBlock = false;
	chunks.forEach(function (chunk) {
		var isComment = helpers.isComment(chunk);
		var isNewline = helpers.isNewline(chunk);
		if (isComment) {
			inCommentBlock = true;
		} else if (inCommentBlock && !isNewline) {
			inCommentBlock = false;
		}

		var previous = groupedChunks[groupedChunks.length - 1];
		var previousIsComment = helpers.isComment(previous);
		var previousIsArray = Array.isArray(previous);
		if (groupedChunks.length > 0 && inCommentBlock && (previousIsComment || previousIsArray)) {
			if (previousIsArray) {
				previous.push(chunk);
			} else if (previousIsComment) {
				groupedChunks[groupedChunks.length - 1] = [].concat(previous, chunk);
			}
		} else {
			groupedChunks.push(chunk);
		}
	});
	return groupedChunks;
}
361784
def chunked(iterator, chunksize):
    
    chunk = []
    for idx, item in enumerate(iterator, 1):
        chunk.append(item)
        if idx % chunksize == 0:
            yield chunk
            chunk = []
    if chunk:
        yield chunk
433752
def fwd_chunk(self):
        
        if self.is_free():
            base = self.state.memory.load(self.base + 2 * self._chunk_size_t_size, self._chunk_size_t_size)
            return PTChunk(base, self.state)
        else:
            raise SimHeapError("Attempted to access the forward chunk of an allocated chunk")
1151003
def _chunks(iterable, n):
    
    iterable = iter(iterable)
    while True:
        # store one line in memory,
        # chain it to an iterator on the rest of the chunk
        yield chain([next(iterable)], islice(iterable, n-1))
419810
def _GetChunkForWriting(self, chunk):
    """"""
    try:
      chunk = self.chunk_cache.Get(chunk)
      chunk.dirty = True
      return chunk
    except KeyError:
      pass

    try:
      chunk = self._ReadChunk(chunk)
      chunk.dirty = True
      return chunk
    except KeyError:
      pass

    fd = io.BytesIO()
    fd.chunk = chunk
    fd.dirty = True
    self.chunk_cache.Put(chunk, fd)

    # Keep track of the biggest chunk_number we've seen so far.
    if chunk > self.last_chunk:
      self.last_chunk = chunk
      self._dirty = True

    return fd
981459
def chunk_list(items, size):
    
    size = max(1, size)
    return [items[i:i + size] for i in range(0, len(items), size)]
240
def get_surrounding_blocks(self):
        

        next = self.next_blocks()
        prev = self.previous_blocks()

        surrounding_blocks = list(chain(prev, [self], next))
        return surrounding_blocks
836157
private long traverseAndCheck() {
    long sum = 0;

    sum += topSize + TOP_FOOT_SIZE;

    long q = 0;
    long lastq = 0;
    if (!previousInUse(q))
      throw new AssertionError("Chunk before zeroth chunk is marked as free");
    while (q != top) {
      sum += chunkSize(q);
      if (isInUse(q)) {
        if (findFreeChunk(q))
          throw new AssertionError("Chunk marked as in-use appears in a free structure");
        checkInUseChunk(q);
      } else {
        if (q != designatedVictim && !findFreeChunk(q))
          throw new AssertionError("Chunk marked as free cannot be found in any free structure");
        if (lastq != 0 && !isInUse(lastq))
          throw new AssertionError("Chunk before free chunk is not in-use");
        checkFreeChunk(q);
      }
      lastq = q;
      q = nextChunk(q);
    }
    return sum;
  }
678934
def _listChunks(self):
        
        chunks = []
        for fileName in os.listdir(self.dataDir):
            index = ChunkedFileStore._fileNameToChunkIndex(fileName)
            if index is not None:
                chunks.append(index)
        return sorted(chunks)
451178
def extract_chunks(blob):
    """"""
    chunks = []
    stream = BytesIO(blob.bytes)
    current_pos = stream.tell()
    stream.seek(0, 2)
    length = stream.tell()
    stream.seek(current_pos, 0)
    while stream.tell() < length:
        chunks.append(read_chunk(stream))

    return chunks
1084269
private void nextChunk() throws IOException {
        if (state == CHUNK_INVALID) {
            throw new MalformedChunkCodingException("Corrupt data stream");
        }
        try {
            chunkSize = getChunkSize();
            if (chunkSize < 0L) {
                throw new MalformedChunkCodingException("Negative chunk size");
            }
            state = CHUNK_DATA;
            pos = 0L;
            if (chunkSize == 0L) {
                eof = true;
                parseTrailerHeaders();
            }
        } catch (MalformedChunkCodingException ex) {
            state = CHUNK_INVALID;
            throw ex;
        }
    }
200522
public String next() {
        if (done) return null;

        // construct return value

        buffer.setLength(0); // delete old contents
        for (int i = 0; i < pieces.length; ++i) {
            buffer.append(pieces[i][current[i]]);
        }
        String result = buffer.toString();

        // find next value for next time

        for (int i = current.length - 1; ; --i) {
            if (i < 0) {
                done = true;
                break;
            }
            current[i]++;
            if (current[i] < pieces[i].length) break; // got sequence
            current[i] = 0;
        }
        return result;
    }
150287
def ChunkBy(self: dict, f=None):
    
    if f is None:
        return _chunk(self.items())
    if is_to_destruct(f):
        f = destruct_func(f)
    return _chunk(self.items(), f)
1140072
def order_chunks(self, chunks):
        '''
        
        '''
        cap = 1
        for chunk in chunks:
            if 'order' in chunk:
                if not isinstance(chunk['order'], int):
                    continue

                chunk_order = chunk['order']
                if chunk_order > cap - 1 and chunk_order > 0:
                    cap = chunk_order + 100
        for chunk in chunks:
            if 'order' not in chunk:
                chunk['order'] = cap
                continue

            if not isinstance(chunk['order'], (int, float)):
                if chunk['order'] == 'last':
                    chunk['order'] = cap + 1000000
                elif chunk['order'] == 'first':
                    chunk['order'] = 0
                else:
                    chunk['order'] = cap
            if 'name_order' in chunk:
                chunk['order'] = chunk['order'] + chunk.pop('name_order') / 10000.0
            if chunk['order'] < 0:
                chunk['order'] = cap + 1000000 + chunk['order']
        chunks.sort(key=lambda chunk: (chunk['order'], '{0[state]}{0[name]}{0[fun]}'.format(chunk)))
        return chunks