
import os

# Use PyQt by default until PySide is stable.
qt_api = os.environ.get('QT_API', 'pyqt')

if qt_api == 'pyqt':
    # For PySide compatibility, use the new string API that automatically
    # converts QStrings to unicode Python strings.
    import sip
    sip.setapi('QString', 2)

    from PyQt4 import QtCore, QtGui, QtSvg

    # Alias PyQt-specific functions for PySide compatibility.
    QtCore.Signal = QtCore.pyqtSignal
    QtCore.Slot = QtCore.pyqtSlot

else:
    from PySide import QtCore, QtGui, QtSvg


import os

# Available APIs.
QT_API_PYQT = 'pyqt'
QT_API_PYSIDE = 'pyside'

# Use PyQt by default until PySide is stable.
QT_API = os.environ.get('QT_API', QT_API_PYQT)

if QT_API == QT_API_PYQT:
    # For PySide compatibility, use the new string API that automatically
    # converts QStrings to Unicode Python strings.
    import sip
    sip.setapi('QString', 2)

    from PyQt4 import QtCore, QtGui, QtSvg

    # Alias PyQt-specific functions for PySide compatibility.
    QtCore.Signal = QtCore.pyqtSignal
    QtCore.Slot = QtCore.pyqtSlot

elif QT_API == QT_API_PYSIDE:
    from PySide import QtCore, QtGui, QtSvg

else:
    raise RuntimeError('Invalid Qt API "%s"' % QT_API)

Clean up in Qt API switcher.
Clean up in Qt API switcher.

  
  import os
  
+ # Available APIs.
+ QT_API_PYQT = 'pyqt'
+ QT_API_PYSIDE = 'pyside'
+ 
  # Use PyQt by default until PySide is stable.
- qt_api = os.environ.get('QT_API', 'pyqt')
+ QT_API = os.environ.get('QT_API', QT_API_PYQT)
  
- if qt_api == 'pyqt':
+ if QT_API == QT_API_PYQT:
      # For PySide compatibility, use the new string API that automatically
-     # converts QStrings to unicode Python strings.
+     # converts QStrings to Unicode Python strings.
      import sip
      sip.setapi('QString', 2)
  
      from PyQt4 import QtCore, QtGui, QtSvg
  
      # Alias PyQt-specific functions for PySide compatibility.
      QtCore.Signal = QtCore.pyqtSignal
      QtCore.Slot = QtCore.pyqtSlot
  
- else:
+ elif QT_API == QT_API_PYSIDE:
      from PySide import QtCore, QtGui, QtSvg
  
+ else:
+     raise RuntimeError('Invalid Qt API "%s"' % QT_API)
+ 
Clean up in Qt API switcher.
## Code Before:

import os

# Use PyQt by default until PySide is stable.
qt_api = os.environ.get('QT_API', 'pyqt')

if qt_api == 'pyqt':
    # For PySide compatibility, use the new string API that automatically
    # converts QStrings to unicode Python strings.
    import sip
    sip.setapi('QString', 2)

    from PyQt4 import QtCore, QtGui, QtSvg

    # Alias PyQt-specific functions for PySide compatibility.
    QtCore.Signal = QtCore.pyqtSignal
    QtCore.Slot = QtCore.pyqtSlot

else:
    from PySide import QtCore, QtGui, QtSvg

## Instruction:
Clean up in Qt API switcher.
## Code After:

import os

# Available APIs.
QT_API_PYQT = 'pyqt'
QT_API_PYSIDE = 'pyside'

# Use PyQt by default until PySide is stable.
QT_API = os.environ.get('QT_API', QT_API_PYQT)

if QT_API == QT_API_PYQT:
    # For PySide compatibility, use the new string API that automatically
    # converts QStrings to Unicode Python strings.
    import sip
    sip.setapi('QString', 2)

    from PyQt4 import QtCore, QtGui, QtSvg

    # Alias PyQt-specific functions for PySide compatibility.
    QtCore.Signal = QtCore.pyqtSignal
    QtCore.Slot = QtCore.pyqtSlot

elif QT_API == QT_API_PYSIDE:
    from PySide import QtCore, QtGui, QtSvg

else:
    raise RuntimeError('Invalid Qt API "%s"' % QT_API)
