Beispiel #1
0
 def _assert_no_unexpected_kwargs(self, expected_args, kwargs):
     if self.kw_wildcard_name:
         return
     unexpected_kwargs = set(kwargs) - set(expected_args)
     if unexpected_kwargs:
         raise SignatureError("{} got unexpected kwarg(s): {}".format(
             self.name, sorted(unexpected_kwargs)))
Beispiel #2
0
 def _assert_no_duplicate_args(self, expected_args, args, kwargs):
     positional_arguments = expected_args[:len(args)]
     duplicate_arguments = [v for v in positional_arguments if v in kwargs]
     if duplicate_arguments:
         raise SignatureError(
             "{} got multiple values for argument(s) {}".format(
                 self.name, duplicate_arguments))
Beispiel #3
0
 def _assert_no_unexpected_args(self, expected_args, args):
     if not self.vararg_name and len(args) > len(expected_args):
         unexpected_args = args[len(expected_args):]
         raise SignatureError("{} got unexpected argument(s): {}".format(
             self.name, unexpected_args))