def parse_headerline(self, line):
        """ Parses header lines

            Header example:
            Batch Info,2013-03-20T07:11:09.9053262-07:00,2013-03-20T07:12:55.5280967-07:00,2013-03-20T07:11:07.1047817-07:00,,,,,,,,,,,,,,
            Batch Data Path,D:\MassHunter\Data\130129\QuantResults\130129LS.batch.bin,,,,,,,,,,,,,,,,
            Analysis Time,3/20/2013 7:11 AM,Analyst Name,Administrator,,,,,,,,,,,,,,
            Report Time,3/20/2013 7:12 AM,Reporter Name,Administrator,,,,,,,,,,,,,,
            Last Calib Update,3/20/2013 7:11 AM,Batch State,Processed,,,,,,,,,,,,,,
            ,,,,,,,,,,,,,,,,,
        """
        if self._end_header == True:
            # Header already processed
            return 0

        if line.startswith(self.SEQUENCETABLE_KEY):
            self._end_header = True
            if len(self._header) == 0:
                self.err("No header found", numline=self._numline)
                return -1
            return 0

        splitted = [token.strip() for token in line.split(',')]

        # Batch Info,2013-03-20T07:11:09.9053262-07:00,2013-03-20T07:12:55.5280967-07:00,2013-03-20T07:11:07.1047817-07:00,,,,,,,,,,,,,,
        if splitted[0] == self.HEADERKEY_BATCHINFO:
            if self.HEADERKEY_BATCHINFO in self._header:
                self.warn("Header Batch Info already found. Discarding",
                          numline=self._numline, line=line)
                return 0

            self._header[self.HEADERKEY_BATCHINFO] = []
            for i in range(len(splitted) - 1):
                if splitted[i + 1]:
                    self._header[self.HEADERKEY_BATCHINFO].append(splitted[i + 1])

        # Batch Data Path,D:\MassHunter\Data\130129\QuantResults\130129LS.batch.bin,,,,,,,,,,,,,,,,
        elif splitted[0] == self.HEADERKEY_BATCHDATAPATH:
            if self.HEADERKEY_BATCHDATAPATH in self._header:
                self.warn("Header Batch Data Path already found. Discarding",
                          numline=self._numline, line=line)
                return 0;

            if splitted[1]:
                self._header[self.HEADERKEY_BATCHDATAPATH] = splitted[1]
            else:
                self.warn("Batch Data Path not found or empty",
                          numline=self._numline, line=line)

        # Analysis Time,3/20/2013 7:11 AM,Analyst Name,Administrator,,,,,,,,,,,,,,
        elif splitted[0] == self.HEADERKEY_ANALYSISTIME:
            if splitted[1]:
                try:
                    d = datetime.strptime(splitted[1], "%m/%d/%Y %I:%M %p")
                    self._header[self.HEADERKEY_ANALYSISTIME] = d
                except ValueError:
                    self.err("Invalid Analysis Time format",
                             numline=self._numline, line=line)
            else:
                self.warn("Analysis Time not found or empty",
                          numline=self._numline, line=line)

            if splitted[2] and splitted[2] == self.HEADERKEY_ANALYSTNAME:
                if splitted[3]:
                    self._header[self.HEADERKEY_ANALYSTNAME] = splitted[3]
                else:
                    self.warn("Analyst Name not found or empty",
                              numline=self._numline, line=line)
            else:
                self.err("Analyst Name not found",
                         numline=self._numline, line=line)

        # Report Time,3/20/2013 7:12 AM,Reporter Name,Administrator,,,,,,,,,,,,,,
        elif splitted[0] == self.HEADERKEY_REPORTTIME:
            if splitted[1]:
                try:
                    d = datetime.strptime(splitted[1], "%m/%d/%Y %I:%M %p")
                    self._header[self.HEADERKEY_REPORTTIME] = d
                except ValueError:
                    self.err("Invalid Report Time format",
                         numline=self._numline, line=line)
            else:
                self.warn("Report time not found or empty",
                          numline=self._numline, line=line)


            if splitted[2] and splitted[2] == self.HEADERKEY_REPORTERNAME:
                if splitted[3]:
                    self._header[self.HEADERKEY_REPORTERNAME] = splitted[3]
                else:
                    self.warn("Reporter Name not found or empty",
                              numline=self._numline, line=line)

            else:
                self.err("Reporter Name not found",
                         numline=self._numline, line=line)


        # Last Calib Update,3/20/2013 7:11 AM,Batch State,Processed,,,,,,,,,,,,,,
        elif splitted[0] == self.HEADERKEY_LASTCALIBRATION:
            if splitted[1]:
                try:
                    d = datetime.strptime(splitted[1], "%m/%d/%Y %I:%M %p")
                    self._header[self.HEADERKEY_LASTCALIBRATION] = d
                except ValueError:
                    self.err("Invalid Last Calibration time format",
                             numline=self._numline, line=line)

            else:
                self.warn("Last Calibration time not found or empty",
                          numline=self._numline, line=line)


            if splitted[2] and splitted[2] == self.HEADERKEY_BATCHSTATE:
                if splitted[3]:
                    self._header[self.HEADERKEY_BATCHSTATE] = splitted[3]
                else:
                    self.warn("Batch state not found or empty",
                              numline=self._numline, line=line)

            else:
                self.err("Batch state not found",
                         numline=self._numline, line=line)


        return 0
