source: python/trunk/Lib/lib2to3/fixes/fix_ne.py

Last change on this file was 2, checked in by Yuri Dario, 15 years ago

Initial import for vendor code.

  • Property svn:eol-style set to native
File size: 573 bytes
Line 
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 == u"<>"
20
21 def transform(self, node, results):
22 new = pytree.Leaf(token.NOTEQUAL, u"!=", prefix=node.prefix)
23 return new
Note: See TracBrowser for help on using the repository browser.