parameters: (self, key, value, unrepr=False)
docstring: Correctly set a value.
          
          Making dictionary values Section instances.
          (We have to special case 'Section' instances - which are also dicts)
          
          Keys must be strings.
          Values need only be strings (or lists of strings) if
          ``main.stringify`` is set.
          
          `unrepr`` must be set when setting a value to a dictionary, without
          creating a new sub-section.
docstring_summary: Correctly set a value.
          
          Making dictionary values Section instances.
          (We have to special case 'Section' instances - which are also dicts)
          
          Keys must be strings.
          Values need only be strings (or lists of strings) if
          ``main.stringify`` is set.
          
          `unrepr`` must be set when setting a value to a dictionary, without
          creating a new sub-section.
docstring_tokens: Correctly set a value . Making dictionary values Section instances . ( We have to special case Section instances - which are also dicts ) Keys must be strings . Values need only be strings ( or lists of strings ) if main . stringify is set . unrepr must be set when setting a value to a dictionary without creating a new sub - section .
function: def __setitem__(self, key, value, unrepr=False):
          """
          Correctly set a value.
          
          Making dictionary values Section instances.
          (We have to special case 'Section' instances - which are also dicts)
          
          Keys must be strings.
          Values need only be strings (or lists of strings) if
          ``main.stringify`` is set.
          
          `unrepr`` must be set when setting a value to a dictionary, without
          creating a new sub-section.
          """
          if not isinstance(key, StringTypes):
              raise ValueError, 'The key "%s" is not a string.' % key
          # add the comment
          if not self.comments.has_key(key):
              self.comments[key] = []
              self.inline_comments[key] = ''
          # remove the entry from defaults
          if key in self.defaults:
              self.defaults.remove(key)
          #
          if isinstance(value, Section):
              if not self.has_key(key):
                  self.sections.append(key)
              dict.__setitem__(self, key, value)
          elif isinstance(value, dict) and not unrepr:
              # First create the new depth level,
              # then create the section
              if not self.has_key(key):
                  self.sections.append(key)
              new_depth = self.depth + 1
              dict.__setitem__(
                  self,
                  key,
                  Section(
                      self,
                      new_depth,
                      self.main,
                      indict=value,
                      name=key))
          else:
              if not self.has_key(key):
                  self.scalars.append(key)
              if not self.main.stringify:
                  if isinstance(value, StringTypes):
                      pass
                  elif isinstance(value, (list, tuple)):
                      for entry in value:
                          if not isinstance(entry, StringTypes):
                              raise TypeError, (
                                  'Value is not a string "%s".' % entry)
                  else:
                      raise TypeError, 'Value is not a string "%s".' % value
              dict.__setitem__(self, key, value)
function_tokens: def __setitem__ ( self , key , value , unrepr = False ) : if not isinstance ( key , StringTypes ) : raise ValueError , 'The key "%s" is not a string.' % key # add the comment if not self . comments . has_key ( key ) : self . comments [ key ] = [ ] self . inline_comments [ key ] = '' # remove the entry from defaults if key in self . defaults : self . defaults . remove ( key ) # if isinstance ( value , Section ) : if not self . has_key ( key ) : self . sections . append ( key ) dict . __setitem__ ( self , key , value ) elif isinstance ( value , dict ) and not unrepr : # First create the new depth level, # then create the section if not self . has_key ( key ) : self . sections . append ( key ) new_depth = self . depth + 1 dict . __setitem__ ( self , key , Section ( self , new_depth , self . main , indict = value , name = key ) ) else : if not self . has_key ( key ) : self . scalars . append ( key ) if not self . main . stringify : if isinstance ( value , StringTypes ) : pass elif isinstance ( value , ( list , tuple ) ) : for entry in value : if not isinstance ( entry , StringTypes ) : raise TypeError , ( 'Value is not a string "%s".' % entry ) else : raise TypeError , 'Value is not a string "%s".' % value dict . __setitem__ ( self , key , value )