def parse_headerline ( self , line ) : if self . _end_header == True : return 0 if line . startswith ( self . SEQUENCETABLE_KEY ) : self . _end_header = True if len ( self . _header ) == 0 : self . err ( "No header found" , numline = self . _numline ) return - 1 return 0 splitted = [ token . strip ( ) for token in line . split ( ',' ) ] if splitted [ 0 ] == self . HEADERKEY_BATCHINFO : if self . HEADERKEY_BATCHINFO in self . _header : self . warn ( "Header Batch Info already found. Discarding" , numline = self . _numline , line = line ) return 0 self . _header [ self . HEADERKEY_BATCHINFO ] = [ ] for i in range ( len ( splitted ) - 1 ) : if splitted [ i + 1 ] : self . _header [ self . HEADERKEY_BATCHINFO ] . append ( splitted [ i + 1 ] ) elif splitted [ 0 ] == self . HEADERKEY_BATCHDATAPATH : if self . HEADERKEY_BATCHDATAPATH in self . _header : self . warn ( "Header Batch Data Path already found. Discarding" , numline = self . _numline , line = line ) return 0 ; if splitted [ 1 ] : self . _header [ self . HEADERKEY_BATCHDATAPATH ] = splitted [ 1 ] else : self . warn ( "Batch Data Path not found or empty" , numline = self . _numline , line = line ) elif splitted [ 0 ] == self . HEADERKEY_ANALYSISTIME : if splitted [ 1 ] : try : d = datetime . strptime ( splitted [ 1 ] , "%m/%d/%Y %I:%M %p" ) self . _header [ self . HEADERKEY_ANALYSISTIME ] = d except ValueError : self . err ( "Invalid Analysis Time format" , numline = self . _numline , line = line ) else : self . warn ( "Analysis Time not found or empty" , numline = self . _numline , line = line ) if splitted [ 2 ] and splitted [ 2 ] == self . HEADERKEY_ANALYSTNAME : if splitted [ 3 ] : self . _header [ self . HEADERKEY_ANALYSTNAME ] = splitted [ 3 ] else : self . warn ( "Analyst Name not found or empty" , numline = self . _numline , line = line ) else : self . err ( "Analyst Name not found" , numline = self . _numline , line = line ) elif splitted [ 0 ] == self . HEADERKEY_REPORTTIME : if splitted [ 1 ] : try : d = datetime . strptime ( splitted [ 1 ] , "%m/%d/%Y %I:%M %p" ) self . _header [ self . HEADERKEY_REPORTTIME ] = d except ValueError : self . err ( "Invalid Report Time format" , numline = self . _numline , line = line ) else : self . warn ( "Report time not found or empty" , numline = self . _numline , line = line ) if splitted [ 2 ] and splitted [ 2 ] == self . HEADERKEY_REPORTERNAME : if splitted [ 3 ] : self . _header [ self . HEADERKEY_REPORTERNAME ] = splitted [ 3 ] else : self . warn ( "Reporter Name not found or empty" , numline = self . _numline , line = line ) else : self . err ( "Reporter Name not found" , numline = self . _numline , line = line ) elif splitted [ 0 ] == self . HEADERKEY_LASTCALIBRATION : if splitted [ 1 ] : try : d = datetime . strptime ( splitted [ 1 ] , "%m/%d/%Y %I:%M %p" ) self . _header [ self . HEADERKEY_LASTCALIBRATION ] = d except ValueError : self . err ( "Invalid Last Calibration time format" , numline = self . _numline , line = line ) else : self . warn ( "Last Calibration time not found or empty" , numline = self . _numline , line = line ) if splitted [ 2 ] and splitted [ 2 ] == self . HEADERKEY_BATCHSTATE : if splitted [ 3 ] : self . _header [ self . HEADERKEY_BATCHSTATE ] = splitted [ 3 ] else : self . warn ( "Batch state not found or empty" , numline = self . _numline , line = line ) else : self . err ( "Batch state not found" , numline = self . _numline , line = line ) return 0
Parses header lines

            Header example:
            Batch Info,2013-03-20T07:11:09.9053262-07:00,2013-03-20T07:12:55.5280967-07:00,2013-03-20T07:11:07.1047817-07:00,,,,,,,,,,,,,,
            Batch Data Path,D:\MassHunter\Data\130129\QuantResults\130129LS.batch.bin,,,,,,,,,,,,,,,,
            Analysis Time,3/20/2013 7:11 AM,Analyst Name,Administrator,,,,,,,,,,,,,,
            Report Time,3/20/2013 7:12 AM,Reporter Name,Administrator,,,,,,,,,,,,,,
            Last Calib Update,3/20/2013 7:11 AM,Batch State,Processed,,,,,,,,,,,,,,
            ,,,,,,,,,,,,,,,,,