summaryrefslogtreecommitdiffstats
path: root/contrib/python/ipython/py3/IPython/utils
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2024-03-12 17:24:47 +0300
committerrobot-piglet <[email protected]>2024-03-12 17:34:45 +0300
commite84602b8f2b95d10d45eb11369ae7d627339c881 (patch)
tree028524c9f076a9c4019a8d78d4a30685b7626c99 /contrib/python/ipython/py3/IPython/utils
parente98c636d759bf6f106a2b90142041bb9d4f1e33f (diff)
Intermediate changes
Diffstat (limited to 'contrib/python/ipython/py3/IPython/utils')
-rw-r--r--contrib/python/ipython/py3/IPython/utils/_process_emscripten.py23
-rw-r--r--contrib/python/ipython/py3/IPython/utils/_sysinfo.py2
-rw-r--r--contrib/python/ipython/py3/IPython/utils/path.py20
-rw-r--r--contrib/python/ipython/py3/IPython/utils/process.py2
-rw-r--r--contrib/python/ipython/py3/IPython/utils/text.py28
5 files changed, 61 insertions, 14 deletions
diff --git a/contrib/python/ipython/py3/IPython/utils/_process_emscripten.py b/contrib/python/ipython/py3/IPython/utils/_process_emscripten.py
new file mode 100644
index 00000000000..05dcdc34d5f
--- /dev/null
+++ b/contrib/python/ipython/py3/IPython/utils/_process_emscripten.py
@@ -0,0 +1,23 @@
+"""Emscripten-specific implementation of process utilities.
+
+This file is only meant to be imported by process.py, not by end-users.
+"""
+
+
+from ._process_common import arg_split
+
+
+def system(cmd):
+ raise OSError("Not available")
+
+
+def getoutput(cmd):
+ raise OSError("Not available")
+
+
+def check_pid(cmd):
+ raise OSError("Not available")
+
+
+# `arg_split` is still used by magics regardless of whether we are on a posix/windows/emscipten
+__all__ = ["system", "getoutput", "check_pid", "arg_split"]
diff --git a/contrib/python/ipython/py3/IPython/utils/_sysinfo.py b/contrib/python/ipython/py3/IPython/utils/_sysinfo.py
index 56568073d77..22be56b84bb 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 = "8b1204b6c"
+commit = "d1804576b"
diff --git a/contrib/python/ipython/py3/IPython/utils/path.py b/contrib/python/ipython/py3/IPython/utils/path.py
index ccb70dccd43..cb5be041957 100644
--- a/contrib/python/ipython/py3/IPython/utils/path.py
+++ b/contrib/python/ipython/py3/IPython/utils/path.py
@@ -12,6 +12,7 @@ import errno
import shutil
import random
import glob
+import warnings
from IPython.utils.process import system
@@ -292,7 +293,14 @@ def target_outdated(target,deps):
If target doesn't exist or is older than any file listed in deps, return
true, otherwise return false.
+
+ .. deprecated:: 8.22
"""
+ warnings.warn(
+ "`target_outdated` is deprecated since IPython 8.22 and will be removed in future versions",
+ DeprecationWarning,
+ stacklevel=2,
+ )
try:
target_time = os.path.getmtime(target)
except os.error:
@@ -312,9 +320,17 @@ def target_update(target,deps,cmd):
target_update(target,deps,cmd) -> runs cmd if target is outdated.
This is just a wrapper around target_outdated() which calls the given
- command if target is outdated."""
+ command if target is outdated.
+
+ .. deprecated:: 8.22
+ """
- if target_outdated(target,deps):
+ warnings.warn(
+ "`target_update` is deprecated since IPython 8.22 and will be removed in future versions",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ if target_outdated(target, deps):
system(cmd)
diff --git a/contrib/python/ipython/py3/IPython/utils/process.py b/contrib/python/ipython/py3/IPython/utils/process.py
index 489b7c13d0c..f50cf9ba223 100644
--- a/contrib/python/ipython/py3/IPython/utils/process.py
+++ b/contrib/python/ipython/py3/IPython/utils/process.py
@@ -15,6 +15,8 @@ if sys.platform == 'win32':
from ._process_win32 import system, getoutput, arg_split, check_pid
elif sys.platform == 'cli':
from ._process_cli import system, getoutput, arg_split, check_pid
+elif sys.platform == "emscripten":
+ from ._process_emscripten import system, getoutput, arg_split, check_pid
else:
from ._process_posix import system, getoutput, arg_split, check_pid
diff --git a/contrib/python/ipython/py3/IPython/utils/text.py b/contrib/python/ipython/py3/IPython/utils/text.py
index 8f73dca28a0..51dcdae5dd3 100644
--- a/contrib/python/ipython/py3/IPython/utils/text.py
+++ b/contrib/python/ipython/py3/IPython/utils/text.py
@@ -1,4 +1,3 @@
-# encoding: utf-8
"""
Utilities for working with strings and text.
@@ -11,13 +10,12 @@ Inheritance diagram:
import os
import re
import string
-import sys
import textwrap
import warnings
from string import Formatter
from pathlib import Path
-from typing import List, Dict, Tuple
+from typing import List, Dict, Tuple, Optional, cast
class LSString(str):
@@ -540,11 +538,12 @@ class FullEvalFormatter(Formatter):
"""
# copied from Formatter._vformat with minor changes to allow eval
# and replace the format_spec code with slicing
- def vformat(self, format_string:str, args, kwargs)->str:
+ def vformat(self, format_string: str, args, kwargs) -> str:
result = []
- for literal_text, field_name, format_spec, conversion in \
- self.parse(format_string):
-
+ conversion: Optional[str]
+ for literal_text, field_name, format_spec, conversion in self.parse(
+ format_string
+ ):
# output the literal text
if literal_text:
result.append(literal_text)
@@ -563,7 +562,8 @@ class FullEvalFormatter(Formatter):
obj = eval(field_name, kwargs)
# do any conversion on the resulting object
- obj = self.convert_field(obj, conversion)
+ # type issue in typeshed, fined in https://github.com/python/typeshed/pull/11377
+ obj = self.convert_field(obj, conversion) # type: ignore[arg-type]
# format the object and append to the result
result.append(self.format_field(obj, ''))
@@ -722,7 +722,13 @@ def compute_item_matrix(
return ([[_get_or_default(items, c * nrow + r, default=empty) for c in range(ncol)] for r in range(nrow)], info)
-def columnize(items, row_first=False, separator=" ", displaywidth=80, spread=False):
+def columnize(
+ items: List[str],
+ row_first: bool = False,
+ separator: str = " ",
+ displaywidth: int = 80,
+ spread: bool = False,
+):
"""Transform a list of strings into a single string with columns.
Parameters
@@ -743,7 +749,7 @@ def columnize(items, row_first=False, separator=" ", displaywidth=80, spread=Fa
"""
warnings.warn(
"`columnize` is Pending Deprecation since IPython 8.17."
- "It is considered fro removal in in future version. "
+ "It is considered for removal in future versions. "
"Please open an issue if you believe it should be kept.",
stacklevel=2,
category=PendingDeprecationWarning,
@@ -761,7 +767,7 @@ def columnize(items, row_first=False, separator=" ", displaywidth=80, spread=Fa
separator = separator.ljust(int(info["optimal_separator_width"]))
fmatrix: List[filter[int]] = [filter(None, x) for x in matrix]
sjoin = lambda x: separator.join(
- [y.ljust(w, " ") for y, w in zip(x, info["column_widths"])]
+ [y.ljust(w, " ") for y, w in zip(x, cast(List[int], info["column_widths"]))]
)
return "\n".join(map(sjoin, fmatrix)) + "\n"