original_docstring: Actually parse the config file.
docstring: Actually parse the config file.
docstring_tokens: Actually parse the config file .
code: def _parse(self, infile):
          """Actually parse the config file."""
          temp_list_values = self.list_values
          if self.unrepr:
              self.list_values = False
          comment_list = []
          done_start = False
          this_section = self
          maxline = len(infile) - 1
          cur_index = -1
          reset_comment = False
          while cur_index < maxline:
              if reset_comment:
                  comment_list = []
              else:
                  cur_index += 1
                  line = infile[cur_index]
                  sline = line.strip()
              if not sline or sline.startswith('#'):
                  reset_comment = False
                  comment_list.append(line)
                  continue
              else:
                  if not done_start:
                      self.initial_comment = comment_list
                      comment_list = []
                      done_start = True
                  reset_comment = True
                  mat = self._sectionmarker.match(line)
              if mat is not None:
                  indent, sect_open, sect_name, sect_close, comment = mat.groups()
                  if indent:
                      if self.indent_type is None:
                          self.indent_type = indent
                  cur_depth = sect_open.count('[')
                  if cur_depth != sect_close.count(']'):
                      self._handle_error('Cannot compute the section depth', NestingError, infile, cur_index)
                      continue
                  if cur_depth < this_section.depth:
                      try:
                          parent = self._match_depth(this_section, cur_depth).parent
                      except SyntaxError:
                          self._handle_error('Cannot compute nesting level', NestingError, infile, cur_index)
                          continue
  
                  else:
                      if cur_depth == this_section.depth:
                          parent = this_section.parent
                      else:
                          if cur_depth == this_section.depth + 1:
                              parent = this_section
                          else:
                              self._handle_error('Section too nested', NestingError, infile, cur_index)
                              continue
                  sect_name = self._unquote(sect_name)
                  if sect_name in parent:
                      self._handle_error('Duplicate section name', DuplicateError, infile, cur_index)
                      continue
                  else:
                      this_section = Section(parent,
                        cur_depth,
                        self,
                        name=sect_name)
                      parent[sect_name] = this_section
                      parent.inline_comments[sect_name] = comment
                      parent.comments[sect_name] = comment_list
                  continue
              else:
                  mat = self._keyword.match(line)
              if mat is None:
                  self._handle_error('Invalid line ({0!r}) (matched as neither section nor keyword)'.format(line), ParseError, infile, cur_index)
              else:
                  indent, key, value = mat.groups()
                  if indent:
                      if self.indent_type is None:
                          self.indent_type = indent
                  if value[:3] in ('"""', "'''"):
                      try:
                          value, comment, cur_index = self._multiline(value, infile, cur_index, maxline)
                      except SyntaxError:
                          self._handle_error('Parse error in multiline value', ParseError, infile, cur_index)
                          continue
                      else:
                          if self.unrepr:
                              comment = ''
                              try:
                                  value = unrepr(value)
                              except Exception as e:
                                  try:
                                      if type(e) == UnknownType:
                                          msg = 'Unknown name or type in value'
                                      else:
                                          msg = 'Parse error from unrepr-ing multiline value'
                                      self._handle_error(msg, UnreprError, infile, cur_index)
                                      continue
                                  finally:
                                      e = None
                                      del e
  
                      if self.unrepr:
                          comment = ''
                          try:
                              value = unrepr(value)
                          except Exception as e:
                              try:
                                  if isinstance(e, UnknownType):
                                      msg = 'Unknown name or type in value'
                                  else:
                                      msg = 'Parse error from unrepr-ing value'
                                  self._handle_error(msg, UnreprError, infile, cur_index)
                                  continue
                              finally:
                                  e = None
                                  del e
  
                      else:
                          try:
                              value, comment = self._handle_value(value)
                          except SyntaxError:
                              self._handle_error('Parse error in value', ParseError, infile, cur_index)
                              continue
  
                          key = self._unquote(key)
                          if key in this_section:
                              self._handle_error('Duplicate keyword name', DuplicateError, infile, cur_index)
                              continue
                          else:
                              this_section.__setitem__(key, value, unrepr=True)
                              this_section.inline_comments[key] = comment
                              this_section.comments[key] = comment_list
                          continue
  
          if self.indent_type is None:
              self.indent_type = ''
          if not self:
              self.initial_comment = self.initial_comment or comment_list
          else:
              pass
          if not reset_comment:
              self.final_comment = comment_list
          self.list_values = temp_list_values
