Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/libfuturize/fixes/fix_input.py @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author | shellac |
---|---|
date | Sat, 02 May 2020 07:14:21 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:26e78fe6e8c4 |
---|---|
1 """ | |
2 Fixer for input. | |
3 | |
4 Does a check for `from builtins import input` before running the lib2to3 fixer. | |
5 The fixer will not run when the input is already present. | |
6 | |
7 | |
8 this: | |
9 a = input() | |
10 becomes: | |
11 from builtins import input | |
12 a = eval(input()) | |
13 | |
14 and this: | |
15 from builtins import input | |
16 a = input() | |
17 becomes (no change): | |
18 from builtins import input | |
19 a = input() | |
20 """ | |
21 | |
22 import lib2to3.fixes.fix_input | |
23 from lib2to3.fixer_util import does_tree_import | |
24 | |
25 | |
26 class FixInput(lib2to3.fixes.fix_input.FixInput): | |
27 def transform(self, node, results): | |
28 | |
29 if does_tree_import('builtins', 'input', node): | |
30 return | |
31 | |
32 return super(FixInput, self).transform(node, results) |