Skip to content
Permalink
Browse files

add a warning when unsupported imports are detected

Works for example with imports like import PyQt4.QtGui
  • Loading branch information
mbernasocchi authored and m-kuhn committed Mar 14, 2018
1 parent 9f73854 commit ac09795900f92b76c0514eed9a2ca3f69b84e823
Showing with 8 additions and 5 deletions.
  1. +8 −5 scripts/qgis_fixes/fix_pyqt.py
@@ -437,11 +437,14 @@ def transform_import(self, node, results):

names = []

# create a Node list of the replacement modules
for name in MAPPING[import_mod.value][:-1]:
names.extend([Name(name[0], prefix=pref), Comma()])
names.append(Name(MAPPING[import_mod.value][-1][0], prefix=pref))
import_mod.replace(names)
if isinstance(import_mod, Leaf):
# create a Node list of the replacement modules
for name in MAPPING[import_mod.value][:-1]:
names.extend([Name(name[0], prefix=pref), Comma()])
names.append(Name(MAPPING[import_mod.value][-1][0], prefix=pref))
import_mod.replace(names)
else:
self.cannot_convert(node, "imports like PyQt4.QtGui or import qgis.PyQt.QtGui are not supported")

def transform_member(self, node, results):
"""Transform for imports of specific module elements. Replaces

0 comments on commit ac09795

Please sign in to comment.
You can’t perform that action at this time.