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

Method visit_call_expr

mypy/stubgen.py:291–307  ·  view source on GitHub ↗
(self, node: CallExpr)

Source from the content-addressed store, hash-verified

289 super().__init__()
290
291 def visit_call_expr(self, node: CallExpr) -> str:
292 # Call expressions are not usually types, but we also treat `X = TypeVar(...)` as a
293 # type alias that has to be preserved (even if TypeVar is not the same as an alias)
294 callee = node.callee.accept(self)
295 args = []
296 for name, arg, kind in zip(node.arg_names, node.args, node.arg_kinds):
297 if kind == ARG_POS:
298 args.append(arg.accept(self))
299 elif kind == ARG_STAR:
300 args.append("*" + arg.accept(self))
301 elif kind == ARG_STAR2:
302 args.append("**" + arg.accept(self))
303 elif kind == ARG_NAMED:
304 args.append(f"{name}={arg.accept(self)}")
305 else:
306 raise ValueError(f"Unknown argument kind {kind} in call")
307 return f"{callee}({', '.join(args)})"
308
309 def _visit_ref_expr(self, node: NameExpr | MemberExpr) -> str:
310 fullname = self.stubgen.get_fullname(node)

Callers

nothing calls this directly

Calls 5

zipFunction · 0.85
ValueErrorClass · 0.85
appendMethod · 0.80
acceptMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected