diff --git a/IPython/terminal/pt_inputhooks/qt.py b/IPython/terminal/pt_inputhooks/qt.py index 4040b91..b7683b8 100644 --- a/IPython/terminal/pt_inputhooks/qt.py +++ b/IPython/terminal/pt_inputhooks/qt.py @@ -19,17 +19,17 @@ def inputhook(context): global _appref app = QtCore.QCoreApplication.instance() if not app: - if sys.platform == "linux": - if not os.environ.get("DISPLAY") and not os.environ.get("WAYLAND_DISPLAY"): + if sys.platform == 'linux': + if not os.environ.get('DISPLAY') \ + and not os.environ.get('WAYLAND_DISPLAY'): import warnings - global _already_warned if not _already_warned: _already_warned = True warnings.warn( - "The DISPLAY or WAYLAND_DISPLAY environment variable is " - "not set or empty and Qt5 requires this environment " - "variable. Deactivate Qt5 code." + 'The DISPLAY or WAYLAND_DISPLAY environment variable is ' + 'not set or empty and Qt5 requires this environment ' + 'variable. Deactivate Qt5 code.' ) return QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) @@ -43,7 +43,7 @@ def inputhook(context): event_loop = QtCore.QEventLoop(app) - if sys.platform == "win32": + if sys.platform == 'win32': # The QSocketNotifier method doesn't appear to work on Windows. # Use polling instead. timer = QtCore.QTimer() @@ -55,7 +55,8 @@ def inputhook(context): else: # On POSIX platforms, we can use a file descriptor to quit the event # loop when there is input ready to read. - notifier = QtCore.QSocketNotifier(context.fileno(), QtCore.QSocketNotifier.Read) + notifier = QtCore.QSocketNotifier(context.fileno(), + QtCore.QSocketNotifier.Read) try: # connect the callback we care about before we turn it on # lambda is necessary as PyQT inspect the function signature to know