~malept/ubuntu/lucid/python2.6/dev-dependency-fix

« back to all changes in this revision

Viewing changes to Lib/lib2to3/fixes/fix_ne.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-02-13 12:51:00 UTC
  • Revision ID: james.westby@ubuntu.com-20090213125100-uufgcb9yeqzujpqw
Tags: upstream-2.6.1
ImportĀ upstreamĀ versionĀ 2.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
    def match(self, node):
 
16
        # Override
 
17
        return node.type == token.NOTEQUAL and node.value == "<>"
 
18
 
 
19
    def transform(self, node, results):
 
20
        new = pytree.Leaf(token.NOTEQUAL, "!=")
 
21
        new.set_prefix(node.get_prefix())
 
22
        return new