Return a list of all chunks. Use this function if you access the chunk
        list frequently and want to cache the result.
        Use iter_chunks() if you only want to loop through the chunks once or have a
        very large world.
517558
def get_chunks(self, boundingbox=None):
        
        if self.chunks == None:
            self.chunks = list(self.iter_chunks())
        return self.chunks
1290368
def read_chunks(self):
        """"""

        if self.reading_chunks and self.got_chunk:
            # we got on the fast-path and directly read from the buffer.
            # if we continue to recurse, this is going to blow up the stack.
            # so instead return
            #
            # NOTE: This actually is unnecessary as long as tornado guarantees that
            #       ioloop.add_callback always gets dispatched via the main io loop
            #       and they don't introduce a fast-path similar to read_XY
            logger.debug("Fast-Path detected, returning...")
            return

        while not self.got_request:
            self.reading_chunks = True
            self.got_chunk = False
            # chunk starts with length, so read it. This will then subsequently also read the chunk
            self.httpstream.read_until("\r\n", self._chunk_length)
            self.reading_chunks = False

            if self.got_chunk:
                # the previous read hit the fast path and read from the buffer
                # instead of going through the main polling loop. This means we 
                # should iteratively issue the next request
                logger.debug("Fast-Path detected, iterating...")
                continue
            else:
                break

        # if we arrive here, we read the complete request or
        # the ioloop has scheduled another call to read_chunks
        return
1015754
def generate_chunks(data, chunk_size=DEFAULT_CHUNK_SIZE):
    """"""
    iterator = iter(repeated.getvalues(data))

    while True:
        chunk = list(itertools.islice(iterator, chunk_size))
        if not chunk:
            return

        yield chunk
675678
def iter_lines(self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=None, delimiter=None):
        

        pending = None

        for chunk in self.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode):

            if pending is not None:
                chunk = pending + chunk

            if delimiter:
                lines = chunk.split(delimiter)
            else:
                lines = chunk.splitlines()

            if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]:
                pending = lines.pop()
            else:
                pending = None

            for line in lines:
                yield line

        if pending is not None:
            yield pending
157657
def n_chunks(self):
        
        return self._data_source.n_chunks(self.chunksize, stride=self.stride, skip=self.skip)
1060760
def iter_chunks(l, size):
    
    if isinstance(l, six.integer_types):
        l = six.moves.range(l)

    if is_lazy_iterable(l):
        if size < 1:
            yield list(l)
        else:
            chunk = []
            for elem in l:
                if len(chunk) < size:
                    chunk.append(elem)
                else:
                    yield chunk
                    chunk = [elem]
            else:
                if chunk:
                    yield chunk

    else:
        if size < 1:
            yield l
        else:
            for i in six.moves.range(0, len(l), size):
                yield l[i:i + size]
757764
def _chunks(self, l, n):
        
        l.sort()
        newn = int(1.0 * len(l) / n + 0.5)
        for i in range(0, n-1):
            yield l[i*newn:i*newn+newn]
        yield l[n*newn-newn:]
1112883
def chunks(some_list: List, n: int) -> Iterable[List]:
    """"""
    for i in range(0, len(some_list), n):
        yield some_list[i:i + n]
693211
def _as_chunk(self):
        

        if self._chunks_offset == 0:
            return self.contents
        return self.contents[self._chunks_offset:]
1064921
def load_iter(self, key, chunksize=None, noexpire=None):
        ''''''
        return chunk_iterator(self.load_fd(key, noexpire=noexpire),
                              chunksize=chunksize)
808840
def iter_chunks(self):
        
        for chunk_type, offset in self._iter_chunk_offsets():
            chunk = _ChunkFactory(chunk_type, self._stream_rdr, offset)
            yield chunk
532607
def get_all(self):
        
        self._lock.acquire()
        try:
            return list(self._cache.values())
        finally:
            self._lock.release()
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
97714
def _chunk_iter(self):
        """"""
        for chunk_offset in self._chunk_offsets():
            yield self._download_chunk(chunk_offset=chunk_offset,
                                       chunk_size=self._chunk_size)
84016
def get_all_chains(self):
        
        return [self.get_chain(i) for i in range(len(self.leaves))]
195458
def next_chunk(self):
        
        if self._unconsumed:
            data = self._unconsumed.pop()
        else:
            data = self._iterator.next()  # Might raise StopIteration
        self._pos += len(data)
        return data
487407
def all(self):
        

        if self._stream:
            return chain.from_iterable(self._get_streamed_response())

        return self._get_buffered_response()[0]