555 or not isinstance(node.body[0].value, ast.Yield) |
555 or not isinstance(node.body[0].value, ast.Yield) |
556 or not isinstance(node.target, ast.Name) |
556 or not isinstance(node.target, ast.Name) |
557 or not isinstance(node.body[0].value.value, ast.Name) |
557 or not isinstance(node.body[0].value.value, ast.Name) |
558 or node.target.id != node.body[0].value.value.id |
558 or node.target.id != node.body[0].value.value.id |
559 or node.orelse != [] |
559 or node.orelse != [] |
560 or isinstance(node.parent, ast.AsyncFunctionDef) |
560 ): |
561 ): |
561 parent = getattr(node, "parent", None) |
562 iterable = unparse(node.iter) |
562 while ( |
563 self.__error(node.lineno - 1, node.col_offset, "Y104", iterable) |
563 parent |
|
564 and hasattr(parent, "parent") |
|
565 and parent.parent is not parent |
|
566 and not isinstance(parent, ast.AsyncFunctionDef) |
|
567 ): |
|
568 parent = getattr(parent, "parent", None) |
|
569 |
|
570 if not isinstance(parent, ast.AsyncFunctionDef): |
|
571 iterable = unparse(node.iter) |
|
572 self.__error(node.lineno - 1, node.col_offset, "Y104", iterable) |
564 |
573 |
565 def __check105(self, node): |
574 def __check105(self, node): |
566 """ |
575 """ |
567 Private method to check for "try-except-pass" patterns. |
576 Private method to check for "try-except-pass" patterns. |
568 |
577 |