@check_messages(*(list(MSGS.keys())))<EOL><INDENT>def visit_call(self, node):<DEDENT>
called = safe_infer(node.func)<EOL>if called and not called.callable():<EOL><INDENT>if isinstance(called, astroid.Instance) and (<EOL>not has_known_bases(called)<EOL>or (<EOL>isinstance(called.scope(), astroid.ClassDef)<EOL>and "<STR_LIT>" in called.locals<EOL>)<EOL>):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>self.add_message("<STR_LIT>", node=node, args=node.func.as_string())<EOL><DEDENT><DEDENT>self._check_uninferable_call(node)<EOL>try:<EOL><INDENT>called, implicit_args, callable_name = _determine_callable(called)<EOL><DEDENT>except ValueError:<EOL><INDENT>return<EOL><DEDENT>if called.args.args is None:<EOL><INDENT>return<EOL><DEDENT>if len(called.argnames()) != len(set(called.argnames())):<EOL><INDENT>return<EOL><DEDENT>call_site = astroid.arguments.CallSite.from_call(node)<EOL>for keyword in call_site.duplicated_keywords:<EOL><INDENT>self.add_message("<STR_LIT>", node=node, args=(keyword,))<EOL><DEDENT>if call_site.has_invalid_arguments() or call_site.has_invalid_keywords():<EOL><INDENT>return<EOL><DEDENT>num_positional_args = len(call_site.positional_arguments)<EOL>keyword_args = list(call_site.keyword_arguments.keys())<EOL>if isinstance(node.scope(), astroid.FunctionDef):<EOL><INDENT>has_no_context_positional_variadic = _no_context_variadic_positional(node)<EOL>has_no_context_keywords_variadic = _no_context_variadic_keywords(node)<EOL><DEDENT>else:<EOL><INDENT>has_no_context_positional_variadic = (<EOL>has_no_context_keywords_variadic<EOL>) = False<EOL><DEDENT>already_filled_positionals = getattr(called, "<STR_LIT>", <NUM_LIT:0>)<EOL>already_filled_keywords = getattr(called, "<STR_LIT>", {})<EOL>keyword_args += list(already_filled_keywords)<EOL>num_positional_args += implicit_args + already_filled_positionals<EOL>num_mandatory_parameters = len(called.args.args) - len(called.args.defaults)<EOL>parameters = []<EOL>parameter_name_to_index = {}<EOL>for i, arg in enumerate(called.args.args):<EOL><INDENT>if isinstance(arg, astroid.Tuple):<EOL><INDENT>name = None<EOL><DEDENT>else:<EOL><INDENT>assert isinstance(arg, astroid.AssignName)<EOL>name = arg.name<EOL>parameter_name_to_index[name] = i<EOL><DEDENT>if i >= num_mandatory_parameters:<EOL><INDENT>defval = called.args.defaults[i - num_mandatory_parameters]<EOL><DEDENT>else:<EOL><INDENT>defval = None<EOL><DEDENT>parameters.append([(name, defval), False])<EOL><DEDENT>kwparams = {}<EOL>for i, arg in enumerate(called.args.kwonlyargs):<EOL><INDENT>if isinstance(arg, astroid.Keyword):<EOL><INDENT>name = arg.arg<EOL><DEDENT>else:<EOL><INDENT>assert isinstance(arg, astroid.AssignName)<EOL>name = arg.name<EOL><DEDENT>kwparams[name] = [called.args.kw_defaults[i], False]<EOL><DEDENT>for i in range(num_positional_args):<EOL><INDENT>if i < len(parameters):<EOL><INDENT>parameters[i][<NUM_LIT:1>] = True<EOL><DEDENT>elif called.args.vararg is not None:<EOL><INDENT>break<EOL><DEDENT>else:<EOL><INDENT>self.add_message(<EOL>"<STR_LIT>", node=node, args=(callable_name,)<EOL>)<EOL>break<EOL><DEDENT><DEDENT>for keyword in keyword_args:<EOL><INDENT>if keyword in parameter_name_to_index:<EOL><INDENT>i = parameter_name_to_index[keyword]<EOL>if parameters[i][<NUM_LIT:1>]:<EOL><INDENT>if not (keyword == "<STR_LIT>" and called.qname() in STR_FORMAT):<EOL><INDENT>self.add_message(<EOL>"<STR_LIT>",<EOL>node=node,<EOL>args=(keyword, callable_name),<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>parameters[i][<NUM_LIT:1>] = True<EOL><DEDENT><DEDENT>elif keyword in kwparams:<EOL><INDENT>if kwparams[keyword][<NUM_LIT:1>]:  <EOL><INDENT>self.add_message(<EOL>"<STR_LIT>",<EOL>node=node,<EOL>args=(keyword, callable_name),<EOL>)<EOL><DEDENT>else:<EOL><INDENT>kwparams[keyword][<NUM_LIT:1>] = True<EOL><DEDENT><DEDENT>elif called.args.kwarg is not None:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>self.add_message(<EOL>"<STR_LIT>", node=node, args=(keyword, callable_name)<EOL>)<EOL><DEDENT><DEDENT>if node.kwargs:<EOL><INDENT>for i, [(name, defval), assigned] in enumerate(parameters):<EOL><INDENT>if name is not None:<EOL><INDENT>parameters[i][<NUM_LIT:1>] = True<EOL><DEDENT>else:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>for [(name, defval), assigned] in parameters:<EOL><INDENT>if (defval is None) and not assigned:<EOL><INDENT>if name is None:<EOL><INDENT>display_name = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>display_name = repr(name)<EOL><DEDENT>if not has_no_context_positional_variadic:<EOL><INDENT>self.add_message(<EOL>"<STR_LIT>",<EOL>node=node,<EOL>args=(display_name, callable_name),<EOL>)<EOL><DEDENT><DEDENT><DEDENT>for name in kwparams:<EOL><INDENT>defval, assigned = kwparams[name]<EOL>if defval is None and not assigned and not has_no_context_keywords_variadic:<EOL><INDENT>self.add_message("<STR_LIT>", node=node, args=(name, callable_name))<EOL><DEDENT><DEDENT>
check that called functions/methods are inferred to callable objects,
        and that the arguments passed to the function match the parameters in
        the inferred function's definition