aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/ipython
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-10-14 09:57:42 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-10-14 10:17:49 +0300
commitf13bfc9a1e469983083b02e19cf963678ace66c0 (patch)
tree08bbf5b3ec11f1ce4aa614c451089b74caec35e2 /contrib/python/ipython
parent82c487106cdf6fa8ae9a18967e53de52fb52e4e8 (diff)
downloadydb-f13bfc9a1e469983083b02e19cf963678ace66c0.tar.gz
Update contrib/python/ipython/py3 to 8.16.0
Diffstat (limited to 'contrib/python/ipython')
-rw-r--r--contrib/python/ipython/py3/.dist-info/METADATA2
-rw-r--r--contrib/python/ipython/py3/IPython/core/debugger.py15
-rw-r--r--contrib/python/ipython/py3/IPython/core/displayhook.py17
-rw-r--r--contrib/python/ipython/py3/IPython/core/guarded_eval.py2
-rw-r--r--contrib/python/ipython/py3/IPython/core/magics/basic.py10
-rw-r--r--contrib/python/ipython/py3/IPython/core/release.py2
-rw-r--r--contrib/python/ipython/py3/IPython/display.py52
-rw-r--r--contrib/python/ipython/py3/IPython/terminal/embed.py6
-rw-r--r--contrib/python/ipython/py3/IPython/terminal/interactiveshell.py18
-rw-r--r--contrib/python/ipython/py3/IPython/terminal/ipapp.py5
-rw-r--r--contrib/python/ipython/py3/IPython/terminal/pt_inputhooks/__init__.py3
-rw-r--r--contrib/python/ipython/py3/IPython/utils/_sysinfo.py2
-rw-r--r--contrib/python/ipython/py3/ya.make2
13 files changed, 76 insertions, 60 deletions
diff --git a/contrib/python/ipython/py3/.dist-info/METADATA b/contrib/python/ipython/py3/.dist-info/METADATA
index 504e0953c2..3107f0547a 100644
--- a/contrib/python/ipython/py3/.dist-info/METADATA
+++ b/contrib/python/ipython/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: ipython
-Version: 8.15.0
+Version: 8.16.0
Summary: IPython: Productive Interactive Computing
Home-page: https://ipython.org
Author: The IPython Development Team
diff --git a/contrib/python/ipython/py3/IPython/core/debugger.py b/contrib/python/ipython/py3/IPython/core/debugger.py
index 30be9fc0d1..8e968548f8 100644
--- a/contrib/python/ipython/py3/IPython/core/debugger.py
+++ b/contrib/python/ipython/py3/IPython/core/debugger.py
@@ -419,7 +419,12 @@ class Pdb(OldPdb):
rep = repr(exc)
if len(rep) > 80:
rep = rep[:77] + "..."
- self.message(f"{prompt} {ix:>3} {rep}")
+ indicator = (
+ " -"
+ if self._chained_exceptions[ix].__traceback__ is None
+ else f"{ix:>3}"
+ )
+ self.message(f"{prompt} {indicator} {rep}")
else:
try:
number = int(arg)
@@ -427,6 +432,12 @@ class Pdb(OldPdb):
self.error("Argument must be an integer")
return
if 0 <= number < len(self._chained_exceptions):
+ if self._chained_exceptions[number].__traceback__ is None:
+ self.error(
+ "This exception does not have a traceback, cannot jump to it"
+ )
+ return
+
self._chained_exception_index = number
self.setup(None, self._chained_exceptions[number].__traceback__)
self.print_stack_entry(self.stack[self.curindex])
@@ -438,6 +449,8 @@ class Pdb(OldPdb):
if CHAIN_EXCEPTIONS:
# this context manager is part of interaction in 3.13
_chained_exceptions, tb = self._get_tb_and_exceptions(tb_or_exc)
+ if isinstance(tb_or_exc, BaseException):
+ assert tb is not None, "main exception must have a traceback"
with self._hold_exceptions(_chained_exceptions):
OldPdb.interaction(self, frame, tb)
else:
diff --git a/contrib/python/ipython/py3/IPython/core/displayhook.py b/contrib/python/ipython/py3/IPython/core/displayhook.py
index b411f11613..1ea8d8506f 100644
--- a/contrib/python/ipython/py3/IPython/core/displayhook.py
+++ b/contrib/python/ipython/py3/IPython/core/displayhook.py
@@ -51,7 +51,7 @@ class DisplayHook(Configurable):
# we need a reference to the user-level namespace
self.shell = shell
-
+
self._,self.__,self.___ = '','',''
# these are deliberately global:
@@ -83,15 +83,9 @@ class DisplayHook(Configurable):
def quiet(self):
"""Should we silence the display hook because of ';'?"""
- # do not print output if input ends in ';'
-
- try:
- cell = self.shell.history_manager.input_hist_parsed[-1]
- except IndexError:
- # some uses of ipshellembed may fail here
- return False
-
- return self.semicolon_at_end_of_expression(cell)
+ if self.exec_result is not None:
+ return self.semicolon_at_end_of_expression(self.exec_result.info.raw_cell)
+ return False
@staticmethod
def semicolon_at_end_of_expression(expression):
@@ -280,13 +274,12 @@ class DisplayHook(Configurable):
cull_count = max(int(sz * self.cull_fraction), 2)
warn('Output cache limit (currently {sz} entries) hit.\n'
'Flushing oldest {cull_count} entries.'.format(sz=sz, cull_count=cull_count))
-
+
for i, n in enumerate(sorted(oh)):
if i >= cull_count:
break
self.shell.user_ns.pop('_%i' % n, None)
oh.pop(n, None)
-
def flush(self):
if not self.do_full_cache:
diff --git a/contrib/python/ipython/py3/IPython/core/guarded_eval.py b/contrib/python/ipython/py3/IPython/core/guarded_eval.py
index d576a2a769..5d405b2208 100644
--- a/contrib/python/ipython/py3/IPython/core/guarded_eval.py
+++ b/contrib/python/ipython/py3/IPython/core/guarded_eval.py
@@ -444,7 +444,7 @@ def eval_node(node: Union[ast.AST, None], context: EvaluationContext):
- control flow:
- conditionals (``if x:``) except for ternary IfExp (``a if x else b``)
- - loops (``for`` and `while``)
+ - loops (``for`` and ``while``)
- exception handling
The purpose of this function is to guard against unwanted side-effects;
diff --git a/contrib/python/ipython/py3/IPython/core/magics/basic.py b/contrib/python/ipython/py3/IPython/core/magics/basic.py
index 54b0c2a4de..865e760eb1 100644
--- a/contrib/python/ipython/py3/IPython/core/magics/basic.py
+++ b/contrib/python/ipython/py3/IPython/core/magics/basic.py
@@ -122,7 +122,7 @@ class BasicMagics(Magics):
Created `%whereami` as an alias for `%pwd`.
In [6]: %whereami
- Out[6]: u'/home/testuser'
+ Out[6]: '/home/testuser'
In [7]: %alias_magic h history "-p -l 30" --line
Created `%h` as an alias for `%history -l 30`.
@@ -537,25 +537,25 @@ Currently the magic system has the following functions:""",
In [1]: from math import pi
In [2]: %precision 3
- Out[2]: u'%.3f'
+ Out[2]: '%.3f'
In [3]: pi
Out[3]: 3.142
In [4]: %precision %i
- Out[4]: u'%i'
+ Out[4]: '%i'
In [5]: pi
Out[5]: 3
In [6]: %precision %e
- Out[6]: u'%e'
+ Out[6]: '%e'
In [7]: pi**10
Out[7]: 9.364805e+04
In [8]: %precision
- Out[8]: u'%r'
+ Out[8]: '%r'
In [9]: pi**10
Out[9]: 93648.047476082982
diff --git a/contrib/python/ipython/py3/IPython/core/release.py b/contrib/python/ipython/py3/IPython/core/release.py
index a1df4d1058..4d0a244e40 100644
--- a/contrib/python/ipython/py3/IPython/core/release.py
+++ b/contrib/python/ipython/py3/IPython/core/release.py
@@ -16,7 +16,7 @@
# release. 'dev' as a _version_extra string means this is a development
# version
_version_major = 8
-_version_minor = 15
+_version_minor = 16
_version_patch = 0
_version_extra = ".dev"
# _version_extra = "rc1"
diff --git a/contrib/python/ipython/py3/IPython/display.py b/contrib/python/ipython/py3/IPython/display.py
index b7f64f25c9..3ccbc48604 100644
--- a/contrib/python/ipython/py3/IPython/display.py
+++ b/contrib/python/ipython/py3/IPython/display.py
@@ -14,31 +14,31 @@
from IPython.core.display_functions import *
from IPython.core.display import (
- display_pretty,
- display_html,
- display_markdown,
- display_svg,
- display_png,
- display_jpeg,
- display_latex,
- display_json,
- display_javascript,
- display_pdf,
- DisplayObject,
- TextDisplayObject,
- Pretty,
- HTML,
- Markdown,
- Math,
- Latex,
- SVG,
- ProgressBar,
- JSON,
- GeoJSON,
- Javascript,
- Image,
- set_matplotlib_formats,
- set_matplotlib_close,
- Video,
+ display_pretty as display_pretty,
+ display_html as display_html,
+ display_markdown as display_markdown,
+ display_svg as display_svg,
+ display_png as display_png,
+ display_jpeg as display_jpeg,
+ display_latex as display_latex,
+ display_json as display_json,
+ display_javascript as display_javascript,
+ display_pdf as display_pdf,
+ DisplayObject as DisplayObject,
+ TextDisplayObject as TextDisplayObject,
+ Pretty as Pretty,
+ HTML as HTML,
+ Markdown as Markdown,
+ Math as Math,
+ Latex as Latex,
+ SVG as SVG,
+ ProgressBar as ProgressBar,
+ JSON as JSON,
+ GeoJSON as GeoJSON,
+ Javascript as Javascript,
+ Image as Image,
+ set_matplotlib_formats as set_matplotlib_formats,
+ set_matplotlib_close as set_matplotlib_close,
+ Video as Video,
)
from IPython.lib.display import *
diff --git a/contrib/python/ipython/py3/IPython/terminal/embed.py b/contrib/python/ipython/py3/IPython/terminal/embed.py
index ce5ee01ff1..59fa610677 100644
--- a/contrib/python/ipython/py3/IPython/terminal/embed.py
+++ b/contrib/python/ipython/py3/IPython/terminal/embed.py
@@ -158,6 +158,12 @@ class InteractiveShellEmbed(TerminalInteractiveShell):
assert (
"user_global_ns" not in kw
), "Key word argument `user_global_ns` has been replaced by `user_module` since IPython 4.0."
+ # temporary fix for https://github.com/ipython/ipython/issues/14164
+ cls = type(self)
+ if cls._instance is None:
+ for subclass in cls._walk_mro():
+ subclass._instance = self
+ cls._instance = self
clid = kw.pop('_init_location_id', None)
if not clid:
diff --git a/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py b/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py
index 37e0b86981..9b63159dfa 100644
--- a/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py
+++ b/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py
@@ -4,7 +4,7 @@ import asyncio
import os
import sys
from warnings import warn
-from typing import Union as UnionType
+from typing import Union as UnionType, Optional
from IPython.core.async_helpers import get_asyncio_loop
from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
@@ -912,8 +912,9 @@ class TerminalInteractiveShell(InteractiveShell):
if self._inputhook is not None:
self._inputhook(context)
- active_eventloop = None
- def enable_gui(self, gui=None):
+ active_eventloop: Optional[str] = None
+
+ def enable_gui(self, gui: Optional[str] = None) -> None:
if self.simple_prompt is True and gui is not None:
print(
f'Cannot install event loop hook for "{gui}" when running with `--simple-prompt`.'
@@ -928,8 +929,15 @@ class TerminalInteractiveShell(InteractiveShell):
return
if self._inputhook is not None and gui is not None:
- print(
- f"Shell is already running a gui event loop for {self.active_eventloop}. "
+ newev, newinhook = get_inputhook_name_and_func(gui)
+ if self._inputhook == newinhook:
+ # same inputhook, do nothing
+ self.log.info(
+ f"Shell is already running the {self.active_eventloop} eventloop. Doing nothing"
+ )
+ return
+ self.log.warning(
+ f"Shell is already running a different gui event loop for {self.active_eventloop}. "
"Call with no arguments to disable the current loop."
)
return
diff --git a/contrib/python/ipython/py3/IPython/terminal/ipapp.py b/contrib/python/ipython/py3/IPython/terminal/ipapp.py
index 6280bce3b2..eed452c935 100644
--- a/contrib/python/ipython/py3/IPython/terminal/ipapp.py
+++ b/contrib/python/ipython/py3/IPython/terminal/ipapp.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# encoding: utf-8
"""
The :class:`~traitlets.config.application.Application` object for the command
@@ -337,7 +336,3 @@ def load_default_config(ipython_dir=None):
return app.config
launch_new_instance = TerminalIPythonApp.launch_instance
-
-
-if __name__ == '__main__':
- launch_new_instance()
diff --git a/contrib/python/ipython/py3/IPython/terminal/pt_inputhooks/__init__.py b/contrib/python/ipython/py3/IPython/terminal/pt_inputhooks/__init__.py
index 9043f15e86..22a681e249 100644
--- a/contrib/python/ipython/py3/IPython/terminal/pt_inputhooks/__init__.py
+++ b/contrib/python/ipython/py3/IPython/terminal/pt_inputhooks/__init__.py
@@ -1,5 +1,6 @@
import importlib
import os
+from typing import Tuple, Callable
aliases = {
'qt4': 'qt',
@@ -119,7 +120,7 @@ def set_qt_api(gui):
return qt_env2gui[QT_API]
-def get_inputhook_name_and_func(gui):
+def get_inputhook_name_and_func(gui: str) -> Tuple[str, Callable]:
if gui in registered:
return gui, registered[gui]
diff --git a/contrib/python/ipython/py3/IPython/utils/_sysinfo.py b/contrib/python/ipython/py3/IPython/utils/_sysinfo.py
index b3341865eb..c1310937d1 100644
--- a/contrib/python/ipython/py3/IPython/utils/_sysinfo.py
+++ b/contrib/python/ipython/py3/IPython/utils/_sysinfo.py
@@ -1,2 +1,2 @@
# GENERATED BY setup.py
-commit = "bc8b2d22f"
+commit = "a6c67bdf4"
diff --git a/contrib/python/ipython/py3/ya.make b/contrib/python/ipython/py3/ya.make
index b4eeb0a830..e8cca25a18 100644
--- a/contrib/python/ipython/py3/ya.make
+++ b/contrib/python/ipython/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(8.15.0)
+VERSION(8.16.0)
LICENSE(BSD-3-Clause)