(self, key, allowed_values)
asserts that the key is one of the allowed values.  If not, spits out an error message.
asserts that the key is one of the allowed values.  If not, spits out an error message.
asserts that the key is one of the allowed values . If not spits out an error message .
def verify_values(self, key, allowed_values):
        '''asserts that the key is one of the allowed values.  If not, spits out an error message.'''

        # if key is not in the dict, don't bother.
        if key not in self.__dict__:
            return

        value = self.__dict__[key]
        allowed_values_string = '{' + ', '.join(["'" + str(x) + "'" for x in allowed_values]) + '}'
        assert self.__dict__[key] in allowed_values, "config.%s='%s' (%s) is invalid.  Allowed values: %s" % (
            key, value, type(value), allowed_values_string)
def verify_values ( self , key , allowed_values ) : # if key is not in the dict, don't bother. if key not in self . __dict__ : return value = self . __dict__ [ key ] allowed_values_string = '{' + ', ' . join ( [ "'" + str ( x ) + "'" for x in allowed_values ] ) + '}' assert self . __dict__ [ key ] in allowed_values , "config.%s='%s' (%s) is invalid.  Allowed values: %s" % ( key , value , type ( value ) , allowed_values_string )