pylint/checkers/variables.py
def _check_unpacking(self, infered, node, targets):
        """ Check for unbalanced tuple unpacking
        and unpacking non sequences.
        """
        if utils.is_inside_abstract_class(node):
            return
        if utils.is_comprehension(node):
            return
        if infered is astroid.Uninferable:
            return
        if (
            isinstance(infered.parent, astroid.Arguments)
            and isinstance(node.value, astroid.Name)
            and node.value.name == infered.parent.vararg
        ):
            # Variable-length argument, we can't determine the length.
            return
        if isinstance(infered, (astroid.Tuple, astroid.List)):
            # attempt to check unpacking is properly balanced
            values = infered.itered()
            if len(targets) != len(values):
                # Check if we have starred nodes.
                if any(isinstance(target, astroid.Starred) for target in targets):
                    return
                self.add_message(
                    "unbalanced-tuple-unpacking",
                    node=node,
                    args=(
                        _get_unpacking_extra_info(node, infered),
                        len(targets),
                        len(values),
                    ),
                )
        # attempt to check unpacking may be possible (ie RHS is iterable)
        else:
            if not utils.is_iterable(infered):
                self.add_message(
                    "unpacking-non-sequence",
                    node=node,
                    args=(_get_unpacking_extra_info(node, infered),),
                )
def _check_unpacking(self, infered, node, targets):
        if utils.is_inside_abstract_class(node):
            return
        if utils.is_comprehension(node):
            return
        if infered is astroid.Uninferable:
            return
        if (
            isinstance(infered.parent, astroid.Arguments)
            and isinstance(node.value, astroid.Name)
            and node.value.name == infered.parent.vararg
        ):
            # Variable-length argument, we can't determine the length.
            return
        if isinstance(infered, (astroid.Tuple, astroid.List)):
            # attempt to check unpacking is properly balanced
            values = infered.itered()
            if len(targets) != len(values):
                # Check if we have starred nodes.
                if any(isinstance(target, astroid.Starred) for target in targets):
                    return
                self.add_message(
                    "unbalanced-tuple-unpacking",
                    node=node,
                    args=(
                        _get_unpacking_extra_info(node, infered),
                        len(targets),
                        len(values),
                    ),
                )
        # attempt to check unpacking may be possible (ie RHS is iterable)
        else:
            if not utils.is_iterable(infered):
                self.add_message(
                    "unpacking-non-sequence",
                    node=node,
                    args=(_get_unpacking_extra_info(node, infered),),
                )
def _check_unpacking ( self , infered , node , targets ) : if utils . is_inside_abstract_class ( node ) : return if utils . is_comprehension ( node ) : return if infered is astroid . Uninferable : return if ( isinstance ( infered . parent , astroid . Arguments ) and isinstance ( node . value , astroid . Name ) and node . value . name == infered . parent . vararg ) : # Variable-length argument, we can't determine the length. return if isinstance ( infered , ( astroid . Tuple , astroid . List ) ) : # attempt to check unpacking is properly balanced values = infered . itered ( ) if len ( targets ) != len ( values ) : # Check if we have starred nodes. if any ( isinstance ( target , astroid . Starred ) for target in targets ) : return self . add_message ( "unbalanced-tuple-unpacking" , node = node , args = ( _get_unpacking_extra_info ( node , infered ) , len ( targets ) , len ( values ) , ) , ) # attempt to check unpacking may be possible (ie RHS is iterable) else : if not utils . is_iterable ( infered ) : self . add_message ( "unpacking-non-sequence" , node = node , args = ( _get_unpacking_extra_info ( node , infered ) , ) , )
Check for unbalanced tuple unpacking
        and unpacking non sequences.
Check for unbalanced tuple unpacking and unpacking non sequences .