def _check_unpacking_targets(
     self,
     node: ast.AST,
     targets: Iterable[ast.AST],
 ) -> None:
     for target in targets:
         target_name = extract_name(target)
         if target_name is None:  # it means, that non name node was used
             self.add_violation(WrongUnpackingViolation(node))
Esempio n. 2
0
    def _check_unpacking_targets(
        self,
        node: ast.AST,
        targets: Iterable[ast.AST],
    ) -> None:
        targets = tuple(targets)

        if len(targets) == 1:
            self.add_violation(
                best_practices.SingleElementDestructuringViolation(node), )

        for target in targets:
            target_name = extract_name(target)
            if target_name is None:  # it means, that non name node was used
                self.add_violation(
                    best_practices.WrongUnpackingViolation(node), )