aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/ipython/py3/IPython/sphinxext
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.ru>2022-05-18 00:43:36 +0300
committerrobot-contrib <robot-contrib@yandex-team.ru>2022-05-18 00:43:36 +0300
commit9e5f436a8b2a27bcc7802e443ea3ef3e41a82a75 (patch)
tree78b522cab9f76336e62064d4d8ff7c897659b20e /contrib/python/ipython/py3/IPython/sphinxext
parent8113a823ffca6451bb5ff8f0334560885a939a24 (diff)
downloadydb-9e5f436a8b2a27bcc7802e443ea3ef3e41a82a75.tar.gz
Update contrib/python/ipython/py3 to 8.3.0
ref:e84342d4d30476f9148137f37fd0c6405fd36f55
Diffstat (limited to 'contrib/python/ipython/py3/IPython/sphinxext')
-rw-r--r--contrib/python/ipython/py3/IPython/sphinxext/custom_doctests.py4
-rw-r--r--contrib/python/ipython/py3/IPython/sphinxext/ipython_directive.py18
2 files changed, 15 insertions, 7 deletions
diff --git a/contrib/python/ipython/py3/IPython/sphinxext/custom_doctests.py b/contrib/python/ipython/py3/IPython/sphinxext/custom_doctests.py
index 7678fd6801a..75c2a25ccb7 100644
--- a/contrib/python/ipython/py3/IPython/sphinxext/custom_doctests.py
+++ b/contrib/python/ipython/py3/IPython/sphinxext/custom_doctests.py
@@ -107,10 +107,10 @@ def float_doctest(sphinx_shell, args, input_lines, found, submitted):
try:
rtol = float(args[2])
atol = float(args[3])
- except IndexError:
+ except IndexError as e:
e = ("Both `rtol` and `atol` must be specified "
"if either are specified: {0}".format(args))
- raise IndexError(e)
+ raise IndexError(e) from e
try:
submitted = str_to_array(submitted)
diff --git a/contrib/python/ipython/py3/IPython/sphinxext/ipython_directive.py b/contrib/python/ipython/py3/IPython/sphinxext/ipython_directive.py
index ac0964032a5..18bdfcae993 100644
--- a/contrib/python/ipython/py3/IPython/sphinxext/ipython_directive.py
+++ b/contrib/python/ipython/py3/IPython/sphinxext/ipython_directive.py
@@ -220,6 +220,8 @@ except Exception:
# for tokenizing blocks
COMMENT, INPUT, OUTPUT = range(3)
+PSEUDO_DECORATORS = ["suppress", "verbatim", "savefig", "doctest"]
+
#-----------------------------------------------------------------------------
# Functions and class declarations
#-----------------------------------------------------------------------------
@@ -263,11 +265,17 @@ def block_parser(part, rgxin, rgxout, fmtin, fmtout):
block.append((COMMENT, line))
continue
- if line_stripped.startswith('@'):
- # Here is where we assume there is, at most, one decorator.
- # Might need to rethink this.
- decorator = line_stripped
- continue
+ if any(
+ line_stripped.startswith("@" + pseudo_decorator)
+ for pseudo_decorator in PSEUDO_DECORATORS
+ ):
+ if decorator:
+ raise RuntimeError(
+ "Applying multiple pseudo-decorators on one line is not supported"
+ )
+ else:
+ decorator = line_stripped
+ continue
# does this look like an input line?
matchin = rgxin.match(line)