From 18cf490405428a86180cd6faf6790f6e6b1e7219 2023-01-03 12:43:16 From: Emilio Graff <1@emil.io> Date: 2023-01-03 12:43:16 Subject: [PATCH] Formatting --- diff --git a/IPython/terminal/pt_inputhooks/__init__.py b/IPython/terminal/pt_inputhooks/__init__.py index ff13ee4..146424c 100644 --- a/IPython/terminal/pt_inputhooks/__init__.py +++ b/IPython/terminal/pt_inputhooks/__init__.py @@ -59,21 +59,21 @@ def set_qt_api(gui): loaded = loaded_api() qt_env2gui = { - QT_API_PYSIDE: 'qt4', - QT_API_PYQTv1: 'qt4', - QT_API_PYQT: 'qt4', - QT_API_PYSIDE2: 'qt5', - QT_API_PYQT5: 'qt5', - QT_API_PYSIDE6: 'qt6', - QT_API_PYQT6: 'qt6', + QT_API_PYSIDE: "qt4", + QT_API_PYQTv1: "qt4", + QT_API_PYQT: "qt4", + QT_API_PYSIDE2: "qt5", + QT_API_PYQT5: "qt5", + QT_API_PYSIDE6: "qt6", + QT_API_PYQT6: "qt6", } - if loaded is not None and gui != 'qt': + if loaded is not None and gui != "qt": if qt_env2gui[loaded] != gui: raise ImportError( - f'Cannot switch Qt versions for this session; must use {qt_env2gui[loaded]}.' + f"Cannot switch Qt versions for this session; must use {qt_env2gui[loaded]}." ) - if qt_api is not None and gui != 'qt': + if qt_api is not None and gui != "qt": if qt_env2gui[qt_api] != gui: print( f'Request for "{gui}" will be ignored because `QT_API` ' diff --git a/IPython/terminal/tests/test_pt_inputhooks.py b/IPython/terminal/tests/test_pt_inputhooks.py index b9aa476..775d1c7 100644 --- a/IPython/terminal/tests/test_pt_inputhooks.py +++ b/IPython/terminal/tests/test_pt_inputhooks.py @@ -12,14 +12,14 @@ guis_avail = [] def _get_qt_vers(): """If any version of Qt is available, this will populate `guis_avail` with 'qt' and 'qtx'. Due to the import mechanism, we can't import multiple versions of Qt in one session.""" - for gui in ['qt', 'qt6', 'qt5', 'qt4']: - print(f'Trying {gui}') + for gui in ["qt", "qt6", "qt5", "qt4"]: + print(f"Trying {gui}") try: set_qt_api(gui) importlib.import_module("IPython.terminal.pt_inputhooks.qt") guis_avail.append(gui) - if 'QT_API' in os.environ.keys(): - del os.environ['QT_API'] + if "QT_API" in os.environ.keys(): + del os.environ["QT_API"] except ImportError: pass # that version of Qt isn't available. except RuntimeError: @@ -29,7 +29,9 @@ def _get_qt_vers(): _get_qt_vers() -@pytest.mark.skipif(len(guis_avail) == 0, reason='No viable version of PyQt or PySide installed.') +@pytest.mark.skipif( + len(guis_avail) == 0, reason="No viable version of PyQt or PySide installed." +) def test_inputhook_qt(): gui = guis_avail[0] @@ -37,7 +39,7 @@ def test_inputhook_qt(): get_inputhook_name_and_func(gui) # ...and now we're stuck with this version of Qt for good; can't switch. - for not_gui in ['qt6', 'qt5', 'qt4']: + for not_gui in ["qt6", "qt5", "qt4"]: if not_gui not in guis_avail: break @@ -45,4 +47,4 @@ def test_inputhook_qt(): get_inputhook_name_and_func(not_gui) # A gui of 'qt' means "best available", or in this case, the last one that was used. - get_inputhook_name_and_func('qt') + get_inputhook_name_and_func("qt")