code_tokens: def _parse ( self , infile ) : temp_list_values = self . list_values if self . unrepr : self . list_values = False comment_list = [ ] done_start = False this_section = self maxline = len ( infile ) - 1 cur_index = - 1 reset_comment = False while cur_index < maxline : if reset_comment : comment_list = [ ] else : cur_index += 1 line = infile [ cur_index ] sline = line . strip ( ) if not sline or sline . startswith ( '#' ) : reset_comment = False comment_list . append ( line ) continue else : if not done_start : self . initial_comment = comment_list comment_list = [ ] done_start = True reset_comment = True mat = self . _sectionmarker . match ( line ) if mat is not None : indent , sect_open , sect_name , sect_close , comment = mat . groups ( ) if indent : if self . indent_type is None : self . indent_type = indent cur_depth = sect_open . count ( '[' ) if cur_depth != sect_close . count ( ']' ) : self . _handle_error ( 'Cannot compute the section depth' , NestingError , infile , cur_index ) continue if cur_depth < this_section . depth : try : parent = self . _match_depth ( this_section , cur_depth ) . parent except SyntaxError : self . _handle_error ( 'Cannot compute nesting level' , NestingError , infile , cur_index ) continue else : if cur_depth == this_section . depth : parent = this_section . parent else : if cur_depth == this_section . depth + 1 : parent = this_section else : self . _handle_error ( 'Section too nested' , NestingError , infile , cur_index ) continue sect_name = self . _unquote ( sect_name ) if sect_name in parent : self . _handle_error ( 'Duplicate section name' , DuplicateError , infile , cur_index ) continue else : this_section = Section ( parent , cur_depth , self , name = sect_name ) parent [ sect_name ] = this_section parent . inline_comments [ sect_name ] = comment parent . comments [ sect_name ] = comment_list continue else : mat = self . _keyword . match ( line ) if mat is None : self . _handle_error ( 'Invalid line ({0!r}) (matched as neither section nor keyword)' . format ( line ) , ParseError , infile , cur_index ) else : indent , key , value = mat . groups ( ) if indent : if self . indent_type is None : self . indent_type = indent if value [ : 3 ] in ( '"""' , "'''" ) : try : value , comment , cur_index = self . _multiline ( value , infile , cur_index , maxline ) except SyntaxError : self . _handle_error ( 'Parse error in multiline value' , ParseError , infile , cur_index ) continue else : if self . unrepr : comment = '' try : value = unrepr ( value ) except Exception as e : try : if type ( e ) == UnknownType : msg = 'Unknown name or type in value' else : msg = 'Parse error from unrepr-ing multiline value' self . _handle_error ( msg , UnreprError , infile , cur_index ) continue finally : e = None del e if self . unrepr : comment = '' try : value = unrepr ( value ) except Exception as e : try : if isinstance ( e , UnknownType ) : msg = 'Unknown name or type in value' else : msg = 'Parse error from unrepr-ing value' self . _handle_error ( msg , UnreprError , infile , cur_index ) continue finally : e = None del e else : try : value , comment = self . _handle_value ( value ) except SyntaxError : self . _handle_error ( 'Parse error in value' , ParseError , infile , cur_index ) continue key = self . _unquote ( key ) if key in this_section : self . _handle_error ( 'Duplicate keyword name' , DuplicateError , infile , cur_index ) continue else : this_section . __setitem__ ( key , value , unrepr = True ) this_section . inline_comments [ key ] = comment this_section . comments [ key ] = comment_list continue if self . indent_type is None : self . indent_type = '' if not self : self . initial_comment = self . initial_comment or comment_list else : pass if not reset_comment : self . final_comment = comment_list self . list_values = temp_list_values
short_docstring: Actually parse the config file.
short_docstring_tokens: Actually parse the config file .
comment: """Actually parse the config file."""