(self)
Reads a dbf header. Xbase-related code borrows heavily from ActiveState Python Cookbook Recipe 362715 by Raymond Hettinger
Reads a dbf header. Xbase-related code borrows heavily from ActiveState Python Cookbook Recipe 362715 by Raymond Hettinger
Reads a dbf header . Xbase - related code borrows heavily from ActiveState Python Cookbook Recipe 362715 by Raymond Hettinger
def __dbfHeader(self):
		"""Reads a dbf header. Xbase-related code borrows heavily from ActiveState Python Cookbook Recipe 362715 by Raymond Hettinger"""
		f = self.__getFileObj(self.dbf)
		headerLength = self.__dbfHeaderLength()
		numFields = (headerLength - 33) // 32
		for field in range(numFields):
			fieldDesc = list(unpack("<11sc4xBB14x", f.read(32)))
			name = 0
			fieldDesc[name] = fieldDesc[name][:fieldDesc[name].index("\x00")]
			fieldDesc[name] = fieldDesc[name].lstrip()
			self.fields.append(fieldDesc)
		terminator = f.read(1)
		assert terminator == "\r"
		self.fields.insert(0, ('DeletionFlag', 'C', 1, 0))
def __dbfHeader ( self ) : f = self . __getFileObj ( self . dbf ) headerLength = self . __dbfHeaderLength ( ) numFields = ( headerLength - 33 ) // 32 for field in range ( numFields ) : fieldDesc = list ( unpack ( "<11sc4xBB14x" , f . read ( 32 ) ) ) name = 0 fieldDesc [ name ] = fieldDesc [ name ] [ : fieldDesc [ name ] . index ( "\x00" ) ] fieldDesc [ name ] = fieldDesc [ name ] . lstrip ( ) self . fields . append ( fieldDesc ) terminator = f . read ( 1 ) assert terminator == "\r" self . fields . insert ( 0 , ( 'DeletionFlag' , 'C' , 1 , 0 ) )