@@ -949,22 +949,10 @@ def visit_BinOp(self, binop):
949949 res = self .assign (ast .BinOp (left_expr , binop .op , right_expr ))
950950 return res , explanation
951951
952- @staticmethod
953- def _is_any_call_with_generator_or_list_comprehension (call ):
954- """Return True if the Call node is an 'any' call with a generator or list comprehension"""
955- return (
956- isinstance (call .func , ast .Name )
957- and call .func .id == "all"
958- and len (call .args ) == 1
959- and isinstance (call .args [0 ], (ast .GeneratorExp , ast .ListComp ))
960- )
961-
962952 def visit_Call_35 (self , call ):
963953 """
964954 visit `ast.Call` nodes on Python3.5 and after
965955 """
966- if self ._is_any_call_with_generator_or_list_comprehension (call ):
967- return self ._visit_all (call )
968956 new_func , func_expl = self .visit (call .func )
969957 arg_expls = []
970958 new_args = []
@@ -988,25 +976,6 @@ def visit_Call_35(self, call):
988976 outer_expl = "%s\n {%s = %s\n }" % (res_expl , res_expl , expl )
989977 return res , outer_expl
990978
991- def _visit_all (self , call ):
992- """Special rewrite for the builtin all function, see #5062"""
993- gen_exp = call .args [0 ]
994- assertion_module = ast .Module (
995- body = [ast .Assert (test = gen_exp .elt , lineno = 1 , msg = "" , col_offset = 1 )]
996- )
997- AssertionRewriter (module_path = None , config = None ).run (assertion_module )
998- for_loop = ast .For (
999- iter = gen_exp .generators [0 ].iter ,
1000- target = gen_exp .generators [0 ].target ,
1001- body = assertion_module .body ,
1002- orelse = [],
1003- )
1004- self .statements .append (for_loop )
1005- return (
1006- ast .Num (n = 1 ),
1007- "" ,
1008- ) # Return an empty expression, all the asserts are in the for_loop
1009-
1010979 def visit_Starred (self , starred ):
1011980 # From Python 3.5, a Starred node can appear in a function call
1012981 res , expl = self .visit (starred .value )
@@ -1017,8 +986,6 @@ def visit_Call_legacy(self, call):
1017986 """
1018987 visit `ast.Call nodes on 3.4 and below`
1019988 """
1020- if self ._is_any_call_with_generator_or_list_comprehension (call ):
1021- return self ._visit_all (call )
1022989 new_func , func_expl = self .visit (call .func )
1023990 arg_expls = []
1024991 new_args = []
0 commit comments