Skip to content

Commit

Permalink
Deprecation and removal for 8.17
Browse files Browse the repository at this point in the history
See ipython#14186

I think for each of those warning we should:

1) Open an issue for removal, and update the corresponding warnings text to point to the corresponding issue.
  • Loading branch information
Carreau committed Sep 30, 2023
1 parent 6004e9b commit c77baff
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
8 changes: 7 additions & 1 deletion IPython/core/inputsplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ def num_ini_spaces(s):
-------
n : int
"""

warnings.warn(
"`num_ini_spaces` is Pending Deprecation since IPython 8.17."
"It is considered fro removal in in future version. "
"Please open an issue if you believe it should be kept.",
stacklevel=2,
category=PendingDeprecationWarning,
)
ini_spaces = ini_spaces_re.match(s)
if ini_spaces:
return ini_spaces.end()
Expand Down
44 changes: 37 additions & 7 deletions IPython/utils/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,11 @@
import string
import sys
import textwrap
import warnings
from string import Formatter
from pathlib import Path


# datetime.strftime date format for ipython
if sys.platform == 'win32':
date_format = "%B %d, %Y"
else:
date_format = "%B %-d, %Y"

class LSString(str):
"""String derivative with a special access attributes.
Expand Down Expand Up @@ -336,7 +331,13 @@ def marquee(txt='',width=78,mark='*'):

def num_ini_spaces(strng):
"""Return the number of initial spaces in a string"""

warnings.warn(
"`num_ini_spaces` is Pending Deprecation since IPython 8.17."
"It is considered fro removal in in future version. "
"Please open an issue if you believe it should be kept.",
stacklevel=2,
category=PendingDeprecationWarning,
)
ini_spaces = ini_spaces_re.match(strng)
if ini_spaces:
return ini_spaces.end()
Expand Down Expand Up @@ -391,6 +392,13 @@ def wrap_paragraphs(text, ncols=80):
-------
list of complete paragraphs, wrapped to fill `ncols` columns.
"""
warnings.warn(
"`wrap_paragraphs` is Pending Deprecation since IPython 8.17."
"It is considered fro removal in in future version. "
"Please open an issue if you believe it should be kept.",
stacklevel=2,
category=PendingDeprecationWarning,
)
paragraph_re = re.compile(r'\n(\s*\n)+', re.MULTILINE)
text = dedent(text).strip()
paragraphs = paragraph_re.split(text)[::2] # every other entry is space
Expand Down Expand Up @@ -465,6 +473,14 @@ def strip_ansi(source):
source : str
Source to remove the ansi from
"""
warnings.warn(
"`strip_ansi` is Pending Deprecation since IPython 8.17."
"It is considered fro removal in in future version. "
"Please open an issue if you believe it should be kept.",
stacklevel=2,
category=PendingDeprecationWarning,
)

return re.sub(r'\033\[(\d|;)+?m', '', source)


Expand Down Expand Up @@ -682,6 +698,13 @@ def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) :
In [5]: all((info[k] == ideal[k] for k in ideal.keys()))
Out[5]: True
"""
warnings.warn(
"`compute_item_matrix` is Pending Deprecation since IPython 8.17."
"It is considered fro removal in in future version. "
"Please open an issue if you believe it should be kept.",
stacklevel=2,
category=PendingDeprecationWarning,
)
info = _find_optimal(list(map(len, items)), row_first, *args, **kwargs)
nrow, ncol = info['max_rows'], info['num_columns']
if row_first:
Expand Down Expand Up @@ -709,6 +732,13 @@ def columnize(items, row_first=False, separator=" ", displaywidth=80, spread=Fa
-------
The formatted string.
"""
warnings.warn(
"`columnize` is Pending Deprecation since IPython 8.17."
"It is considered fro removal in in future version. "
"Please open an issue if you believe it should be kept.",
stacklevel=2,
category=PendingDeprecationWarning,
)
if not items:
return '\n'
matrix, info = compute_item_matrix(items, row_first=row_first, separator_size=len(separator), displaywidth=displaywidth)
Expand Down

0 comments on commit c77baff

Please sign in to comment.