summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/numarray/alter_code1.py2
-rw-r--r--numpy/oldnumeric/alter_code1.py2
2 files changed, 4 insertions, 0 deletions
diff --git a/numpy/numarray/alter_code1.py b/numpy/numarray/alter_code1.py
index 634815289..f9dcf4a44 100644
--- a/numpy/numarray/alter_code1.py
+++ b/numpy/numarray/alter_code1.py
@@ -69,6 +69,8 @@ def changeimports(fstr, name, newname):
if ('.' in name):
name_ = name.replace('.','_')
+ fstr = re.sub(r'(import [^,]+,\s*)(%s)' % name,
+ "\\1%s as %s" % (newname, name), fstr)
fstr = fstr.replace(importasstr, 'import %s as ' % newname)
fstr = fstr.replace(importstr, 'import %s as %s' % (newname,name_))
if (name_ != name):
diff --git a/numpy/oldnumeric/alter_code1.py b/numpy/oldnumeric/alter_code1.py
index 662b589f5..85d0a3436 100644
--- a/numpy/oldnumeric/alter_code1.py
+++ b/numpy/oldnumeric/alter_code1.py
@@ -77,6 +77,8 @@ def changeimports(fstr, name, newname):
fromstr = 'from %s import ' % name
fromall=0
+ fstr = re.sub(r'(import [^,]+,\s*)(%s)' % name,
+ "\\1%s as %s" % (newname, name), fstr)
fstr = fstr.replace(importasstr, 'import %s as ' % newname)
fstr = fstr.replace(importstr, 'import %s as %s' % (newname,name))