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