parameters: (api_options)
docstring: Attempt to import Qt, given a preference list
      of permissible bindings
  
      It is safe to call this function multiple times.
  
      Parameters
      ----------
      api_options: List of strings
          The order of APIs to try. Valid items are 'pyside', 'pyside2',
          'pyqt', 'pyqt5', 'pyqtv1' and 'pyqtdefault'
  
      Returns
      -------
  
      A tuple of QtCore, QtGui, QtSvg, QT_API
      The first three are the Qt modules. The last is the
      string indicating which module was loaded.
  
      Raises
      ------
      ImportError, if it isn't possible to import any requested
      bindings (either becaues they aren't installed, or because
      an incompatible library has already been installed)
docstring_summary: Attempt to import Qt, given a preference list
      of permissible bindings
docstring_tokens: Attempt to import Qt given a preference list of permissible bindings
function: def load_qt(api_options):
      """
      Attempt to import Qt, given a preference list
      of permissible bindings
  
      It is safe to call this function multiple times.
  
      Parameters
      ----------
      api_options: List of strings
          The order of APIs to try. Valid items are 'pyside', 'pyside2',
          'pyqt', 'pyqt5', 'pyqtv1' and 'pyqtdefault'
  
      Returns
      -------
  
      A tuple of QtCore, QtGui, QtSvg, QT_API
      The first three are the Qt modules. The last is the
      string indicating which module was loaded.
  
      Raises
      ------
      ImportError, if it isn't possible to import any requested
      bindings (either becaues they aren't installed, or because
      an incompatible library has already been installed)
      """
      loaders = {
                 QT_API_PYSIDE2: import_pyside2,
                 QT_API_PYSIDE: import_pyside,
                 QT_API_PYQT: import_pyqt4,
                 QT_API_PYQT5: import_pyqt5,
                 QT_API_PYQTv1: partial(import_pyqt4, version=1),
                 QT_API_PYQT_DEFAULT: partial(import_pyqt4, version=None)
                }
  
      for api in api_options:
  
          if api not in loaders:
              raise RuntimeError(
                  "Invalid Qt API %r, valid values are: %s" %
                  (api, ", ".join(["%r" % k for k in loaders.keys()])))
  
          if not can_import(api):
              continue
  
          #cannot safely recover from an ImportError during this
          result = loaders[api]()
          api = result[-1]  # changed if api = QT_API_PYQT_DEFAULT
          commit_api(api)
          return result
      else:
          raise ImportError("""
      Could not load requested Qt binding. Please ensure that
      PyQt4 >= 4.7, PyQt5, PySide >= 1.0.3 or PySide2 is available,
      and only one is imported per session.
  
      Currently-imported Qt library:                              %r
      PyQt4 available (requires QtCore, QtGui, QtSvg):            %s
      PyQt5 available (requires QtCore, QtGui, QtSvg, QtWidgets): %s
      PySide >= 1.0.3 installed:                                  %s
      PySide2 installed:                                          %s
      Tried to load:                                              %r
      """ % (loaded_api(),
             has_binding(QT_API_PYQT),
             has_binding(QT_API_PYQT5),
             has_binding(QT_API_PYSIDE),
             has_binding(QT_API_PYSIDE2),
             api_options))
function_tokens: def load_qt ( api_options ) : loaders = { QT_API_PYSIDE2 : import_pyside2 , QT_API_PYSIDE : import_pyside , QT_API_PYQT : import_pyqt4 , QT_API_PYQT5 : import_pyqt5 , QT_API_PYQTv1 : partial ( import_pyqt4 , version = 1 ) , QT_API_PYQT_DEFAULT : partial ( import_pyqt4 , version = None ) } for api in api_options : if api not in loaders : raise RuntimeError ( "Invalid Qt API %r, valid values are: %s" % ( api , ", " . join ( [ "%r" % k for k in loaders . keys ( ) ] ) ) ) if not can_import ( api ) : continue #cannot safely recover from an ImportError during this result = loaders [ api ] ( ) api = result [ - 1 ] # changed if api = QT_API_PYQT_DEFAULT commit_api ( api ) return result else : raise ImportError ( """
      Could not load requested Qt binding. Please ensure that
      PyQt4 >= 4.7, PyQt5, PySide >= 1.0.3 or PySide2 is available,
      and only one is imported per session.
  
      Currently-imported Qt library:                              %r
      PyQt4 available (requires QtCore, QtGui, QtSvg):            %s
      PyQt5 available (requires QtCore, QtGui, QtSvg, QtWidgets): %s
      PySide >= 1.0.3 installed:                                  %s
      PySide2 installed:                                          %s
      Tried to load:                                              %r
      """ % ( loaded_api ( ) , has_binding ( QT_API_PYQT ) , has_binding ( QT_API_PYQT5 ) , has_binding ( QT_API_PYSIDE ) , has_binding ( QT_API_PYSIDE2 ) , api_options ) )