aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/ipython/py3/IPython/utils
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-09-30 10:27:28 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-09-30 10:47:10 +0300
commit5a6373c9d09bbfb7094f9992a4531477bb97829e (patch)
treeebea8fd55fee858876743312cdf789a1f01487b5 /contrib/python/ipython/py3/IPython/utils
parent15f3c7493474de25a6b23296878bb8f49470d2e6 (diff)
downloadydb-5a6373c9d09bbfb7094f9992a4531477bb97829e.tar.gz
Update contrib/python/ipython/py3 to 8.15.0
Diffstat (limited to 'contrib/python/ipython/py3/IPython/utils')
-rw-r--r--contrib/python/ipython/py3/IPython/utils/_sysinfo.py2
-rw-r--r--contrib/python/ipython/py3/IPython/utils/module_paths.py12
-rw-r--r--contrib/python/ipython/py3/IPython/utils/tokenutil.py32
3 files changed, 38 insertions, 8 deletions
diff --git a/contrib/python/ipython/py3/IPython/utils/_sysinfo.py b/contrib/python/ipython/py3/IPython/utils/_sysinfo.py
index 49941f7881..b3341865eb 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 = "f11276427"
+commit = "bc8b2d22f"
diff --git a/contrib/python/ipython/py3/IPython/utils/module_paths.py b/contrib/python/ipython/py3/IPython/utils/module_paths.py
index 6f8cb1004a..401e6a90a5 100644
--- a/contrib/python/ipython/py3/IPython/utils/module_paths.py
+++ b/contrib/python/ipython/py3/IPython/utils/module_paths.py
@@ -40,11 +40,13 @@ def find_mod(module_name):
"""
Find module `module_name` on sys.path, and return the path to module `module_name`.
- - If `module_name` refers to a module directory, then return path to __init__ file.
- - If `module_name` is a directory without an __init__file, return None.
- - If module is missing or does not have a `.py` or `.pyw` extension, return None.
- - Note that we are not interested in running bytecode.
- - Otherwise, return the fill path of the module.
+ * If `module_name` refers to a module directory, then return path to `__init__` file.
+ * If `module_name` is a directory without an __init__file, return None.
+
+ * If module is missing or does not have a `.py` or `.pyw` extension, return None.
+ * Note that we are not interested in running bytecode.
+
+ * Otherwise, return the fill path of the module.
Parameters
----------
diff --git a/contrib/python/ipython/py3/IPython/utils/tokenutil.py b/contrib/python/ipython/py3/IPython/utils/tokenutil.py
index 697d2b504a..5fd8a1fbe1 100644
--- a/contrib/python/ipython/py3/IPython/utils/tokenutil.py
+++ b/contrib/python/ipython/py3/IPython/utils/tokenutil.py
@@ -21,6 +21,36 @@ def generate_tokens(readline):
# catch EOF error
return
+
+def generate_tokens_catch_errors(readline, extra_errors_to_catch=None):
+ default_errors_to_catch = [
+ "unterminated string literal",
+ "invalid non-printable character",
+ "after line continuation character",
+ ]
+ assert extra_errors_to_catch is None or isinstance(extra_errors_to_catch, list)
+ errors_to_catch = default_errors_to_catch + (extra_errors_to_catch or [])
+
+ tokens = []
+ try:
+ for token in tokenize.generate_tokens(readline):
+ tokens.append(token)
+ yield token
+ except tokenize.TokenError as exc:
+ if any(error in exc.args[0] for error in errors_to_catch):
+ if tokens:
+ start = tokens[-1].start[0], tokens[-1].end[0]
+ end = start
+ line = tokens[-1].line
+ else:
+ start = end = (1, 0)
+ line = ""
+ yield tokenize.TokenInfo(tokenize.ERRORTOKEN, "", start, end, line)
+ else:
+ # Catch EOF
+ raise
+
+
def line_at_cursor(cell, cursor_pos=0):
"""Return the line in a cell at a given cursor position
@@ -123,5 +153,3 @@ def token_at_cursor(cell, cursor_pos=0):
return names[-1]
else:
return ''
-
-