@@ -36,10 +36,10 @@ def validate(self, positional, named, dryrun=False):
36
36
self ._validate_no_extra_named (named , self ._argspec )
37
37
38
38
def _validate_no_multiple_values (self , positional , named , spec ):
39
- for name in ( spec .positional_only + spec . positional_or_named ) [:len (positional )]:
40
- if name in spec . positional_or_named and name in named :
41
- raise DataError ("%s '%s' got multiple values for argument "
42
- "'%s'." % (spec .type , spec .name , name ))
39
+ for name in spec .positional [:len (positional )]:
40
+ if name in named and name not in spec . positional_only :
41
+ raise DataError ("%s '%s' got multiple values for argument '%s'. "
42
+ % (spec .type , spec .name , name ))
43
43
44
44
def _validate_no_positional_only_as_named (self , named , spec ):
45
45
if not spec .var_named :
@@ -70,8 +70,8 @@ def _raise_wrong_count(self, count, spec):
70
70
% (spec .type , spec .name , expected , count ))
71
71
72
72
def _validate_no_mandatory_missing (self , positional , named , spec ):
73
- for name in spec .positional [len (positional ):spec . minargs ]:
74
- if name not in named :
73
+ for name in spec .positional [len (positional ):]:
74
+ if name not in spec . defaults and name not in named :
75
75
raise DataError ("%s '%s' missing value for argument '%s'."
76
76
% (spec .type , spec .name , name ))
77
77
0 commit comments