Skip to content

Adding more information to "Too Few Arguments" #9796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Adding more information to "Too Few Arguments"
  • Loading branch information
abhinaypandey02 authored Dec 12, 2020
commit 5ec45910238cba6dd9b279c5e784d1e4f6373257
6 changes: 5 additions & 1 deletion mypy/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,11 @@ def too_few_arguments(self, callee: CallableType, context: Context,
args = '", "'.join(cast(List[str], diff))
msg += ' "{}" in call to {}'.format(args, callee_name)
else:
msg = 'Too few arguments' + for_function(callee)
msg = '"{}" missing {} required positional argument{}: '.format(callee.name, callee.min_args,'s' if callee.min_args>1 else '')
for i,argument in enumerate(callee.arg_names):
if callee.arg_kinds[i]==0:
msg+="\'{}\', ".format(argument)
msg=msg[:-2]
self.fail(msg, context, code=codes.CALL_ARG)

def missing_named_argument(self, callee: CallableType, context: Context, name: str) -> None:
Expand Down