Generator reading .dbf row one by one.

        Yields named tuple Row object.

        :rtype: Row
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)
473532
def raw_row_generator(self):
        """"""
        from rowgenerators import get_generator

        self.doc.set_sys_path()  # Set sys path to package 'lib' dir in case of python function generator

        ru = self.resolved_url

        try:
            resource = ru.resource # For Metapack urls

            return resource.row_generator
        except AttributeError:
            pass

        ut = ru.get_resource().get_target()

        # Encoding is supposed to be preserved in the URL but isn't
        source_url = parse_app_url(self.url)

        # source_url will be None for Sql terms.

        ut.encoding = self.get_value('encoding') or (source_url.encoding if source_url else None)

        g = get_generator(ut,  resource=self,
                          doc=self._doc, working_dir=self._doc.doc_dir,
                          env=self.env)

        assert g, ut

        return g
59618
def get_db1():
    
    all_data = client.db_get(1)

    for i in range(400):                 # items in db
        row_size = 130                   # size of item
        index = i * row_size
        offset = index + row_size        # end of row in db
        util.print_row(all_data[index:offset])
736005
def rows(self):
        """"""


        for s_name, s in self.sections.items():

            # Yield the section header
            if s.name != 'Root':
                yield ['']  # Unecessary, but makes for nice formatting. Should actually be done just before write
                yield ['Section', s.value] + s.property_names

            # Yield all of the rows for terms in the section
            for row in s.rows:
                term, value = row

                term = term.replace('root.', '').title()

                try:
                    yield [term] + value
                except:
                    yield [term] + [value]
794728
def data_collector(iterable, def_buf_size=5242880):
    
    buf = b''
    for data in iterable:
        buf += data
        if len(buf) >= def_buf_size:
            output = buf[:def_buf_size]
            buf = buf[def_buf_size:]
            yield output
    if len(buf) > 0:
        yield buf
36030
def dict_factory(cursor, row):
    
    out = {}
    for i, col in enumerate(cursor.description):
        out[col[0]] = row[i]
    return out
1232836
def _produce_return(self, cursor):
        
        results = cursor.fetchall()

        # Format rows within a generator?
        if self._row_formatter is not None:
            return (self._row_formatter(r, cursor) for r in results)

        return results
883700
def get_db_row(db, start, size):
    
    type_ = snap7.snap7types.wordlen_to_ctypes[snap7.snap7types.S7WLByte]
    data = client.db_read(db, start, type_, size)
    # print_row(data[:60])
    return data
584938
def rows(self, offs):
        '''
        
        '''
        lkey = s_common.int64en(offs)
        for lkey, byts in self.slab.scanByRange(lkey, db=self.db):
            indx = s_common.int64un(lkey)
            yield indx, byts
988046
def _process_db_rows_iter(self, cursor):
        '''
        

        '''
        #Be aware of: http://packages.python.org/psycopg2/faq.html#problems-with-transactions-handling
        #The results will come back grouped by the raw relationship IDs, in order
        for relid, relgroup in groupby(cursor, itemgetter(0)):
            rel = None
            attrs = None
            #Each relgroup are the DB rows corresponding to a single relationship,
            #With redundant subject/predicate/object but the sequence of attributes
            for row in relgroup:
                (rawid, subj, pred, obj, a_name, a_val) = row
                #self._logger.debug('Row: {0}'.format(repr(row)))
                if not rel: rel = (subj, pred, obj)
                if a_name:
                    if not attrs:
                        attrs = {}
                        rel = (subj, pred, obj, attrs)
                    attrs[a_name] = a_val
            yield rel
        cursor.close()
        self._conn.rollback() #Finish with the transaction
        return
872086
def next(self, rows: List[Row]) -> List[Row]:
        
        if not rows:
            return []
        input_row_index = self._get_row_index(rows[0])
        if input_row_index < len(self.table_data) - 1 and input_row_index != -1:
            return [self.table_data[input_row_index + 1]]
        return []
101368
def namedb_row_factory( cursor, row ):
    
    d = {}
    for idx, col in enumerate( cursor.description ):
        if col[0] in ['revoked', 'locked', 'receive_whitelisted']:
            if row[idx] == 0:
                d[col[0]] = False
            elif row[idx] == 1:
                d[col[0]] = True
            elif row[idx] is None:
                d[col[0]] = None
            else:
                raise Exception("Invalid value for 'revoked': %s" % row[idx])

        elif col[0] in ['credit_value', 'debit_value', 'vesting_value', 'token_fee']:
            # convert back to int.
            # this is safe in Python, since Python ints don't overflow
            try:
                d[col[0]] = int(row[idx]) if row[idx] is not None else None
            except ValueError as ve:
                log.exception(ve)
                log.fatal("Caught exception while converting '{}' to an int".format(row[idx]))
                os.abort()

        else:
            d[col[0]] = row[idx]

    return d
21199
def fetchall(self):
        
        rows = []
        while True:
            row = yield self.fetchone()
            if row is None:
                break
            rows.append(row)
        raise gen.Return(rows)
942067
def _parse_row(self, i):
        
        row = self.data[i]
        for j in range(len(row)):
            self.data[i][j] = self._parse_value(self.data[i][j])
228829
def unpack_rows(self, parameters_metadata, connection):
        
        values = []
        for param in parameters_metadata:
            # Unpack OUT or INOUT parameters' values
            if param.iotype != parameter_direction.IN:
                values.append( by_type_code[param.datatype].from_resultset(self.payload) )
        yield tuple(values)
1327758
def each
      (1..ROWS).each do |r|
        (1..COLS).each do |c|
          yield(r, c, self[r, c])
        end
      end
    end
1068492
def items(self):
        """"""
        keycol = self._keycol
        for row in self.__iter__():
            yield (row[keycol], dict(row))