diff options
author | Nikita Slyusarev <nslus@yandex-team.com> | 2022-02-10 16:46:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:52 +0300 |
commit | cd77cecfc03a3eaf87816af28a33067c4f0cdb59 (patch) | |
tree | 1308e0bae862d52e0020d881fe758080437fe389 /contrib/python/ipython/py2/IPython/lib | |
parent | cdae02d225fb5b3afbb28990e79a7ac6c9125327 (diff) | |
download | ydb-cd77cecfc03a3eaf87816af28a33067c4f0cdb59.tar.gz |
Restoring authorship annotation for Nikita Slyusarev <nslus@yandex-team.com>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/ipython/py2/IPython/lib')
-rw-r--r-- | contrib/python/ipython/py2/IPython/lib/backgroundjobs.py | 2 | ||||
-rw-r--r-- | contrib/python/ipython/py2/IPython/lib/deepreload.py | 8 | ||||
-rw-r--r-- | contrib/python/ipython/py2/IPython/lib/demo.py | 28 | ||||
-rw-r--r-- | contrib/python/ipython/py2/IPython/lib/display.py | 2 | ||||
-rw-r--r-- | contrib/python/ipython/py2/IPython/lib/inputhook.py | 230 | ||||
-rw-r--r-- | contrib/python/ipython/py2/IPython/lib/latextools.py | 34 | ||||
-rw-r--r-- | contrib/python/ipython/py2/IPython/lib/lexers.py | 20 | ||||
-rw-r--r-- | contrib/python/ipython/py2/IPython/lib/pretty.py | 38 |
8 files changed, 181 insertions, 181 deletions
diff --git a/contrib/python/ipython/py2/IPython/lib/backgroundjobs.py b/contrib/python/ipython/py2/IPython/lib/backgroundjobs.py index b724126bbb..62ae52e94e 100644 --- a/contrib/python/ipython/py2/IPython/lib/backgroundjobs.py +++ b/contrib/python/ipython/py2/IPython/lib/backgroundjobs.py @@ -36,7 +36,7 @@ import threading from IPython import get_ipython from IPython.core.ultratb import AutoFormattedTB -from logging import error +from logging import error from IPython.utils.py3compat import string_types diff --git a/contrib/python/ipython/py2/IPython/lib/deepreload.py b/contrib/python/ipython/py2/IPython/lib/deepreload.py index 76b493c0bb..45efcb45d2 100644 --- a/contrib/python/ipython/py2/IPython/lib/deepreload.py +++ b/contrib/python/ipython/py2/IPython/lib/deepreload.py @@ -351,11 +351,11 @@ def _dreload(module, **kwargs): import reload explicitly from `IPython.lib.deepreload` to use it """ - # this was marked as deprecated and for 5.0 removal, but - # IPython.core_builtin_trap have a Deprecation warning for 6.0, so cannot - # remove that now. + # this was marked as deprecated and for 5.0 removal, but + # IPython.core_builtin_trap have a Deprecation warning for 6.0, so cannot + # remove that now. warn(""" -injecting `dreload` in interactive namespace is deprecated since IPython 4.0. +injecting `dreload` in interactive namespace is deprecated since IPython 4.0. Please import `reload` explicitly from `IPython.lib.deepreload`. """, DeprecationWarning, stacklevel=2) reload(module, **kwargs) diff --git a/contrib/python/ipython/py2/IPython/lib/demo.py b/contrib/python/ipython/py2/IPython/lib/demo.py index b0f3503ed7..7b047ad82a 100644 --- a/contrib/python/ipython/py2/IPython/lib/demo.py +++ b/contrib/python/ipython/py2/IPython/lib/demo.py @@ -326,7 +326,7 @@ class Demo(object): if index is None: if self.finished: - print('Demo finished. Use <demo_name>.reset() if you want to rerun it.') + print('Demo finished. Use <demo_name>.reset() if you want to rerun it.') return None index = self.block_index else: @@ -397,8 +397,8 @@ class Demo(object): return print(self.marquee('<%s> block # %s (%s remaining)' % - (self.title,index,self.nblocks-index-1))) - print(self.src_blocks_colored[index]) + (self.title,index,self.nblocks-index-1))) + print(self.src_blocks_colored[index]) sys.stdout.flush() def show_all(self): @@ -412,11 +412,11 @@ class Demo(object): for index,block in enumerate(self.src_blocks_colored): if silent[index]: print(marquee('<%s> SILENT block # %s (%s remaining)' % - (title,index,nblocks-index-1))) + (title,index,nblocks-index-1))) else: print(marquee('<%s> block # %s (%s remaining)' % - (title,index,nblocks-index-1))) - print(block, end=' ') + (title,index,nblocks-index-1))) + print(block, end=' ') sys.stdout.flush() def run_cell(self,source): @@ -442,17 +442,17 @@ class Demo(object): self.block_index += 1 if self._silent[index]: print(marquee('Executing silent block # %s (%s remaining)' % - (index,self.nblocks-index-1))) + (index,self.nblocks-index-1))) else: self.pre_cmd() self.show(index) if self.auto_all or self._auto[index]: - print(marquee('output:')) + print(marquee('output:')) else: - print(marquee('Press <q> to quit, <Enter> to execute...'), end=' ') + print(marquee('Press <q> to quit, <Enter> to execute...'), end=' ') ans = py3compat.input().strip() if ans: - print(marquee('Block NOT executed')) + print(marquee('Block NOT executed')) return try: save_argv = sys.argv @@ -470,10 +470,10 @@ class Demo(object): if self.block_index == self.nblocks: mq1 = self.marquee('END OF DEMO') if mq1: - # avoid spurious print if empty marquees are used - print() - print(mq1) - print(self.marquee('Use <demo_name>.reset() if you want to rerun it.')) + # avoid spurious print if empty marquees are used + print() + print(mq1) + print(self.marquee('Use <demo_name>.reset() if you want to rerun it.')) self.finished = True # These methods are meant to be overridden by subclasses who may wish to diff --git a/contrib/python/ipython/py2/IPython/lib/display.py b/contrib/python/ipython/py2/IPython/lib/display.py index 9221e2e062..5a8d79ad47 100644 --- a/contrib/python/ipython/py2/IPython/lib/display.py +++ b/contrib/python/ipython/py2/IPython/lib/display.py @@ -41,7 +41,7 @@ class Audio(DisplayObject): filename : unicode Path to a local file to load the data from. embed : boolean - Should the audio data be embedded using a data URI (True) or should + Should the audio data be embedded using a data URI (True) or should the original source be referenced. Set this to True if you want the audio to playable later with no internet connection in the notebook. diff --git a/contrib/python/ipython/py2/IPython/lib/inputhook.py b/contrib/python/ipython/py2/IPython/lib/inputhook.py index e6e8f2dbbc..e742264914 100644 --- a/contrib/python/ipython/py2/IPython/lib/inputhook.py +++ b/contrib/python/ipython/py2/IPython/lib/inputhook.py @@ -1,7 +1,7 @@ # coding: utf-8 """ -Deprecated since IPython 5.0 - +Deprecated since IPython 5.0 + Inputhook management for GUI event loop integration. """ @@ -19,13 +19,13 @@ import platform import sys from distutils.version import LooseVersion as V -from warnings import warn - - -warn("`IPython.lib.inputhook` is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) - +from warnings import warn + +warn("`IPython.lib.inputhook` is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) + + #----------------------------------------------------------------------------- # Constants #----------------------------------------------------------------------------- @@ -105,10 +105,10 @@ else: class InputHookManager(object): - """DEPRECATED since IPython 5.0 - - Manage PyOS_InputHook for different GUI toolkits. + """DEPRECATED since IPython 5.0 + Manage PyOS_InputHook for different GUI toolkits. + This class installs various hooks under ``PyOSInputHook`` to handle GUI event loop integration. """ @@ -130,25 +130,25 @@ class InputHookManager(object): self._current_gui = None def get_pyos_inputhook(self): - """DEPRECATED since IPython 5.0 - - Return the current PyOS_InputHook as a ctypes.c_void_p.""" - warn("`get_pyos_inputhook` is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + """DEPRECATED since IPython 5.0 + + Return the current PyOS_InputHook as a ctypes.c_void_p.""" + warn("`get_pyos_inputhook` is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) return ctypes.c_void_p.in_dll(ctypes.pythonapi,"PyOS_InputHook") def get_pyos_inputhook_as_func(self): - """DEPRECATED since IPython 5.0 - - Return the current PyOS_InputHook as a ctypes.PYFUNCYPE.""" - warn("`get_pyos_inputhook_as_func` is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + """DEPRECATED since IPython 5.0 + + Return the current PyOS_InputHook as a ctypes.PYFUNCYPE.""" + warn("`get_pyos_inputhook_as_func` is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) return self.PYFUNC.in_dll(ctypes.pythonapi,"PyOS_InputHook") def set_inputhook(self, callback): - """DEPRECATED since IPython 5.0 - - Set PyOS_InputHook to callback and return the previous one.""" + """DEPRECATED since IPython 5.0 + + Set PyOS_InputHook to callback and return the previous one.""" # On platforms with 'readline' support, it's all too likely to # have a KeyboardInterrupt signal delivered *even before* an # initial ``try:`` clause in the callback can be executed, so @@ -164,10 +164,10 @@ class InputHookManager(object): return original def clear_inputhook(self, app=None): - """DEPRECATED since IPython 5.0 - - Set PyOS_InputHook to NULL and return the previous one. + """DEPRECATED since IPython 5.0 + Set PyOS_InputHook to NULL and return the previous one. + Parameters ---------- app : optional, ignored @@ -176,8 +176,8 @@ class InputHookManager(object): the actual value of the parameter is ignored. This uniform interface makes it easier to have user-level entry points in the main IPython app like :meth:`enable_gui`.""" - warn("`clear_inputhook` is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("`clear_inputhook` is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) pyos_inputhook_ptr = self.get_pyos_inputhook() original = self.get_pyos_inputhook_as_func() pyos_inputhook_ptr.value = ctypes.c_void_p(None).value @@ -186,10 +186,10 @@ class InputHookManager(object): return original def clear_app_refs(self, gui=None): - """DEPRECATED since IPython 5.0 - - Clear IPython's internal reference to an application instance. + """DEPRECATED since IPython 5.0 + Clear IPython's internal reference to an application instance. + Whenever we create an app for a user on qt4 or wx, we hold a reference to the app. This is needed because in some cases bad things can happen if a user doesn't hold a reference themselves. This @@ -202,17 +202,17 @@ class InputHookManager(object): the app for that toolkit. References are not held for gtk or tk as those toolkits don't have the notion of an app. """ - warn("`clear_app_refs` is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("`clear_app_refs` is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) if gui is None: self.apps = {} elif gui in self.apps: del self.apps[gui] def register(self, toolkitname, *aliases): - """DEPRECATED since IPython 5.0 - - Register a class to provide the event loop for a given GUI. + """DEPRECATED since IPython 5.0 + + Register a class to provide the event loop for a given GUI. This is intended to be used as a class decorator. It should be passed the names with which to register this GUI integration. The classes @@ -225,8 +225,8 @@ class InputHookManager(object): def enable(self, app=None): ... """ - warn("`register` is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("`register` is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) def decorator(cls): if ctypes is not None: inst = cls(self) @@ -237,18 +237,18 @@ class InputHookManager(object): return decorator def current_gui(self): - """DEPRECATED since IPython 5.0 - - Return a string indicating the currently active GUI or None.""" - warn("`current_gui` is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + """DEPRECATED since IPython 5.0 + + Return a string indicating the currently active GUI or None.""" + warn("`current_gui` is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) return self._current_gui def enable_gui(self, gui=None, app=None): - """DEPRECATED since IPython 5.0 - - Switch amongst GUI input hooks by name. + """DEPRECATED since IPython 5.0 + Switch amongst GUI input hooks by name. + This is a higher level method than :meth:`set_inputhook` - it uses the GUI name to look up a registered object which enables the input hook for that GUI. @@ -271,8 +271,8 @@ class InputHookManager(object): PyOS_InputHook wrapper object or the GUI toolkit app created, if there was one. """ - warn("`enable_gui` is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("`enable_gui` is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) if gui in (None, GUI_NONE): return self.disable_gui() @@ -289,28 +289,28 @@ class InputHookManager(object): app = gui_hook.enable(app) if app is not None: app._in_event_loop = True - self.apps[gui] = app + self.apps[gui] = app return app def disable_gui(self): - """DEPRECATED since IPython 5.0 - - Disable GUI event loop integration. + """DEPRECATED since IPython 5.0 + + Disable GUI event loop integration. If an application was registered, this sets its ``_in_event_loop`` attribute to False. It then calls :meth:`clear_inputhook`. """ - warn("`disable_gui` is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("`disable_gui` is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) gui = self._current_gui if gui in self.apps: self.apps[gui]._in_event_loop = False return self.clear_inputhook() class InputHookBase(object): - """DEPRECATED since IPython 5.0 - - Base class for input hooks for specific toolkits. + """DEPRECATED since IPython 5.0 + + Base class for input hooks for specific toolkits. Subclasses should define an :meth:`enable` method with one argument, ``app``, which will either be an instance of the toolkit's application class, or None. @@ -326,20 +326,20 @@ inputhook_manager = InputHookManager() @inputhook_manager.register('osx') class NullInputHook(InputHookBase): - """DEPRECATED since IPython 5.0 - - A null inputhook that doesn't need to do anything""" + """DEPRECATED since IPython 5.0 + + A null inputhook that doesn't need to do anything""" def enable(self, app=None): - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) @inputhook_manager.register('wx') class WxInputHook(InputHookBase): def enable(self, app=None): - """DEPRECATED since IPython 5.0 - - Enable event loop integration with wxPython. + """DEPRECATED since IPython 5.0 + Enable event loop integration with wxPython. + Parameters ---------- app : WX Application, optional. @@ -359,8 +359,8 @@ class WxInputHook(InputHookBase): import wx app = wx.App(redirect=False, clearSigInt=False) """ - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) import wx wx_version = V(wx.__version__).version @@ -383,14 +383,14 @@ class WxInputHook(InputHookBase): return app def disable(self): - """DEPRECATED since IPython 5.0 - - Disable event loop integration with wxPython. + """DEPRECATED since IPython 5.0 + Disable event loop integration with wxPython. + This restores appnapp on OS X """ - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) if _use_appnope(): from appnope import nap nap() @@ -398,9 +398,9 @@ class WxInputHook(InputHookBase): @inputhook_manager.register('qt', 'qt4') class Qt4InputHook(InputHookBase): def enable(self, app=None): - """DEPRECATED since IPython 5.0 - - Enable event loop integration with PyQt4. + """DEPRECATED since IPython 5.0 + + Enable event loop integration with PyQt4. Parameters ---------- @@ -421,8 +421,8 @@ class Qt4InputHook(InputHookBase): from PyQt4 import QtCore app = QtGui.QApplication(sys.argv) """ - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) from IPython.lib.inputhookqt4 import create_inputhook_qt4 app, inputhook_qt4 = create_inputhook_qt4(self.manager, app) self.manager.set_inputhook(inputhook_qt4) @@ -433,14 +433,14 @@ class Qt4InputHook(InputHookBase): return app def disable_qt4(self): - """DEPRECATED since IPython 5.0 - - Disable event loop integration with PyQt4. + """DEPRECATED since IPython 5.0 + Disable event loop integration with PyQt4. + This restores appnapp on OS X """ - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) if _use_appnope(): from appnope import nap nap() @@ -449,8 +449,8 @@ class Qt4InputHook(InputHookBase): @inputhook_manager.register('qt5') class Qt5InputHook(Qt4InputHook): def enable(self, app=None): - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) os.environ['QT_API'] = 'pyqt5' return Qt4InputHook.enable(self, app) @@ -458,10 +458,10 @@ class Qt5InputHook(Qt4InputHook): @inputhook_manager.register('gtk') class GtkInputHook(InputHookBase): def enable(self, app=None): - """DEPRECATED since IPython 5.0 - - Enable event loop integration with PyGTK. + """DEPRECATED since IPython 5.0 + Enable event loop integration with PyGTK. + Parameters ---------- app : ignored @@ -475,8 +475,8 @@ class GtkInputHook(InputHookBase): the PyGTK to integrate with terminal based applications like IPython. """ - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) import gtk try: gtk.set_interactive(True) @@ -489,10 +489,10 @@ class GtkInputHook(InputHookBase): @inputhook_manager.register('tk') class TkInputHook(InputHookBase): def enable(self, app=None): - """DEPRECATED since IPython 5.0 - - Enable event loop integration with Tk. + """DEPRECATED since IPython 5.0 + Enable event loop integration with Tk. + Parameters ---------- app : toplevel :class:`Tkinter.Tk` widget, optional. @@ -506,8 +506,8 @@ class TkInputHook(InputHookBase): :class:`InputHookManager`, since creating that object automatically sets ``PyOS_InputHook``. """ - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) if app is None: try: from tkinter import Tk # Py 3 @@ -522,10 +522,10 @@ class TkInputHook(InputHookBase): @inputhook_manager.register('glut') class GlutInputHook(InputHookBase): def enable(self, app=None): - """DEPRECATED since IPython 5.0 - - Enable event loop integration with GLUT. + """DEPRECATED since IPython 5.0 + Enable event loop integration with GLUT. + Parameters ---------- @@ -547,8 +547,8 @@ class GlutInputHook(InputHookBase): The default screen mode is set to: glut.GLUT_DOUBLE | glut.GLUT_RGBA | glut.GLUT_DEPTH """ - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) import OpenGL.GLUT as glut from IPython.lib.inputhookglut import glut_display_mode, \ @@ -576,16 +576,16 @@ class GlutInputHook(InputHookBase): def disable(self): - """DEPRECATED since IPython 5.0 - - Disable event loop integration with glut. + """DEPRECATED since IPython 5.0 + + Disable event loop integration with glut. This sets PyOS_InputHook to NULL and set the display function to a dummy one and set the timer to a dummy timer that will be triggered very far in the future. """ - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) import OpenGL.GLUT as glut from glut_support import glutMainLoopEvent @@ -596,10 +596,10 @@ class GlutInputHook(InputHookBase): @inputhook_manager.register('pyglet') class PygletInputHook(InputHookBase): def enable(self, app=None): - """DEPRECATED since IPython 5.0 - - Enable event loop integration with pyglet. + """DEPRECATED since IPython 5.0 + Enable event loop integration with pyglet. + Parameters ---------- app : ignored @@ -614,8 +614,8 @@ class PygletInputHook(InputHookBase): IPython. """ - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) from IPython.lib.inputhookpyglet import inputhook_pyglet self.manager.set_inputhook(inputhook_pyglet) return app @@ -624,10 +624,10 @@ class PygletInputHook(InputHookBase): @inputhook_manager.register('gtk3') class Gtk3InputHook(InputHookBase): def enable(self, app=None): - """DEPRECATED since IPython 5.0 - - Enable event loop integration with Gtk3 (gir bindings). + """DEPRECATED since IPython 5.0 + Enable event loop integration with Gtk3 (gir bindings). + Parameters ---------- app : ignored @@ -641,8 +641,8 @@ class Gtk3InputHook(InputHookBase): the Gtk3 to integrate with terminal based applications like IPython. """ - warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", + DeprecationWarning, stacklevel=2) from IPython.lib.inputhookgtk3 import inputhook_gtk3 self.manager.set_inputhook(inputhook_gtk3) diff --git a/contrib/python/ipython/py2/IPython/lib/latextools.py b/contrib/python/ipython/py2/IPython/lib/latextools.py index c3230dd489..5b3c93dc63 100644 --- a/contrib/python/ipython/py2/IPython/lib/latextools.py +++ b/contrib/python/ipython/py2/IPython/lib/latextools.py @@ -39,24 +39,24 @@ class LaTeXTool(SingletonConfigurable): # for display style, the default ["matplotlib", "dvipng"] can # be used. To NOT use dvipng so that other repr such as # unicode pretty printing is used, you can use ["matplotlib"]. - ).tag(config=True) + ).tag(config=True) use_breqn = Bool( True, help="Use breqn.sty to automatically break long equations. " "This configuration takes effect only for dvipng backend.", - ).tag(config=True) + ).tag(config=True) packages = List( ['amsmath', 'amsthm', 'amssymb', 'bm'], help="A list of packages to use for dvipng backend. " "'breqn' will be automatically appended when use_breqn=True.", - ).tag(config=True) + ).tag(config=True) preamble = Unicode( help="Additional preamble to use when generating LaTeX source " "for dvipng backend.", - ).tag(config=True) + ).tag(config=True) def latex_to_png(s, encode=False, backend=None, wrap=False): @@ -64,7 +64,7 @@ def latex_to_png(s, encode=False, backend=None, wrap=False): Parameters ---------- - s : str + s : str The raw string containing valid inline LaTeX. encode : bool, optional Should the PNG data base64 encoded to make it JSON'able. @@ -97,24 +97,24 @@ def latex_to_png(s, encode=False, backend=None, wrap=False): def latex_to_png_mpl(s, wrap): try: from matplotlib import mathtext - from pyparsing import ParseFatalException + from pyparsing import ParseFatalException except ImportError: return None - + # mpl mathtext doesn't support display math, force inline s = s.replace('$$', '$') if wrap: s = u'${0}$'.format(s) - try: - mt = mathtext.MathTextParser('bitmap') - f = BytesIO() - mt.to_png(f, s, fontsize=12) - return f.getvalue() - except (ValueError, RuntimeError, ParseFatalException): - return None - + try: + mt = mathtext.MathTextParser('bitmap') + f = BytesIO() + mt.to_png(f, s, fontsize=12) + return f.getvalue() + except (ValueError, RuntimeError, ParseFatalException): + return None + def latex_to_png_dvipng(s, wrap): try: find_cmd('latex') @@ -142,8 +142,8 @@ def latex_to_png_dvipng(s, wrap): with open(outfile, "rb") as f: return f.read() - except subprocess.CalledProcessError: - return None + except subprocess.CalledProcessError: + return None finally: shutil.rmtree(workdir) diff --git a/contrib/python/ipython/py2/IPython/lib/lexers.py b/contrib/python/ipython/py2/IPython/lib/lexers.py index 9160ae1245..1b81e3db61 100644 --- a/contrib/python/ipython/py2/IPython/lib/lexers.py +++ b/contrib/python/ipython/py2/IPython/lib/lexers.py @@ -44,7 +44,7 @@ from pygments.lexer import ( Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, using, ) from pygments.token import ( - Generic, Keyword, Literal, Name, Operator, Other, Text, Error, + Generic, Keyword, Literal, Name, Operator, Other, Text, Error, ) from pygments.util import get_bool_opt @@ -235,13 +235,13 @@ class IPythonConsoleLexer(Lexer): # The regexps used to determine what is input and what is output. # The default prompts for IPython are: # - # in = 'In [#]: ' - # continuation = ' .D.: ' - # template = 'Out[#]: ' - # - # Where '#' is the 'prompt number' or 'execution count' and 'D' - # D is a number of dots matching the width of the execution count + # in = 'In [#]: ' + # continuation = ' .D.: ' + # template = 'Out[#]: ' # + # Where '#' is the 'prompt number' or 'execution count' and 'D' + # D is a number of dots matching the width of the execution count + # in1_regex = r'In \[[0-9]+\]: ' in2_regex = r' \.\.+\.: ' out_regex = r'Out\[[0-9]+\]: ' @@ -475,9 +475,9 @@ class IPythonConsoleLexer(Lexer): self.insertions.append((len(self.buffer), [insertion])) self.buffer += code - for token in self.buffered_tokens(): - yield token - + for token in self.buffered_tokens(): + yield token + class IPyLexer(Lexer): """ Primary lexer for all IPython-like code. diff --git a/contrib/python/ipython/py2/IPython/lib/pretty.py b/contrib/python/ipython/py2/IPython/lib/pretty.py index 28eee523c5..09d638cbcb 100644 --- a/contrib/python/ipython/py2/IPython/lib/pretty.py +++ b/contrib/python/ipython/py2/IPython/lib/pretty.py @@ -85,7 +85,7 @@ import re import datetime from collections import deque -from IPython.utils.py3compat import PY3, PYPY, cast_unicode, string_types +from IPython.utils.py3compat import PY3, PYPY, cast_unicode, string_types from IPython.utils.encoding import get_stream_enc from io import StringIO @@ -609,8 +609,8 @@ def _dict_pprinter_factory(start, end): def inner(obj, p, cycle): if cycle: return p.text('{...}') - step = len(start) - p.begin_group(step, start) + step = len(start) + p.begin_group(step, start) keys = obj.keys() # if dict isn't large enough to be truncated, sort keys before displaying # From Python 3.7, dicts preserve order by definition, so we don't sort. @@ -624,7 +624,7 @@ def _dict_pprinter_factory(start, end): p.pretty(key) p.text(': ') p.pretty(obj[key]) - p.end_group(step, end) + p.end_group(step, end) return inner @@ -634,11 +634,11 @@ def _super_pprint(obj, p, cycle): p.pretty(obj.__thisclass__) p.text(',') p.breakable() - if PYPY: # In PyPy, super() objects don't have __self__ attributes - dself = obj.__repr__.__self__ - p.pretty(None if dself is obj else dself) - else: - p.pretty(obj.__self__) + if PYPY: # In PyPy, super() objects don't have __self__ attributes + dself = obj.__repr__.__self__ + p.pretty(None if dself is obj else dself) + else: + p.pretty(obj.__self__) p.end_group(8, '>') @@ -672,10 +672,10 @@ def _type_pprint(obj, p, cycle): # Heap allocated types might not have the module attribute, # and others may set it to None. - # Checks for a __repr__ override in the metaclass. Can't compare the - # type(obj).__repr__ directly because in PyPy the representation function - # inherited from type isn't the same type.__repr__ - if [m for m in _get_mro(type(obj)) if "__repr__" in vars(m)][:1] != [type]: + # Checks for a __repr__ override in the metaclass. Can't compare the + # type(obj).__repr__ directly because in PyPy the representation function + # inherited from type isn't the same type.__repr__ + if [m for m in _get_mro(type(obj)) if "__repr__" in vars(m)][:1] != [type]: _repr_pprint(obj, p, cycle) return @@ -762,15 +762,15 @@ _type_pprinters = { } try: - # In PyPy, types.DictProxyType is dict, setting the dictproxy printer - # using dict.setdefault avoids overwritting the dict printer - _type_pprinters.setdefault(types.DictProxyType, - _dict_pprinter_factory('dict_proxy({', '})')) + # In PyPy, types.DictProxyType is dict, setting the dictproxy printer + # using dict.setdefault avoids overwritting the dict printer + _type_pprinters.setdefault(types.DictProxyType, + _dict_pprinter_factory('dict_proxy({', '})')) _type_pprinters[types.ClassType] = _type_pprint _type_pprinters[types.SliceType] = _repr_pprint except AttributeError: # Python 3 - _type_pprinters[types.MappingProxyType] = \ - _dict_pprinter_factory('mappingproxy({', '})') + _type_pprinters[types.MappingProxyType] = \ + _dict_pprinter_factory('mappingproxy({', '})') _type_pprinters[slice] = _repr_pprint try: |