def _check_new_format(self, node, func):
<EOL>if isinstance(node.func, astroid.Attribute) and not isinstance(<EOL>node.func.expr, astroid.Const<EOL>):<EOL><INDENT>return<EOL><DEDENT>if node.starargs or node.kwargs:<EOL><INDENT>return<EOL><DEDENT>try:<EOL><INDENT>strnode = next(func.bound.infer())<EOL><DEDENT>except astroid.InferenceError:<EOL><INDENT>return<EOL><DEDENT>if not (isinstance(strnode, astroid.Const) and isinstance(strnode.value, str)):<EOL><INDENT>return<EOL><DEDENT>try:<EOL><INDENT>call_site = CallSite.from_call(node)<EOL><DEDENT>except astroid.InferenceError:<EOL><INDENT>return<EOL><DEDENT>try:<EOL><INDENT>fields, num_args, manual_pos = utils.parse_format_method_string(<EOL>strnode.value<EOL>)<EOL><DEDENT>except utils.IncompleteFormatString:<EOL><INDENT>self.add_message("<STR_LIT>", node=node)<EOL>return<EOL><DEDENT>positional_arguments = call_site.positional_arguments<EOL>named_arguments = call_site.keyword_arguments<EOL>named_fields = {field[<NUM_LIT:0>] for field in fields if isinstance(field[<NUM_LIT:0>], str)}<EOL>if num_args and manual_pos:<EOL><INDENT>self.add_message("<STR_LIT>", node=node)<EOL>return<EOL><DEDENT>check_args = False<EOL>num_args += sum(<NUM_LIT:1> for field in named_fields if field == "<STR_LIT>")<EOL>if named_fields:<EOL><INDENT>for field in named_fields:<EOL><INDENT>if field and field not in named_arguments:<EOL><INDENT>self.add_message(<EOL>"<STR_LIT>", node=node, args=(field,)<EOL>)<EOL><DEDENT><DEDENT>for field in named_arguments:<EOL><INDENT>if field not in named_fields:<EOL><INDENT>self.add_message(<EOL>"<STR_LIT>", node=node, args=(field,)<EOL>)<EOL><DEDENT><DEDENT>num_args = num_args or manual_pos<EOL>if positional_arguments or num_args:<EOL><INDENT>empty = any(True for field in named_fields if field == "<STR_LIT>")<EOL>if named_arguments or empty:<EOL><INDENT>check_args = True<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>check_args = True<EOL><DEDENT>if check_args:<EOL><INDENT>num_args = num_args or manual_pos<EOL>if len(positional_arguments) > num_args:<EOL><INDENT>self.add_message("<STR_LIT>", node=node)<EOL><DEDENT>elif len(positional_arguments) < num_args:<EOL><INDENT>self.add_message("<STR_LIT>", node=node)<EOL><DEDENT><DEDENT>self._detect_vacuous_formatting(node, positional_arguments)<EOL>self._check_new_format_specifiers(node, fields, named_arguments)<EOL>
Check the new string formatting.