MCPcopy Index your code
hub / github.com/python/mypy / check_fixed_args

Method check_fixed_args

mypy/semanal.py:6107–6121  ·  view source on GitHub ↗

Verify that expr has specified number of positional args. Return True if the arguments are valid.

(self, expr: CallExpr, numargs: int, name: str)

Source from the content-addressed store, hash-verified

6105 return expr
6106
6107 def check_fixed_args(self, expr: CallExpr, numargs: int, name: str) -> bool:
6108 """Verify that expr has specified number of positional args.
6109
6110 Return True if the arguments are valid.
6111 """
6112 s = "s"
6113 if numargs == 1:
6114 s = ""
6115 if len(expr.args) != numargs:
6116 self.fail('"%s" expects %d argument%s' % (name, numargs, s), expr)
6117 return False
6118 if expr.arg_kinds != [ARG_POS] * numargs:
6119 self.fail(f'"{name}" must be called with {numargs} positional argument{s}', expr)
6120 return False
6121 return True
6122
6123 def visit_member_expr(self, expr: MemberExpr) -> None:
6124 base = expr.expr

Callers 1

visit_call_exprMethod · 0.95

Calls 2

failMethod · 0.95
lenFunction · 0.85

Tested by

no test coverage detected