def _validate(self, key, val, arg_types):
        """
        Ensures that the key and the value are valid arguments to be used with
        the feed.
        """
        if key in arg_types:
            arg_type = arg_types[key]
        else:
            if ANY_ARG not in arg_types:
                raise CloudantArgumentError(116, key)
            arg_type = arg_types[ANY_ARG]

        if arg_type == ANY_TYPE:
            return
        if (not isinstance(val, arg_type) or
                (isinstance(val, bool) and int in arg_type)):
            raise CloudantArgumentError(117, key, arg_type)
        if isinstance(val, int) and val < 0 and not isinstance(val, bool):
            raise CloudantArgumentError(118, key, val)
        if key == 'feed':
            valid_vals = ('continuous', 'normal', 'longpoll')
            if self._source == 'CouchDB':
                valid_vals = ('continuous', 'longpoll')
            if val not in valid_vals:
                raise CloudantArgumentError(119, val, valid_vals)
        if key == 'style' and val not in ('main_only', 'all_docs'):
            raise CloudantArgumentError(120, val)
def _validate ( self , key , val , arg_types ) : if key in arg_types : arg_type = arg_types [ key ] else : if ANY_ARG not in arg_types : raise CloudantArgumentError ( 116 , key ) arg_type = arg_types [ ANY_ARG ] if arg_type == ANY_TYPE : return if ( not isinstance ( val , arg_type ) or ( isinstance ( val , bool ) and int in arg_type ) ) : raise CloudantArgumentError ( 117 , key , arg_type ) if isinstance ( val , int ) and val < 0 and not isinstance ( val , bool ) : raise CloudantArgumentError ( 118 , key , val ) if key == 'feed' : valid_vals = ( 'continuous' , 'normal' , 'longpoll' ) if self . _source == 'CouchDB' : valid_vals = ( 'continuous' , 'longpoll' ) if val not in valid_vals : raise CloudantArgumentError ( 119 , val , valid_vals ) if key == 'style' and val not in ( 'main_only' , 'all_docs' ) : raise CloudantArgumentError ( 120 , val )
Ensures that the key and the value are valid arguments to be used with
        the feed.