(self, key, val)
Add key-value pair to configuration dictionary
Add key-value pair to configuration dictionary
Add key - value pair to configuration dictionary
def add_opt(self, key, val):
        """Add key-value pair to configuration dictionary"""

        # The options that appear more than once become lists on the
        # resulting dictionary.
        if (key in self.cfg):
            # If this key is not a list yet in the dictionary, make it a list
            if (not isinstance(self.cfg[key], list)):
                if (val == self.cfg[key]):
                    return  # identical value found

                new_val = list()
                new_val.append(self.cfg[key])
                new_val.append(val)
                self.cfg[key] = new_val
            else:
                if (val in self.cfg[key]):
                    return  # identical value found

                self.cfg[key].append(val)
        else:
            self.cfg[key] = val
def add_opt ( self , key , val ) : # The options that appear more than once become lists on the # resulting dictionary. if ( key in self . cfg ) : # If this key is not a list yet in the dictionary, make it a list if ( not isinstance ( self . cfg [ key ] , list ) ) : if ( val == self . cfg [ key ] ) : return # identical value found new_val = list ( ) new_val . append ( self . cfg [ key ] ) new_val . append ( val ) self . cfg [ key ] = new_val else : if ( val in self . cfg [ key ] ) : return # identical value found self . cfg [ key ] . append ( val ) else : self . cfg [ key ] = val