Add lib2to3 fixer base code
Switching to using RedBaron instead of lib2to3, committing to save lib2to3 code in case using Baron is not successful.
This commit is contained in:
parent
9d64ff420f
commit
0b2556f3ec
4 changed files with 28 additions and 43 deletions
20
scripts/test.py
Normal file
20
scripts/test.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from flask.ext.foo import bam
|
||||
from flask.ext import foo
|
||||
|
||||
|
||||
def migrate(old_file):
|
||||
new_file = open("temp.py", "w")
|
||||
for line in old_file:
|
||||
if line[0, 15] is "from flask.ext":
|
||||
if line[15] == '.':
|
||||
import_statement = line[16::].split(' ')
|
||||
extension = import_statement[0]
|
||||
line = line. replace("flask.ext." + extension,
|
||||
"flask_" + extension)
|
||||
else:
|
||||
pass
|
||||
|
||||
new_file.write(line)
|
||||
|
||||
if __name__ == "__main__":
|
||||
old_file = open(sys.arv[1])
|
||||
Loading…
Add table
Add a link
Reference in a new issue