• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7 from .. import pytree
8 from ..pgen2 import token
9 from .. import fixer_base
10 
11 
12 class 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