def and_or_test_mutation(children, node, **_): children = children[:] children[1] = Keyword( value={'and': ' or', 'or': ' and'}[children[1].value], start_pos=node.start_pos, ) return children
def lambda_mutation(children, **_): pre, op, post = partition_node_list(children, value=':') if len(post) == 1 and getattr(post[0], 'value', None) == 'None': return pre + [op] + [Number(value=' 0', start_pos=post[0].start_pos)] else: return pre + [op] + [Keyword(value=' None', start_pos=post[0].start_pos)]
def and_or_test_mutation(children, node, **_): children = children[:] from parso.python.tree import Keyword children[1] = Keyword( value={'and': ' or', 'or': ' and'}[children[1].value], start_pos=node.start_pos, ) return children