typecheck.py (pylint-2.13.7) | : | typecheck.py (pylint-2.13.8) | ||
---|---|---|---|---|
skipping to change at line 1898 | skipping to change at line 1898 | |||
return | return | |||
if getattr(inferred, "decorators", None): | if getattr(inferred, "decorators", None): | |||
first_decorator = astroid.helpers.safe_infer(inferred.decorators.nod es[0]) | first_decorator = astroid.helpers.safe_infer(inferred.decorators.nod es[0]) | |||
if isinstance(first_decorator, nodes.ClassDef): | if isinstance(first_decorator, nodes.ClassDef): | |||
inferred = first_decorator.instantiate_class() | inferred = first_decorator.instantiate_class() | |||
else: | else: | |||
return # It would be better to handle function | return # It would be better to handle function | |||
# decorators, but let's start slow. | # decorators, but let's start slow. | |||
if supported_protocol and not supported_protocol(inferred, node): | if ( | |||
supported_protocol | ||||
and not supported_protocol(inferred, node) | ||||
and not utils.in_type_checking_block(node) | ||||
): | ||||
self.add_message(msg, args=node.value.as_string(), node=node.value) | self.add_message(msg, args=node.value.as_string(), node=node.value) | |||
@check_messages("dict-items-missing-iter") | @check_messages("dict-items-missing-iter") | |||
def visit_for(self, node: nodes.For) -> None: | def visit_for(self, node: nodes.For) -> None: | |||
if not isinstance(node.target, nodes.Tuple): | if not isinstance(node.target, nodes.Tuple): | |||
# target is not a tuple | # target is not a tuple | |||
return | return | |||
if not len(node.target.elts) == 2: | if not len(node.target.elts) == 2: | |||
# target is not a tuple of two elements | # target is not a tuple of two elements | |||
return | return | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added |