aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-02-15 11:42:00 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-02-15 11:57:41 +0300
commit0de9b4a47867a2f539f7f5f02078bc353f6fb044 (patch)
treee60d2593309655d66f72d1a61ea42980313379ca
parent6ecbb0cbb39049f5c9166871ffd217e60d3494bf (diff)
downloadydb-0de9b4a47867a2f539f7f5f02078bc353f6fb044.tar.gz
Intermediate changes
-rw-r--r--contrib/python/ipython/py3/.dist-info/METADATA10
-rw-r--r--contrib/python/ipython/py3/IPython/core/alias.py24
-rw-r--r--contrib/python/ipython/py3/IPython/core/application.py4
-rw-r--r--contrib/python/ipython/py3/IPython/core/debugger.py7
-rw-r--r--contrib/python/ipython/py3/IPython/core/excolors.py226
-rw-r--r--contrib/python/ipython/py3/IPython/core/extensions.py26
-rw-r--r--contrib/python/ipython/py3/IPython/core/oinspect.py39
-rw-r--r--contrib/python/ipython/py3/IPython/core/payload.py3
-rw-r--r--contrib/python/ipython/py3/IPython/core/profileapp.py2
-rw-r--r--contrib/python/ipython/py3/IPython/core/release.py2
-rw-r--r--contrib/python/ipython/py3/IPython/core/ultratb.py15
-rw-r--r--contrib/python/ipython/py3/IPython/terminal/ipapp.py8
-rw-r--r--contrib/python/ipython/py3/IPython/terminal/prompts.py5
-rw-r--r--contrib/python/ipython/py3/IPython/testing/ipunittest.py10
-rw-r--r--contrib/python/ipython/py3/IPython/testing/plugin/pytest_ipdoctest.py42
-rw-r--r--contrib/python/ipython/py3/IPython/utils/_process_posix.py7
-rw-r--r--contrib/python/ipython/py3/IPython/utils/_sysinfo.py2
-rw-r--r--contrib/python/ipython/py3/IPython/utils/coloransi.py46
-rw-r--r--contrib/python/ipython/py3/ya.make2
-rw-r--r--yt/yt/library/profiling/impl.h2
-rw-r--r--yt/yt/library/profiling/public.h1
-rw-r--r--yt/yt/library/profiling/sensor.cpp17
-rw-r--r--yt/yt/library/profiling/sensor.h3
-rw-r--r--yt/yt/library/profiling/solomon/registry.cpp2
-rw-r--r--yt/yt/library/profiling/solomon/registry.h2
-rw-r--r--yt/yt/library/profiling/solomon/sensor.h2
26 files changed, 294 insertions, 215 deletions
diff --git a/contrib/python/ipython/py3/.dist-info/METADATA b/contrib/python/ipython/py3/.dist-info/METADATA
index 3a45cc6c3a..5efeded1e1 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.20.0
+Version: 8.21.0
Summary: IPython: Productive Interactive Computing
Home-page: https://ipython.org
Author: The IPython Development Team
@@ -46,9 +46,9 @@ Requires-Dist: sphinx-rtd-theme ; extra == 'all'
Requires-Dist: docrepr ; extra == 'all'
Requires-Dist: matplotlib ; extra == 'all'
Requires-Dist: stack-data ; extra == 'all'
-Requires-Dist: pytest ; extra == 'all'
Requires-Dist: typing-extensions ; extra == 'all'
Requires-Dist: exceptiongroup ; extra == 'all'
+Requires-Dist: pytest <8 ; extra == 'all'
Requires-Dist: pytest-asyncio <0.22 ; extra == 'all'
Requires-Dist: testpath ; extra == 'all'
Requires-Dist: pickleshare ; extra == 'all'
@@ -73,9 +73,9 @@ Requires-Dist: sphinx-rtd-theme ; extra == 'doc'
Requires-Dist: docrepr ; extra == 'doc'
Requires-Dist: matplotlib ; extra == 'doc'
Requires-Dist: stack-data ; extra == 'doc'
-Requires-Dist: pytest ; extra == 'doc'
Requires-Dist: typing-extensions ; extra == 'doc'
Requires-Dist: exceptiongroup ; extra == 'doc'
+Requires-Dist: pytest <8 ; extra == 'doc'
Requires-Dist: pytest-asyncio <0.22 ; extra == 'doc'
Requires-Dist: testpath ; extra == 'doc'
Requires-Dist: pickleshare ; extra == 'doc'
@@ -94,12 +94,12 @@ Provides-Extra: qtconsole
Requires-Dist: qtconsole ; extra == 'qtconsole'
Provides-Extra: terminal
Provides-Extra: test
-Requires-Dist: pytest ; extra == 'test'
+Requires-Dist: pytest <8 ; extra == 'test'
Requires-Dist: pytest-asyncio <0.22 ; extra == 'test'
Requires-Dist: testpath ; extra == 'test'
Requires-Dist: pickleshare ; extra == 'test'
Provides-Extra: test_extra
-Requires-Dist: pytest ; extra == 'test_extra'
+Requires-Dist: pytest <8 ; extra == 'test_extra'
Requires-Dist: pytest-asyncio <0.22 ; extra == 'test_extra'
Requires-Dist: testpath ; extra == 'test_extra'
Requires-Dist: pickleshare ; extra == 'test_extra'
diff --git a/contrib/python/ipython/py3/IPython/core/alias.py b/contrib/python/ipython/py3/IPython/core/alias.py
index 2ad990231a..52843b3d77 100644
--- a/contrib/python/ipython/py3/IPython/core/alias.py
+++ b/contrib/python/ipython/py3/IPython/core/alias.py
@@ -190,22 +190,28 @@ class Alias(object):
#-----------------------------------------------------------------------------
class AliasManager(Configurable):
-
- default_aliases = List(default_aliases()).tag(config=True)
- user_aliases = List(default_value=[]).tag(config=True)
- shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
+ default_aliases: List = List(default_aliases()).tag(config=True)
+ user_aliases: List = List(default_value=[]).tag(config=True)
+ shell = Instance(
+ "IPython.core.interactiveshell.InteractiveShellABC", allow_none=True
+ )
def __init__(self, shell=None, **kwargs):
super(AliasManager, self).__init__(shell=shell, **kwargs)
# For convenient access
- self.linemagics = self.shell.magics_manager.magics['line']
- self.init_aliases()
+ if self.shell is not None:
+ self.linemagics = self.shell.magics_manager.magics["line"]
+ self.init_aliases()
def init_aliases(self):
# Load default & user aliases
for name, cmd in self.default_aliases + self.user_aliases:
- if cmd.startswith('ls ') and self.shell.colors == 'NoColor':
- cmd = cmd.replace(' --color', '')
+ if (
+ cmd.startswith("ls ")
+ and self.shell is not None
+ and self.shell.colors == "NoColor"
+ ):
+ cmd = cmd.replace(" --color", "")
self.soft_define_alias(name, cmd)
@property
@@ -246,7 +252,7 @@ class AliasManager(Configurable):
raise ValueError('%s is not an alias' % name)
def clear_aliases(self):
- for name, cmd in self.aliases:
+ for name, _ in self.aliases:
self.undefine_alias(name)
def retrieve_alias(self, name):
diff --git a/contrib/python/ipython/py3/IPython/core/application.py b/contrib/python/ipython/py3/IPython/core/application.py
index e0a8174f15..841e867a74 100644
--- a/contrib/python/ipython/py3/IPython/core/application.py
+++ b/contrib/python/ipython/py3/IPython/core/application.py
@@ -213,7 +213,9 @@ class BaseIPythonApplication(Application):
return d
_in_init_profile_dir = False
+
profile_dir = Instance(ProfileDir, allow_none=True)
+
@default('profile_dir')
def _profile_dir_default(self):
# avoid recursion
@@ -226,11 +228,13 @@ class BaseIPythonApplication(Application):
overwrite = Bool(False,
help="""Whether to overwrite existing config files when copying"""
).tag(config=True)
+
auto_create = Bool(False,
help="""Whether to create profile dir if it doesn't exist"""
).tag(config=True)
config_files = List(Unicode())
+
@default('config_files')
def _config_files_default(self):
return [self.config_file_name]
diff --git a/contrib/python/ipython/py3/IPython/core/debugger.py b/contrib/python/ipython/py3/IPython/core/debugger.py
index f370070140..b409416ece 100644
--- a/contrib/python/ipython/py3/IPython/core/debugger.py
+++ b/contrib/python/ipython/py3/IPython/core/debugger.py
@@ -1111,10 +1111,13 @@ class InterruptiblePdb(Pdb):
raise
-def set_trace(frame=None):
+def set_trace(frame=None, header=None):
"""
Start debugging from `frame`.
If frame is not specified, debugging starts from caller's frame.
"""
- Pdb().set_trace(frame or sys._getframe().f_back)
+ pdb = Pdb()
+ if header is not None:
+ pdb.message(header)
+ pdb.set_trace(frame or sys._getframe().f_back)
diff --git a/contrib/python/ipython/py3/IPython/core/excolors.py b/contrib/python/ipython/py3/IPython/core/excolors.py
index 85eef81f0e..5b7bcf6c09 100644
--- a/contrib/python/ipython/py3/IPython/core/excolors.py
+++ b/contrib/python/ipython/py3/IPython/core/excolors.py
@@ -42,118 +42,128 @@ def exception_colors():
ex_colors = ColorSchemeTable()
# Populate it with color schemes
- C = TermColors # shorthand and local lookup
- ex_colors.add_scheme(ColorScheme(
- 'NoColor',
- # The color to be used for the top line
- topline = C.NoColor,
-
- # The colors to be used in the traceback
- filename = C.NoColor,
- lineno = C.NoColor,
- name = C.NoColor,
- vName = C.NoColor,
- val = C.NoColor,
- em = C.NoColor,
-
- # Emphasized colors for the last frame of the traceback
- normalEm = C.NoColor,
- filenameEm = C.NoColor,
- linenoEm = C.NoColor,
- nameEm = C.NoColor,
- valEm = C.NoColor,
-
- # Colors for printing the exception
- excName = C.NoColor,
- line = C.NoColor,
- caret = C.NoColor,
- Normal = C.NoColor
- ))
+ C = TermColors # shorthand and local lookup
+ ex_colors.add_scheme(
+ ColorScheme(
+ "NoColor",
+ {
+ # The color to be used for the top line
+ "topline": C.NoColor,
+
+ # The colors to be used in the traceback
+ "filename": C.NoColor,
+ "lineno": C.NoColor,
+ "name": C.NoColor,
+ "vName": C.NoColor,
+ "val": C.NoColor,
+ "em": C.NoColor,
+
+ # Emphasized colors for the last frame of the traceback
+ "normalEm": C.NoColor,
+ "filenameEm": C.NoColor,
+ "linenoEm": C.NoColor,
+ "nameEm": C.NoColor,
+ "valEm": C.NoColor,
+
+ # Colors for printing the exception
+ "excName": C.NoColor,
+ "line": C.NoColor,
+ "caret": C.NoColor,
+ "Normal": C.NoColor,
+ },
+ )
+ )
# make some schemes as instances so we can copy them for modification easily
- ex_colors.add_scheme(ColorScheme(
- 'Linux',
- # The color to be used for the top line
- topline = C.LightRed,
-
- # The colors to be used in the traceback
- filename = C.Green,
- lineno = C.Green,
- name = C.Purple,
- vName = C.Cyan,
- val = C.Green,
- em = C.LightCyan,
-
- # Emphasized colors for the last frame of the traceback
- normalEm = C.LightCyan,
- filenameEm = C.LightGreen,
- linenoEm = C.LightGreen,
- nameEm = C.LightPurple,
- valEm = C.LightBlue,
-
- # Colors for printing the exception
- excName = C.LightRed,
- line = C.Yellow,
- caret = C.White,
- Normal = C.Normal
- ))
+ ex_colors.add_scheme(
+ ColorScheme(
+ "Linux",
+ {
+ # The color to be used for the top line
+ "topline": C.LightRed,
+ # The colors to be used in the traceback
+ "filename": C.Green,
+ "lineno": C.Green,
+ "name": C.Purple,
+ "vName": C.Cyan,
+ "val": C.Green,
+ "em": C.LightCyan,
+ # Emphasized colors for the last frame of the traceback
+ "normalEm": C.LightCyan,
+ "filenameEm": C.LightGreen,
+ "linenoEm": C.LightGreen,
+ "nameEm": C.LightPurple,
+ "valEm": C.LightBlue,
+ # Colors for printing the exception
+ "excName": C.LightRed,
+ "line": C.Yellow,
+ "caret": C.White,
+ "Normal": C.Normal,
+ },
+ )
+ )
# For light backgrounds, swap dark/light colors
- ex_colors.add_scheme(ColorScheme(
- 'LightBG',
- # The color to be used for the top line
- topline = C.Red,
-
- # The colors to be used in the traceback
- filename = C.LightGreen,
- lineno = C.LightGreen,
- name = C.LightPurple,
- vName = C.Cyan,
- val = C.LightGreen,
- em = C.Cyan,
-
- # Emphasized colors for the last frame of the traceback
- normalEm = C.Cyan,
- filenameEm = C.Green,
- linenoEm = C.Green,
- nameEm = C.Purple,
- valEm = C.Blue,
-
- # Colors for printing the exception
- excName = C.Red,
- #line = C.Brown, # brown often is displayed as yellow
- line = C.Red,
- caret = C.Normal,
- Normal = C.Normal,
- ))
-
- ex_colors.add_scheme(ColorScheme(
- 'Neutral',
- # The color to be used for the top line
- topline = C.Red,
-
- # The colors to be used in the traceback
- filename = C.LightGreen,
- lineno = C.LightGreen,
- name = C.LightPurple,
- vName = C.Cyan,
- val = C.LightGreen,
- em = C.Cyan,
-
- # Emphasized colors for the last frame of the traceback
- normalEm = C.Cyan,
- filenameEm = C.Green,
- linenoEm = C.Green,
- nameEm = C.Purple,
- valEm = C.Blue,
-
- # Colors for printing the exception
- excName = C.Red,
- #line = C.Brown, # brown often is displayed as yellow
- line = C.Red,
- caret = C.Normal,
- Normal = C.Normal,
- ))
+ ex_colors.add_scheme(
+ ColorScheme(
+ "LightBG",
+ {
+ # The color to be used for the top line
+ "topline": C.Red,
+
+ # The colors to be used in the traceback
+ "filename": C.LightGreen,
+ "lineno": C.LightGreen,
+ "name": C.LightPurple,
+ "vName": C.Cyan,
+ "val": C.LightGreen,
+ "em": C.Cyan,
+
+ # Emphasized colors for the last frame of the traceback
+ "normalEm": C.Cyan,
+ "filenameEm": C.Green,
+ "linenoEm": C.Green,
+ "nameEm": C.Purple,
+ "valEm": C.Blue,
+
+ # Colors for printing the exception
+ "excName": C.Red,
+ # "line": C.Brown, # brown often is displayed as yellow
+ "line": C.Red,
+ "caret": C.Normal,
+ "Normal": C.Normal,
+ },
+ )
+ )
+
+ ex_colors.add_scheme(
+ ColorScheme(
+ "Neutral",
+ {
+ # The color to be used for the top line
+ "topline": C.Red,
+ # The colors to be used in the traceback
+ "filename": C.LightGreen,
+ "lineno": C.LightGreen,
+ "name": C.LightPurple,
+ "vName": C.Cyan,
+ "val": C.LightGreen,
+ "em": C.Cyan,
+ # Emphasized colors for the last frame of the traceback
+ "normalEm": C.Cyan,
+ "filenameEm": C.Green,
+ "linenoEm": C.Green,
+ "nameEm": C.Purple,
+ "valEm": C.Blue,
+ # Colors for printing the exception
+ "excName": C.Red,
+ # line = C.Brown, # brown often is displayed as yellow
+ "line": C.Red,
+ "caret": C.Normal,
+ "Normal": C.Normal,
+ },
+ )
+ )
# Hack: the 'neutral' colours are not very visible on a dark background on
# Windows. Since Windows command prompts have a dark background by default, and
diff --git a/contrib/python/ipython/py3/IPython/core/extensions.py b/contrib/python/ipython/py3/IPython/core/extensions.py
index 21fba40eaf..27c6a4116d 100644
--- a/contrib/python/ipython/py3/IPython/core/extensions.py
+++ b/contrib/python/ipython/py3/IPython/core/extensions.py
@@ -10,8 +10,7 @@ import sys
from importlib import import_module, reload
from traitlets.config.configurable import Configurable
-from IPython.utils.path import ensure_dir_exists, compress_user
-from IPython.utils.decorators import undoc
+from IPython.utils.path import ensure_dir_exists
from traitlets import Instance
@@ -36,35 +35,22 @@ class ExtensionManager(Configurable):
the only argument. You can do anything you want with IPython at
that point, including defining new magic and aliases, adding new
components, etc.
-
+
You can also optionally define an :func:`unload_ipython_extension(ipython)`
function, which will be called if the user unloads or reloads the extension.
The extension manager will only call :func:`load_ipython_extension` again
if the extension is reloaded.
You can put your extension modules anywhere you want, as long as
- they can be imported by Python's standard import mechanism. However,
- to make it easy to write extensions, you can also put your extensions
- in ``os.path.join(self.ipython_dir, 'extensions')``. This directory
- is added to ``sys.path`` automatically.
+ they can be imported by Python's standard import mechanism.
"""
shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
def __init__(self, shell=None, **kwargs):
super(ExtensionManager, self).__init__(shell=shell, **kwargs)
- self.shell.observe(
- self._on_ipython_dir_changed, names=('ipython_dir',)
- )
self.loaded = set()
- @property
- def ipython_extension_dir(self):
- return os.path.join(self.shell.ipython_dir, u'extensions')
-
- def _on_ipython_dir_changed(self, change):
- ensure_dir_exists(self.ipython_extension_dir)
-
def load_extension(self, module_str: str):
"""Load an IPython extension by its module name.
@@ -84,7 +70,7 @@ class ExtensionManager(Configurable):
if module_str in self.loaded:
return "already loaded"
- from IPython.utils.syspathcontext import prepended_to_syspath
+ assert self.shell is not None
with self.shell.builtin_trap:
if module_str not in sys.modules:
@@ -125,7 +111,6 @@ class ExtensionManager(Configurable):
:func:`reload` is called and then the :func:`load_ipython_extension`
function of the module, if it exists is called.
"""
- from IPython.utils.syspathcontext import prepended_to_syspath
if BUILTINS_EXTS.get(module_str, False) is True:
module_str = "IPython.extensions." + module_str
@@ -133,8 +118,7 @@ class ExtensionManager(Configurable):
if (module_str in self.loaded) and (module_str in sys.modules):
self.unload_extension(module_str)
mod = sys.modules[module_str]
- with prepended_to_syspath(self.ipython_extension_dir):
- reload(mod)
+ reload(mod)
if self._call_load_ipython_extension(mod):
self.loaded.add(module_str)
else:
diff --git a/contrib/python/ipython/py3/IPython/core/oinspect.py b/contrib/python/ipython/py3/IPython/core/oinspect.py
index a8be281975..9eecf290ae 100644
--- a/contrib/python/ipython/py3/IPython/core/oinspect.py
+++ b/contrib/python/ipython/py3/IPython/core/oinspect.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""Tools for inspecting Python objects.
Uses syntax highlighting for presenting the various information elements.
@@ -22,7 +21,6 @@ import inspect
import io as stdlib_io
import linecache
import os
-import sys
import types
import warnings
@@ -30,6 +28,8 @@ from typing import Any, Optional, Dict, Union, List, Tuple
from typing import TypeAlias
+import traitlets
+
# IPython's own
from IPython.core import page
from IPython.lib.pretty import pretty
@@ -41,7 +41,7 @@ from IPython.utils.path import compress_user
from IPython.utils.text import indent
from IPython.utils.wildcard import list_namespace
from IPython.utils.wildcard import typestr2type
-from IPython.utils.coloransi import TermColors, ColorScheme, ColorSchemeTable
+from IPython.utils.coloransi import TermColors
from IPython.utils.py3compat import cast_unicode
from IPython.utils.colorable import Colorable
from IPython.utils.decorators import undoc
@@ -145,7 +145,7 @@ def get_encoding(obj):
# getsourcelines returns lineno with 1-offset and page() uses
# 0-offset, so we must adjust.
with stdlib_io.open(ofile, 'rb') as buffer: # Tweaked to use io.open for Python 2
- encoding, lines = openpy.detect_encoding(buffer.readline)
+ encoding, _lines = openpy.detect_encoding(buffer.readline)
return encoding
def getdoc(obj) -> Union[str,None]:
@@ -328,7 +328,7 @@ def _get_wrapped(obj):
return orig_obj
return obj
-def find_file(obj) -> str:
+def find_file(obj) -> Optional[str]:
"""Find the absolute path to the file where an object was defined.
This is essentially a robust wrapper around `inspect.getabsfile`.
@@ -346,7 +346,7 @@ def find_file(obj) -> str:
"""
obj = _get_wrapped(obj)
- fname = None
+ fname: Optional[str] = None
try:
fname = inspect.getabsfile(obj)
except TypeError:
@@ -360,7 +360,7 @@ def find_file(obj) -> str:
except OSError:
pass
- return cast_unicode(fname)
+ return fname
def find_source_lines(obj):
@@ -396,11 +396,20 @@ def find_source_lines(obj):
class Inspector(Colorable):
- def __init__(self, color_table=InspectColors,
- code_color_table=PyColorize.ANSICodeColors,
- scheme=None,
- str_detail_level=0,
- parent=None, config=None):
+ mime_hooks = traitlets.Dict(
+ config=True,
+ help="dictionary of mime to callable to add informations into help mimebundle dict",
+ ).tag(config=True)
+
+ def __init__(
+ self,
+ color_table=InspectColors,
+ code_color_table=PyColorize.ANSICodeColors,
+ scheme=None,
+ str_detail_level=0,
+ parent=None,
+ config=None,
+ ):
super(Inspector, self).__init__(parent=parent, config=config)
self.color_table = color_table
self.parser = PyColorize.Parser(out='str', parent=self, style=scheme)
@@ -625,7 +634,7 @@ class Inspector(Colorable):
if k in ("text/html", "text/plain"):
continue
else:
- new_b = bundle[k] # type:ignore
+ new_b[k] = bundle[k] # type:ignore
return new_b
def _append_info_field(
@@ -759,6 +768,10 @@ class Inspector(Colorable):
detail_level=detail_level,
omit_sections=omit_sections,
)
+ for key, hook in self.mime_hooks.items():
+ res = hook(obj, info)
+ if res is not None:
+ bundle[key] = res
return self.format_mime(bundle)
def pinfo(
diff --git a/contrib/python/ipython/py3/IPython/core/payload.py b/contrib/python/ipython/py3/IPython/core/payload.py
index 6818be1537..28eb7c80d3 100644
--- a/contrib/python/ipython/py3/IPython/core/payload.py
+++ b/contrib/python/ipython/py3/IPython/core/payload.py
@@ -26,8 +26,7 @@ from traitlets import List
#-----------------------------------------------------------------------------
class PayloadManager(Configurable):
-
- _payload = List([])
+ _payload: List = List([])
def write_payload(self, data, single=True):
"""Include or update the specified `data` payload in the PayloadManager.
diff --git a/contrib/python/ipython/py3/IPython/core/profileapp.py b/contrib/python/ipython/py3/IPython/core/profileapp.py
index 9a1bae55ac..94cc0352e8 100644
--- a/contrib/python/ipython/py3/IPython/core/profileapp.py
+++ b/contrib/python/ipython/py3/IPython/core/profileapp.py
@@ -209,7 +209,7 @@ class ProfileCreate(BaseIPythonApplication):
name = u'ipython-profile'
description = create_help
examples = _create_examples
- auto_create = Bool(True)
+ auto_create = Bool(True).tag(config=True)
def _log_format_default(self):
return "[%(name)s] %(message)s"
diff --git a/contrib/python/ipython/py3/IPython/core/release.py b/contrib/python/ipython/py3/IPython/core/release.py
index ec50c45721..f71ee85c08 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 = 20
+_version_minor = 21
_version_patch = 0
_version_extra = ".dev"
# _version_extra = "rc1"
diff --git a/contrib/python/ipython/py3/IPython/core/ultratb.py b/contrib/python/ipython/py3/IPython/core/ultratb.py
index cb0d8f951f..b0f9e08a3d 100644
--- a/contrib/python/ipython/py3/IPython/core/ultratb.py
+++ b/contrib/python/ipython/py3/IPython/core/ultratb.py
@@ -789,7 +789,20 @@ class FrameInfo:
@property
def lines(self):
- return self._sd.lines
+ from executing.executing import NotOneValueFound
+
+ try:
+ return self._sd.lines
+ except NotOneValueFound:
+
+ class Dummy:
+ lineno = 0
+ is_current = False
+
+ def render(self, *, pygmented):
+ return "<Error retrieving source code with stack_data see ipython/ipython#13598>"
+
+ return [Dummy()]
@property
def executing(self):
diff --git a/contrib/python/ipython/py3/IPython/terminal/ipapp.py b/contrib/python/ipython/py3/IPython/terminal/ipapp.py
index eed452c935..55ff1da391 100644
--- a/contrib/python/ipython/py3/IPython/terminal/ipapp.py
+++ b/contrib/python/ipython/py3/IPython/terminal/ipapp.py
@@ -177,7 +177,7 @@ class LocateIPythonApp(BaseIPythonApplication):
class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):
- name = u'ipython'
+ name = "ipython"
description = usage.cl_usage
crash_handler_class = IPAppCrashHandler # typing: ignore[assignment]
examples = _examples
@@ -196,7 +196,7 @@ class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):
def _classes_default(self):
"""This has to be in a method, for TerminalIPythonApp to be available."""
return [
- InteractiveShellApp, # ShellApp comes before TerminalApp, because
+ InteractiveShellApp, # ShellApp comes before TerminalApp, because
self.__class__, # it will also affect subclasses (e.g. QtConsole)
TerminalInteractiveShell,
HistoryManager,
@@ -224,9 +224,9 @@ class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):
),
)
-
# *do* autocreate requested profile, but don't create the config file.
- auto_create=Bool(True)
+ auto_create = Bool(True).tag(config=True)
+
# configurables
quick = Bool(False,
help="""Start IPython quickly by skipping the loading of config files."""
diff --git a/contrib/python/ipython/py3/IPython/terminal/prompts.py b/contrib/python/ipython/py3/IPython/terminal/prompts.py
index ca56d91a40..40a10511d9 100644
--- a/contrib/python/ipython/py3/IPython/terminal/prompts.py
+++ b/contrib/python/ipython/py3/IPython/terminal/prompts.py
@@ -103,8 +103,8 @@ class RichPromptDisplayHook(DisplayHook):
if self.do_full_cache:
tokens = self.shell.prompts.out_prompt_tokens()
- prompt_txt = ''.join(s for t, s in tokens)
- if prompt_txt and not prompt_txt.endswith('\n'):
+ prompt_txt = "".join(s for _, s in tokens)
+ if prompt_txt and not prompt_txt.endswith("\n"):
# Ask for a newline before multiline output
self.prompt_end_newline = False
@@ -116,6 +116,7 @@ class RichPromptDisplayHook(DisplayHook):
sys.stdout.write(prompt_txt)
def write_format_data(self, format_dict, md_dict=None) -> None:
+ assert self.shell is not None
if self.shell.mime_renderers:
for mime, handler in self.shell.mime_renderers.items():
diff --git a/contrib/python/ipython/py3/IPython/testing/ipunittest.py b/contrib/python/ipython/py3/IPython/testing/ipunittest.py
index 5a940a5fe9..4b107618b5 100644
--- a/contrib/python/ipython/py3/IPython/testing/ipunittest.py
+++ b/contrib/python/ipython/py3/IPython/testing/ipunittest.py
@@ -36,6 +36,7 @@ Authors
# Stdlib
import re
+import sys
import unittest
from doctest import DocTestFinder, DocTestRunner, TestResults
from IPython.terminal.interactiveshell import InteractiveShell
@@ -49,7 +50,14 @@ def count_failures(runner):
Code modeled after the summarize() method in doctest.
"""
- return [TestResults(f, t) for f, t in runner._name2ft.values() if f > 0 ]
+ if sys.version_info < (3, 13):
+ return [TestResults(f, t) for f, t in runner._name2ft.values() if f > 0]
+ else:
+ return [
+ TestResults(failure, try_)
+ for failure, try_, skip in runner._stats.values()
+ if failure > 0
+ ]
class IPython2PythonConverter(object):
diff --git a/contrib/python/ipython/py3/IPython/testing/plugin/pytest_ipdoctest.py b/contrib/python/ipython/py3/IPython/testing/plugin/pytest_ipdoctest.py
index fd19ba4966..fc8af13b57 100644
--- a/contrib/python/ipython/py3/IPython/testing/plugin/pytest_ipdoctest.py
+++ b/contrib/python/ipython/py3/IPython/testing/plugin/pytest_ipdoctest.py
@@ -4,8 +4,8 @@
#
# Copyright (c) 2004-2021 Holger Krekel and others
"""Discover and run ipdoctests in modules and test files."""
-import builtins
import bdb
+import builtins
import inspect
import os
import platform
@@ -15,25 +15,25 @@ import types
import warnings
from contextlib import contextmanager
from pathlib import Path
-from typing import Any
-from typing import Callable
-from typing import Dict
-from typing import Generator
-from typing import Iterable
-from typing import List
-from typing import Optional
-from typing import Pattern
-from typing import Sequence
-from typing import Tuple
-from typing import Type
-from typing import TYPE_CHECKING
-from typing import Union
+from typing import (
+ TYPE_CHECKING,
+ Any,
+ Callable,
+ Dict,
+ Generator,
+ Iterable,
+ List,
+ Optional,
+ Pattern,
+ Sequence,
+ Tuple,
+ Type,
+ Union,
+)
import pytest
from _pytest import outcomes
-from _pytest._code.code import ExceptionInfo
-from _pytest._code.code import ReprFileLocation
-from _pytest._code.code import TerminalRepr
+from _pytest._code.code import ExceptionInfo, ReprFileLocation, TerminalRepr
from _pytest._io import TerminalWriter
from _pytest.compat import safe_getattr
from _pytest.config import Config
@@ -41,14 +41,15 @@ from _pytest.config.argparsing import Parser
from _pytest.fixtures import FixtureRequest
from _pytest.nodes import Collector
from _pytest.outcomes import OutcomeException
-from _pytest.pathlib import fnmatch_ex
-from _pytest.pathlib import import_path
+from _pytest.pathlib import fnmatch_ex, import_path
from _pytest.python_api import approx
from _pytest.warning_types import PytestWarning
if TYPE_CHECKING:
import doctest
+ from .ipdoctest import IPDoctestOutputChecker
+
DOCTEST_REPORT_CHOICE_NONE = "none"
DOCTEST_REPORT_CHOICE_CDIFF = "cdiff"
DOCTEST_REPORT_CHOICE_NDIFF = "ndiff"
@@ -271,6 +272,8 @@ def _get_runner(
class IPDoctestItem(pytest.Item):
+ _user_ns_orig: Dict[str, Any]
+
def __init__(
self,
name: str,
@@ -283,6 +286,7 @@ class IPDoctestItem(pytest.Item):
self.dtest = dtest
self.obj = None
self.fixture_request: Optional[FixtureRequest] = None
+ self._user_ns_orig = {}
@classmethod
def from_parent( # type: ignore
diff --git a/contrib/python/ipython/py3/IPython/utils/_process_posix.py b/contrib/python/ipython/py3/IPython/utils/_process_posix.py
index 59b5c23896..a429ba105a 100644
--- a/contrib/python/ipython/py3/IPython/utils/_process_posix.py
+++ b/contrib/python/ipython/py3/IPython/utils/_process_posix.py
@@ -20,8 +20,6 @@ import os
import subprocess as sp
import sys
-import pexpect
-
# Our own
from ._process_common import getoutput, arg_split
from IPython.utils.encoding import DEFAULT_ENCODING
@@ -51,6 +49,7 @@ class ProcessHandler(object):
@property
def sh(self):
if self._sh is None:
+ import pexpect
shell_name = os.environ.get("SHELL", "sh")
self._sh = pexpect.which(shell_name)
if self._sh is None:
@@ -83,6 +82,7 @@ class ProcessHandler(object):
file descriptors (so the order of the information in this string is the
correct order as would be seen if running the command in a terminal).
"""
+ import pexpect
try:
return pexpect.run(self.sh, args=['-c', cmd]).replace('\r\n', '\n')
except KeyboardInterrupt:
@@ -104,6 +104,7 @@ class ProcessHandler(object):
file descriptors (so the order of the information in this string is the
correct order as would be seen if running the command in a terminal).
"""
+ import pexpect
try:
return pexpect.run(self.sh, args=['-c', cmd]).replace('\r\n', '\n')
except KeyboardInterrupt:
@@ -121,6 +122,8 @@ class ProcessHandler(object):
-------
int : child's exitstatus
"""
+ import pexpect
+
# Get likely encoding for the output.
enc = DEFAULT_ENCODING
diff --git a/contrib/python/ipython/py3/IPython/utils/_sysinfo.py b/contrib/python/ipython/py3/IPython/utils/_sysinfo.py
index 461aae5256..56568073d7 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 = "19f24dd8e"
+commit = "8b1204b6c"
diff --git a/contrib/python/ipython/py3/IPython/utils/coloransi.py b/contrib/python/ipython/py3/IPython/utils/coloransi.py
index 9300b01085..a4a14c5648 100644
--- a/contrib/python/ipython/py3/IPython/utils/coloransi.py
+++ b/contrib/python/ipython/py3/IPython/utils/coloransi.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""Tools for coloring text in ANSI terminals.
"""
@@ -9,12 +8,16 @@
# the file COPYING, distributed as part of this software.
#*****************************************************************************
-__all__ = ['TermColors','InputTermColors','ColorScheme','ColorSchemeTable']
import os
+import warnings
from IPython.utils.ipstruct import Struct
+__all__ = ["TermColors", "InputTermColors", "ColorScheme", "ColorSchemeTable"]
+
+_sentinel = object()
+
color_templates = (
# Dark colors
("Black" , "0;30"),
@@ -110,8 +113,22 @@ for name, value in color_templates:
class ColorScheme:
"""Generic color scheme class. Just a name and a Struct."""
- def __init__(self,__scheme_name_,colordict=None,**colormap):
+
+ name: str
+ colors: Struct
+
+ def __init__(self, __scheme_name_, colordict=None, **colormap):
self.name = __scheme_name_
+ if colormap:
+ warnings.warn(
+ "Passing each colors as a kwarg to ColorScheme is "
+ "considered for deprecation. Please pass a "
+ "a single dict as second parameter. If you are using this"
+ "feature, please comment an subscribe to issue "
+ "https://github.com/ipython/ipython/issues/14304",
+ PendingDeprecationWarning,
+ stacklevel=2,
+ )
if colordict is None:
self.colors = Struct(**colormap)
else:
@@ -155,18 +172,35 @@ class ColorSchemeTable(dict):
"""Return full copy of object"""
return ColorSchemeTable(self.values(),self.active_scheme_name)
- def add_scheme(self,new_scheme):
+ def __setitem__(self, key: str, value: ColorScheme):
+ assert isinstance(key, str)
+ assert isinstance(value, ColorScheme)
+ super().__setitem__(key, value)
+
+ def add_scheme(self, new_scheme):
"""Add a new color scheme to the table."""
- if not isinstance(new_scheme,ColorScheme):
+ if not isinstance(new_scheme, ColorScheme):
raise ValueError('ColorSchemeTable only accepts ColorScheme instances')
self[new_scheme.name] = new_scheme
- def set_active_scheme(self,scheme,case_sensitive=0):
+ def set_active_scheme(self, scheme, case_sensitive=_sentinel):
"""Set the currently active scheme.
Names are by default compared in a case-insensitive way, but this can
be changed by setting the parameter case_sensitive to true."""
+ if case_sensitive is _sentinel:
+ case_sensitive = False
+ else:
+ warnings.warn(
+ "set_active_scheme(case_sensitive=...) is Pending "
+ "deprecation. Please comment on "
+ "https://github.com/ipython/ipython/issues/14306 "
+ "to let the ipython maintainer that you are affected.",
+ PendingDeprecationWarning,
+ stacklevel=2,
+ )
+
scheme_names = list(self.keys())
if case_sensitive:
valid_schemes = scheme_names
diff --git a/contrib/python/ipython/py3/ya.make b/contrib/python/ipython/py3/ya.make
index c61c19b4b8..a53c5172e7 100644
--- a/contrib/python/ipython/py3/ya.make
+++ b/contrib/python/ipython/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(8.20.0)
+VERSION(8.21.0)
LICENSE(BSD-3-Clause)
diff --git a/yt/yt/library/profiling/impl.h b/yt/yt/library/profiling/impl.h
index 48e863e882..59f0b25ce7 100644
--- a/yt/yt/library/profiling/impl.h
+++ b/yt/yt/library/profiling/impl.h
@@ -55,7 +55,7 @@ public:
const TTagSet& tags,
TSensorOptions options) = 0;
- virtual IHistogramImplPtr RegisterTimeHistogram(
+ virtual ITimerImplPtr RegisterTimeHistogram(
const TString& name,
const TTagSet& tags,
TSensorOptions options) = 0;
diff --git a/yt/yt/library/profiling/public.h b/yt/yt/library/profiling/public.h
index 2abf46d968..db42520669 100644
--- a/yt/yt/library/profiling/public.h
+++ b/yt/yt/library/profiling/public.h
@@ -25,7 +25,6 @@ DECLARE_REFCOUNTED_STRUCT(IHistogramImpl)
DECLARE_REFCOUNTED_STRUCT(IRegistryImpl)
DECLARE_REFCOUNTED_STRUCT(ISensorProducer)
DECLARE_REFCOUNTED_CLASS(TBufferedProducer)
-DECLARE_REFCOUNTED_CLASS(THistogram)
////////////////////////////////////////////////////////////////////////////////
diff --git a/yt/yt/library/profiling/sensor.cpp b/yt/yt/library/profiling/sensor.cpp
index 28bee90488..560d9760bf 100644
--- a/yt/yt/library/profiling/sensor.cpp
+++ b/yt/yt/library/profiling/sensor.cpp
@@ -116,16 +116,13 @@ TSummary::operator bool() const
////////////////////////////////////////////////////////////////////////////////
-void TEventTimer::Record(TDuration value, int count) const
+void TEventTimer::Record(TDuration value) const
{
- if (Histogram_) {
- Histogram_->Add(value.SecondsFloat(), count);
- } else if (Timer_) {
- while (count > 0) {
- Timer_->Record(value);
- --count;
- }
+ if (!Timer_) {
+ return;
}
+
+ Timer_->Record(value);
}
TEventTimer::operator bool() const
@@ -607,7 +604,7 @@ TEventTimer TProfiler::TimeHistogram(const TString& name, TDuration min, TDurati
options.HistogramMax = max;
TEventTimer timer;
- timer.Histogram_ = Impl_->RegisterTimeHistogram(Namespace_ + Prefix_ + name, Tags_, options);
+ timer.Timer_ = Impl_->RegisterTimeHistogram(Namespace_ + Prefix_ + name, Tags_, options);
return timer;
}
@@ -620,7 +617,7 @@ TEventTimer TProfiler::TimeHistogram(const TString& name, std::vector<TDuration>
TEventTimer timer;
auto options = Options_;
options.TimeHistogramBounds = std::move(bounds);
- timer.Histogram_ = Impl_->RegisterTimeHistogram(Namespace_ + Prefix_ + name, Tags_, options);
+ timer.Timer_ = Impl_->RegisterTimeHistogram(Namespace_ + Prefix_ + name, Tags_, options);
return timer;
}
diff --git a/yt/yt/library/profiling/sensor.h b/yt/yt/library/profiling/sensor.h
index f3b8c7dcf2..2aa7299f32 100644
--- a/yt/yt/library/profiling/sensor.h
+++ b/yt/yt/library/profiling/sensor.h
@@ -107,7 +107,7 @@ private:
class TEventTimer
{
public:
- void Record(TDuration value, int count = 1) const;
+ void Record(TDuration value) const;
explicit operator bool() const;
@@ -115,7 +115,6 @@ private:
friend class TProfiler;
ITimerImplPtr Timer_;
- IHistogramImplPtr Histogram_;
};
////////////////////////////////////////////////////////////////////////////////
diff --git a/yt/yt/library/profiling/solomon/registry.cpp b/yt/yt/library/profiling/solomon/registry.cpp
index 557e055e33..b231a64782 100644
--- a/yt/yt/library/profiling/solomon/registry.cpp
+++ b/yt/yt/library/profiling/solomon/registry.cpp
@@ -162,7 +162,7 @@ ITimerImplPtr TSolomonRegistry::RegisterTimerSummary(
});
}
-IHistogramImplPtr TSolomonRegistry::RegisterTimeHistogram(
+ITimerImplPtr TSolomonRegistry::RegisterTimeHistogram(
const TString& name,
const TTagSet& tags,
TSensorOptions options)
diff --git a/yt/yt/library/profiling/solomon/registry.h b/yt/yt/library/profiling/solomon/registry.h
index dbd684dfc3..0569f18cd9 100644
--- a/yt/yt/library/profiling/solomon/registry.h
+++ b/yt/yt/library/profiling/solomon/registry.h
@@ -80,7 +80,7 @@ public:
const TTagSet& tags,
TSensorOptions options) override;
- IHistogramImplPtr RegisterTimeHistogram(
+ ITimerImplPtr RegisterTimeHistogram(
const TString& name,
const TTagSet& tags,
TSensorOptions options) override;
diff --git a/yt/yt/library/profiling/solomon/sensor.h b/yt/yt/library/profiling/solomon/sensor.h
index 55d238821d..3ac491ef59 100644
--- a/yt/yt/library/profiling/solomon/sensor.h
+++ b/yt/yt/library/profiling/solomon/sensor.h
@@ -99,6 +99,8 @@ private:
////////////////////////////////////////////////////////////////////////////////
+DECLARE_REFCOUNTED_CLASS(THistogram)
+
std::vector<double> GenerateGenericBucketBounds();
class THistogram