def refactor_ifs(stmnt, ifs):
'''
for if statements in list comprehension
'''
if isinstance(stmnt, _ast.BoolOp):
test, right = stmnt.values
if isinstance(stmnt.op, _ast.Or):
test = _ast.UnaryOp(op=_ast.Not(), operand=test, lineno=0, col_offset=0)
ifs.append(test)
return refactor_ifs(right, ifs)
return stmnt
评论列表
文章目录