Iterator that undoes the effect of filtering

        Yields each row in serialised format (as a sequence of bytes).
        Assumes input is straightlaced.  `raw` should be an iterable
        that yields the raw bytes in chunks of arbitrary size.
325948
def iterstraight(self, raw):
        
        # length of row, in bytes (with filter)
        rb_1 = self.row_bytes + 1
        a = bytearray()
        filt = Filter(self.bitdepth * self.planes)
        for some in raw:
            a.extend(some)
            offset = 0
            while len(a) >= rb_1 + offset:
                filter_type = a[offset]
                if filter_type not in (0, 1, 2, 3, 4):
                    raise FormatError('Invalid PNG Filter Type.'
                '  See http://www.w3.org/TR/2003/REC-PNG-20031110/#9Filters .')
                scanline = a[offset + 1:offset + rb_1]
                filt.undo_filter(filter_type, scanline)
                yield scanline
                offset += rb_1
            del a[:offset]

        if len(a) != 0:
            # :file:format We get here with a file format error:
            # when the available bytes (after decompressing) do not
            # pack into exact rows.
            raise FormatError(
              'Wrong size for decompressed IDAT chunk.')
        assert len(a) == 0
373708
def _deinterlace(self, raw):
        

        # Values per row (of the target image)
        vpr = self.width * self.planes

        # Values per image
        vpi = vpr * self.height
        # Interleaving writes to the output array randomly
        # (well, not quite), so the entire output array must be in memory.
        # Make a result array, and make it big enough.
        if self.bitdepth > 8:
            a = array('H', [0] * vpi)
        else:
            a = bytearray([0] * vpi)
        source_offset = 0

        for lines in adam7_generate(self.width, self.height):
            # The previous (reconstructed) scanline.
            # `None` at the beginning of a pass
            # to indicate that there is no previous line.
            recon = None
            for x, y, xstep in lines:
                # Pixels per row (reduced pass image)
                ppr = int(math.ceil((self.width - x) / float(xstep)))
                # Row size in bytes for this pass.
                row_size = int(math.ceil(self.psize * ppr))

                filter_type = raw[source_offset]
                source_offset += 1
                scanline = raw[source_offset: source_offset + row_size]
                source_offset += row_size
                recon = self.undo_filter(filter_type, scanline, recon)
                # Convert so that there is one element per pixel value
                flat = self._bytes_to_values(recon, width=ppr)
                if xstep == 1:
                    assert x == 0
                    offset = y * vpr
                    a[offset: offset + vpr] = flat
                else:
                    offset = y * vpr + x * self.planes
                    end_offset = (y + 1) * vpr
                    skip = self.planes * xstep
                    for i in range(self.planes):
                        a[offset + i: end_offset: skip] = \
                            flat[i:: self.planes]

        return a
844798
def get_raw(self):
        
        buff = bytearray()
        buff += self.get_obj()
        for i in self.list:
            buff += i.get_raw()
        return buff
251665
def iterate_over_file(self, fasta_path):
        
        with self._open(fasta_path) as f:
            for line in f:
                line = line.rstrip()

                if len(line) == 0:
                    continue

                # have to slice into a bytes object or else I get a single integer
                first_char = line[0:1]

                if first_char == b">":
                    id_and_seq = self._read_header(line)
                    if id_and_seq is not None:
                        yield id_and_seq

                elif first_char == b";":
                    # semicolon are comment characters
                    continue
                else:
                    self.current_lines.append(line)
        # the last sequence is still in the lines buffer after we're done with
        # the file so make sure to yield it
        id_and_seq = self._current_entry()
        if id_and_seq is not None:
            yield id_and_seq
87275
def flatten(sequence):
    
    for item in sequence:
        if hasattr(item, "__iter__") and not isinstance(item, str) and not isinstance(item, bytes):
            for i in item:
                yield i
        else:
            yield item
