original_docstring: Reads and returns a dbf record row as a list of values.
docstring: Reads and returns a dbf record row as a list of values.
docstring_tokens: Reads and returns a dbf record row as a list of values .
code: def __record(self, oid=None):
          """Reads and returns a dbf record row as a list of values."""
          f = self.__getFileObj(self.dbf)
          recordContents = self.__recStruct.unpack(f.read(self.__recStruct.size))
          if recordContents[0] != b' ':
              # deleted record
              return None
          record = []
          for (name, typ, size, deci), value in zip(self.fields, recordContents):
              if name == 'DeletionFlag':
                  continue
              elif typ in ("N","F"):
                  # numeric or float: number stored as a string, right justified, and padded with blanks to the width of the field. 
                  value = value.split(b'\0')[0]
                  value = value.replace(b'*', b'')  # QGIS NULL is all '*' chars
                  if value == b'':
                      value = None
                  elif deci:
                      try:
                          value = float(value)
                      except ValueError:
                          #not parseable as float, set to None
                          value = None
                  else:
                      # force to int
                      try:
                          # first try to force directly to int.
                          # forcing a large int to float and back to int
                          # will lose information and result in wrong nr.
                          value = int(value) 
                      except ValueError:
                          # forcing directly to int failed, so was probably a float.
                          try:
                              value = int(float(value))
                          except ValueError:
                              #not parseable as int, set to None
                              value = None
              elif typ == 'D':
                  # date: 8 bytes - date stored as a string in the format YYYYMMDD.
                  if not value.replace(b'\x00', b'').replace(b' ', b'').replace(b'0', b''):
                      # dbf date field has no official null value
                      # but can check for all hex null-chars, all spaces, or all 0s (QGIS null)
                      value = None
                  else:
                      try:
                          # return as python date object
                          y, m, d = int(value[:4]), int(value[4:6]), int(value[6:8])
                          value = date(y, m, d)
                      except:
                          # if invalid date, just return as unicode string so user can decide
                          value = u(value.strip())
              elif typ == 'L':
                  # logical: 1 byte - initialized to 0x20 (space) otherwise T or F.
                  if value == b" ":
                      value = None # space means missing or not yet set
                  else:
                      if value in b'YyTt1':
                          value = True
                      elif value in b'NnFf0':
                          value = False
                      else:
                          value = None # unknown value is set to missing
              else:
                  # anything else is forced to string/unicode
                  value = u(value, self.encoding, self.encodingErrors)
                  value = value.strip()
              record.append(value)
  
          return _Record(self.__fieldposition_lookup, record, oid)
code_tokens: def __record ( self , oid = None ) : f = self . __getFileObj ( self . dbf ) recordContents = self . __recStruct . unpack ( f . read ( self . __recStruct . size ) ) if recordContents [ 0 ] != b' ' : return None record = [ ] for ( name , typ , size , deci ) , value in zip ( self . fields , recordContents ) : if name == 'DeletionFlag' : continue elif typ in ( "N" , "F" ) : value = value . split ( b'\0' ) [ 0 ] value = value . replace ( b'*' , b'' ) if value == b'' : value = None elif deci : try : value = float ( value ) except ValueError : value = None else : try : value = int ( value ) except ValueError : try : value = int ( float ( value ) ) except ValueError : value = None elif typ == 'D' : if not value . replace ( b'\x00' , b'' ) . replace ( b' ' , b'' ) . replace ( b'0' , b'' ) : value = None else : try : y , m , d = int ( value [ : 4 ] ) , int ( value [ 4 : 6 ] ) , int ( value [ 6 : 8 ] ) value = date ( y , m , d ) except : value = u ( value . strip ( ) ) elif typ == 'L' : if value == b" " : value = None else : if value in b'YyTt1' : value = True elif value in b'NnFf0' : value = False else : value = None else : value = u ( value , self . encoding , self . encodingErrors ) value = value . strip ( ) record . append ( value ) return _Record ( self . __fieldposition_lookup , record , oid )
short_docstring: Reads and returns a dbf record row as a list of values.
short_docstring_tokens: Reads and returns a dbf record row as a list of values .
comment: """Reads and returns a dbf record row as a list of values."""$SEP$# deleted record
  $SEP$# numeric or float: number stored as a string, right justified, and padded with blanks to the width of the field. 
  $SEP$# QGIS NULL is all '*' chars
  $SEP$#not parseable as float, set to None
  $SEP$# force to int
  $SEP$# first try to force directly to int.
  $SEP$# forcing a large int to float and back to int
  $SEP$# will lose information and result in wrong nr.
  $SEP$# forcing directly to int failed, so was probably a float.
  $SEP$#not parseable as int, set to None
  $SEP$# date: 8 bytes - date stored as a string in the format YYYYMMDD.
  $SEP$# dbf date field has no official null value
  $SEP$# but can check for all hex null-chars, all spaces, or all 0s (QGIS null)
  $SEP$# return as python date object
  $SEP$# if invalid date, just return as unicode string so user can decide
  $SEP$# logical: 1 byte - initialized to 0x20 (space) otherwise T or F.
  $SEP$# space means missing or not yet set
  $SEP$# unknown value is set to missing
  $SEP$# anything else is forced to string/unicode
  