1# Copyright 2006 Google, Inc. All Rights Reserved. 2# Licensed to PSF under a Contributor Agreement. 3 4"""Fixer that turns <> into !=.""" 5 6# Local imports 7from .. import pytree 8from ..pgen2 import token 9from .. import fixer_base 10 11 12class FixNe(fixer_base.BaseFix): 13 # This is so simple that we don't need the pattern compiler. 14 15 _accept_type = token.NOTEQUAL 16 17 def match(self, node): 18 # Override 19 return node.value == "<>" 20 21 def transform(self, node, results): 22 new = pytree.Leaf(token.NOTEQUAL, "!=", prefix=node.prefix) 23 return new 24