@@ -747,8 +747,8 @@ def names_approx_match(a: str, b: str) -> bool:
747
747
if stub_arg .variable .name == "_self" :
748
748
return
749
749
yield (
750
- f'stub argument "{ stub_arg .variable .name } " '
751
- f'differs from runtime argument "{ runtime_arg .name } "'
750
+ f'stub parameter "{ stub_arg .variable .name } " '
751
+ f'differs from runtime parameter "{ runtime_arg .name } "'
752
752
)
753
753
754
754
@@ -759,8 +759,8 @@ def _verify_arg_default_value(
759
759
if runtime_arg .default is not inspect .Parameter .empty :
760
760
if stub_arg .kind .is_required ():
761
761
yield (
762
- f'runtime argument "{ runtime_arg .name } " '
763
- "has a default value but stub argument does not"
762
+ f'runtime parameter "{ runtime_arg .name } " '
763
+ "has a default value but stub parameter does not"
764
764
)
765
765
else :
766
766
runtime_type = get_mypy_type_of_runtime_value (runtime_arg .default )
@@ -781,9 +781,9 @@ def _verify_arg_default_value(
781
781
and not is_subtype_helper (runtime_type , stub_type )
782
782
):
783
783
yield (
784
- f'runtime argument "{ runtime_arg .name } " '
784
+ f'runtime parameter "{ runtime_arg .name } " '
785
785
f"has a default value of type { runtime_type } , "
786
- f"which is incompatible with stub argument type { stub_type } "
786
+ f"which is incompatible with stub parameter type { stub_type } "
787
787
)
788
788
if stub_arg .initializer is not None :
789
789
stub_default = evaluate_expression (stub_arg .initializer )
@@ -807,15 +807,15 @@ def _verify_arg_default_value(
807
807
defaults_match = False
808
808
if not defaults_match :
809
809
yield (
810
- f'runtime argument "{ runtime_arg .name } " '
810
+ f'runtime parameter "{ runtime_arg .name } " '
811
811
f"has a default value of { runtime_arg .default !r} , "
812
- f"which is different from stub argument default { stub_default !r} "
812
+ f"which is different from stub parameter default { stub_default !r} "
813
813
)
814
814
else :
815
815
if stub_arg .kind .is_optional ():
816
816
yield (
817
- f'stub argument "{ stub_arg .variable .name } " has a default value '
818
- f"but runtime argument does not"
817
+ f'stub parameter "{ stub_arg .variable .name } " has a default value '
818
+ f"but runtime parameter does not"
819
819
)
820
820
821
821
@@ -1013,7 +1013,7 @@ def _verify_signature(
1013
1013
and not is_dunder (function_name , exclude_special = True ) # noisy for dunder methods
1014
1014
):
1015
1015
yield (
1016
- f'stub argument "{ stub_arg .variable .name } " should be positional-only '
1016
+ f'stub parameter "{ stub_arg .variable .name } " should be positional-only '
1017
1017
f'(add "/", e.g. "{ runtime_arg .name } , /")'
1018
1018
)
1019
1019
if (
@@ -1025,7 +1025,7 @@ def _verify_signature(
1025
1025
and not is_dunder (function_name , exclude_special = True ) # noisy for dunder methods
1026
1026
):
1027
1027
yield (
1028
- f'stub argument "{ stub_arg .variable .name } " should be positional or keyword '
1028
+ f'stub parameter "{ stub_arg .variable .name } " should be positional or keyword '
1029
1029
'(remove "/")'
1030
1030
)
1031
1031
@@ -1040,28 +1040,28 @@ def _verify_signature(
1040
1040
# If the variable is in runtime.kwonly, it's just mislabelled as not a
1041
1041
# keyword-only argument
1042
1042
if stub_arg .variable .name not in runtime .kwonly :
1043
- msg = f'runtime does not have argument "{ stub_arg .variable .name } "'
1043
+ msg = f'runtime does not have parameter "{ stub_arg .variable .name } "'
1044
1044
if runtime .varkw is not None :
1045
1045
msg += ". Maybe you forgot to make it keyword-only in the stub?"
1046
1046
yield msg
1047
1047
else :
1048
- yield f'stub argument "{ stub_arg .variable .name } " is not keyword-only'
1048
+ yield f'stub parameter "{ stub_arg .variable .name } " is not keyword-only'
1049
1049
if stub .varpos is not None :
1050
- yield f'runtime does not have *args argument "{ stub .varpos .variable .name } "'
1050
+ yield f'runtime does not have *args parameter "{ stub .varpos .variable .name } "'
1051
1051
elif len (stub .pos ) < len (runtime .pos ):
1052
1052
for runtime_arg in runtime .pos [len (stub .pos ) :]:
1053
1053
if runtime_arg .name not in stub .kwonly :
1054
1054
if not _is_private_parameter (runtime_arg ):
1055
- yield f'stub does not have argument "{ runtime_arg .name } "'
1055
+ yield f'stub does not have parameter "{ runtime_arg .name } "'
1056
1056
else :
1057
- yield f'runtime argument "{ runtime_arg .name } " is not keyword-only'
1057
+ yield f'runtime parameter "{ runtime_arg .name } " is not keyword-only'
1058
1058
1059
1059
# Checks involving *args
1060
1060
if len (stub .pos ) <= len (runtime .pos ) or runtime .varpos is None :
1061
1061
if stub .varpos is None and runtime .varpos is not None :
1062
- yield f'stub does not have *args argument "{ runtime .varpos .name } "'
1062
+ yield f'stub does not have *args parameter "{ runtime .varpos .name } "'
1063
1063
if stub .varpos is not None and runtime .varpos is None :
1064
- yield f'runtime does not have *args argument "{ stub .varpos .variable .name } "'
1064
+ yield f'runtime does not have *args parameter "{ stub .varpos .variable .name } "'
1065
1065
1066
1066
# Check keyword-only args
1067
1067
for arg in sorted (set (stub .kwonly ) & set (runtime .kwonly )):
@@ -1080,20 +1080,20 @@ def _verify_signature(
1080
1080
if arg in {runtime_arg .name for runtime_arg in runtime .pos }:
1081
1081
# Don't report this if we've reported it before
1082
1082
if arg not in {runtime_arg .name for runtime_arg in runtime .pos [len (stub .pos ) :]}:
1083
- yield f'runtime argument "{ arg } " is not keyword-only'
1083
+ yield f'runtime parameter "{ arg } " is not keyword-only'
1084
1084
else :
1085
- yield f'runtime does not have argument "{ arg } "'
1085
+ yield f'runtime does not have parameter "{ arg } "'
1086
1086
for arg in sorted (set (runtime .kwonly ) - set (stub .kwonly )):
1087
1087
if arg in {stub_arg .variable .name for stub_arg in stub .pos }:
1088
1088
# Don't report this if we've reported it before
1089
1089
if not (
1090
1090
runtime .varpos is None
1091
1091
and arg in {stub_arg .variable .name for stub_arg in stub .pos [len (runtime .pos ) :]}
1092
1092
):
1093
- yield f'stub argument "{ arg } " is not keyword-only'
1093
+ yield f'stub parameter "{ arg } " is not keyword-only'
1094
1094
else :
1095
1095
if not _is_private_parameter (runtime .kwonly [arg ]):
1096
- yield f'stub does not have argument "{ arg } "'
1096
+ yield f'stub does not have parameter "{ arg } "'
1097
1097
1098
1098
# Checks involving **kwargs
1099
1099
if stub .varkw is None and runtime .varkw is not None :
@@ -1103,9 +1103,9 @@ def _verify_signature(
1103
1103
stub_pos_names = {stub_arg .variable .name for stub_arg in stub .pos }
1104
1104
# Ideally we'd do a strict subset check, but in practice the errors from that aren't useful
1105
1105
if not set (runtime .kwonly ).issubset (set (stub .kwonly ) | stub_pos_names ):
1106
- yield f'stub does not have **kwargs argument "{ runtime .varkw .name } "'
1106
+ yield f'stub does not have **kwargs parameter "{ runtime .varkw .name } "'
1107
1107
if stub .varkw is not None and runtime .varkw is None :
1108
- yield f'runtime does not have **kwargs argument "{ stub .varkw .variable .name } "'
1108
+ yield f'runtime does not have **kwargs parameter "{ stub .varkw .variable .name } "'
1109
1109
1110
1110
1111
1111
def _is_private_parameter (arg : inspect .Parameter ) -> bool :
@@ -1425,7 +1425,7 @@ def apply_decorator_to_funcitem(
1425
1425
if decorator .fullname == "builtins.classmethod" :
1426
1426
if func .arguments [0 ].variable .name not in ("cls" , "mcs" , "metacls" ):
1427
1427
raise StubtestFailure (
1428
- f"unexpected class argument name { func .arguments [0 ].variable .name !r} "
1428
+ f"unexpected class parameter name { func .arguments [0 ].variable .name !r} "
1429
1429
f"in { dec .fullname } "
1430
1430
)
1431
1431
# FuncItem is written so that copy.copy() actually works, even when compiled
0 commit comments