From c68d9882df5d1a8df6e9058caed3285e2962d3ca 2021-12-09 19:35:41 From: Matthias Bussonnier Date: 2021-12-09 19:35:41 Subject: [PATCH] reformat rest of ipython --- diff --git a/IPython/external/qt_loaders.py b/IPython/external/qt_loaders.py index 6041e23..975855c 100644 --- a/IPython/external/qt_loaders.py +++ b/IPython/external/qt_loaders.py @@ -75,7 +75,7 @@ sys.meta_path.insert(0, ID) def commit_api(api): """Commit to a particular API, and trigger ImportErrors on subsequent - dangerous imports""" + dangerous imports""" modules = set(api_to_module.values()) modules.remove(api_to_module[api]) @@ -115,15 +115,15 @@ def loaded_api(): def has_binding(api): """Safely check for PyQt4/5, PySide or PySide2, without importing submodules - Parameters - ---------- - api : str [ 'pyqtv1' | 'pyqt' | 'pyqt5' | 'pyside' | 'pyside2' | 'pyqtdefault'] - Which module to check for + Parameters + ---------- + api : str [ 'pyqtv1' | 'pyqt' | 'pyqt5' | 'pyside' | 'pyside2' | 'pyqtdefault'] + Which module to check for - Returns - ------- - True if the relevant module appears to be importable - """ + Returns + ------- + True if the relevant module appears to be importable + """ module_name = api_to_module[api] from importlib.util import find_spec @@ -193,9 +193,8 @@ def import_pyqt4(version=2): Parameters ---------- version : 1, 2, or None - Which QString/QVariant API to use. Set to None to use the system - default - + Which QString/QVariant API to use. Set to None to use the system + default ImportErrors raised within this function are non-recoverable """ # The new-style string API (version=2) automatically @@ -319,13 +318,12 @@ def load_qt(api_options): Parameters ---------- - api_options: List of strings + 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. diff --git a/IPython/lib/backgroundjobs.py b/IPython/lib/backgroundjobs.py index 588c15b..e7ad51e 100644 --- a/IPython/lib/backgroundjobs.py +++ b/IPython/lib/backgroundjobs.py @@ -116,7 +116,7 @@ class BackgroundJobManager(object): The given expression is passed to eval(), along with the optional global/local dicts provided. If no dicts are given, they are extracted automatically from the caller's frame. - + A Python statement is NOT a valid eval() expression. Basically, you can only use as an eval() argument something which can go on the right of an '=' sign and be assigned to a variable. diff --git a/IPython/lib/demo.py b/IPython/lib/demo.py index 8367a6f..14af516 100644 --- a/IPython/lib/demo.py +++ b/IPython/lib/demo.py @@ -239,7 +239,7 @@ class Demo(object): terminal16m - style('default'): a string of pygments style name to be used. - """ + """ if hasattr(src, "read"): # It seems to be a file or a file-like object self.fname = "from a file-like object" diff --git a/IPython/lib/display.py b/IPython/lib/display.py index 57ae8de..52060da 100644 --- a/IPython/lib/display.py +++ b/IPython/lib/display.py @@ -517,20 +517,20 @@ class FileLinks(FileLink): fp_cleaner=None): """ generate built-in formatter function - this is used to define both the notebook and terminal built-in - formatters as they only differ by some wrapper text for each entry - - dirname_output_format: string to use for formatting directory - names, dirname will be substituted for a single "%s" which - must appear in this string - fname_output_format: string to use for formatting file names, - if a single "%s" appears in the string, fname will be substituted - if two "%s" appear in the string, the path to fname will be - substituted for the first and fname will be substituted for the - second - fp_format: string to use for formatting filepaths, must contain - exactly two "%s" and the dirname will be substituted for the first - and fname will be substituted for the second + this is used to define both the notebook and terminal built-in + formatters as they only differ by some wrapper text for each entry + + dirname_output_format: string to use for formatting directory + names, dirname will be substituted for a single "%s" which + must appear in this string + fname_output_format: string to use for formatting file names, + if a single "%s" appears in the string, fname will be substituted + if two "%s" appear in the string, the path to fname will be + substituted for the first and fname will be substituted for the + second + fp_format: string to use for formatting filepaths, must contain + exactly two "%s" and the dirname will be substituted for the first + and fname will be substituted for the second """ def f(dirname, fnames, included_suffixes=None): result = [] diff --git a/IPython/lib/latextools.py b/IPython/lib/latextools.py index a7bb08d..27aeef5 100644 --- a/IPython/lib/latextools.py +++ b/IPython/lib/latextools.py @@ -77,7 +77,6 @@ def latex_to_png(s, encode=False, backend=None, wrap=False, color='Black', format, e.g. '#AA20FA'. scale : float Scale factor for the resulting PNG. - None is returned when the backend cannot be used. """