summaryrefslogtreecommitdiffstats
path: root/Lib/packaging/tests/fixer/fix_echo2.py
blob: 1b92891b025fee95654ababd68ee8c2b2310322b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Example custom fixer, derived from fix_raw_input by Andre Roberge

from lib2to3 import fixer_base
from lib2to3.fixer_util import Name


class FixEcho2(fixer_base.BaseFix):

    BM_compatible = True
    PATTERN = """
              power< name='echo2' trailer< '(' [any] ')' > any* >
              """

    def transform(self, node, results):
        name = results['name']
        name.replace(Name('print', prefix=name.prefix))