631292
def _enumerator(opener, entry_cls, format_code=None, filter_code=None):
    

    archive_res = _archive_read_new()

    try:
        r = _set_read_context(archive_res, format_code, filter_code)
        opener(archive_res)

        def it():
            while 1:
                with _archive_read_next_header(archive_res) as entry_res:
                    if entry_res is None:
                        break

                    e = entry_cls(archive_res, entry_res)
                    yield e
                    if e.is_consumed is False:
                        _archive_read_data_skip(archive_res)
        yield it()
    finally:
        _archive_read_free(archive_res)
1137297
private Iterator<RecordEntryRawMetadata> rawMetadataFromCql(final Iterator<Row> iter) {
        return Iterators.transform(iter, row -> new RecordEntryRawMetadata()
                .withTimestamp(TimeUUIDs.getTimeMillis(getChangeId(row)))
                .withSize(getValue(row).remaining()));
    }
1192090
async def _stream_raw_result(self, res):
        '''  '''
        async with res.context as response:
            response.raise_for_status()
            async for out in response.content.iter_chunked(1):
                yield out.decode()
1055191
def chunks(iterable, size):
    
    it = iter(iterable)
    item = list(islice(it, size))
    while item:
        yield item
        item = list(islice(it, size))
346050
def chunks(iterable, n):
    
    for i in range(0, len(iterable), n):
        yield iterable[i:i + n]
473741
def raw(self, n=1):
        
        size = self.__strct.size  # struct size
        dataset = list()          # list of raw data

        try:
            # For n times...
            for _ in range(n):
                data = self.__file.read(size)  # get raw data from file
                dataset.append(data)           # save raw data in the list
        finally:
            return dataset
1041745
def _rebuffer(self):
        
        # collect a stride worth of results(result lists) or exceptions
        results = []
        exceptions = []
        for i in xrange(self.stride):
            try:
                results.append(self.iterable.next())
                exceptions.append(False)
            except Exception, excp:
                results.append(excp)
                exceptions.append(True)
        # un-roll the result lists
        res_exc = []
        for rep in xrange(self.n):
            flat_results = []
            for i in xrange(self.stride):
                result_list, exception = results[i], exceptions[i]
                if not exception:
                    flat_results.append(result_list[rep])
                else:
                    flat_results.append(result_list)
            res_exc.append((flat_results, exceptions))
        # make an iterator (like repeat)
        self._repeat_buffer = iter(res_exc)
1140669
def from_bytes(self, raw):
        ''''''
        if len(raw) < 4:
            raise NotEnoughDataError("Not enough bytes ({}) to reconstruct a Null object".format(len(raw)))
        fields = struct.unpack('=I', raw[:4])
        self._af = fields[0]
        return raw[4:]
772601
def _usage_unallocated(raw):
    '''
    
    '''
    ret = {}
    for line in raw.split("\n")[1:]:
        keyset = re.sub(r"\s+", " ", line.strip()).split(" ")
        if len(keyset) == 2:
            ret[keyset[0]] = keyset[1]

    return ret
544133
def iter_rows(self):
        
        fileobj = self._fileobj
        cls_row = self.cls_row
        fields = self.fields

        for idx in range(self.prolog.records_count):
            data = fileobj.read(1)

            marker = struct.unpack('<1s', data)[0]
            is_deleted = marker == b'*'

            if is_deleted:
                continue

            row_values = []
            for field in fields:
                val = field.cast(fileobj.read(field.len))
                row_values.append(val)

            yield cls_row(*row_values)
1344910
def read_raw_data_from_fifo(self, fifo, filter_func=None, converter_func=None):
        '''
        '''
        return convert_data_array(self.dut[fifo].get_data(), filter_func=filter_func, converter_func=converter_func)
1266504
def batch_decode(self, iterator, *args, **kwargs):
        
        return [self.decode(encoded, *args, **kwargs) for encoded in iterator]