示例#1
0
    def _check_function_name_and_kargs(self, function_name: str, kargs):
        if function_name not in self.translator.function_data:
            raise InvalidFunctionName(
                'Unknown function {}'.format(function_name))

        invalid_args = set(kargs.keys()).difference(self.valid_kargs)
        if invalid_args:
            raise TypeError('got an unexpected keyword argument: {}'.format(
                ', '.join(invalid_args), ))
示例#2
0
    def _check_function_name_and_kargs(self, function_name: str, kargs):
        functions = [x['name'] for x in self.abi if x['type'] == 'function']
        if function_name not in functions:
            raise InvalidFunctionName(
                'Unknown function {}'.format(function_name))

        invalid_args = set(kargs.keys()).difference(self.valid_kargs)
        if invalid_args:
            raise TypeError('got an unexpected keyword argument: {}'.format(
                ', '.join(invalid_args), ))