Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c77baff

Browse files
committed
Deprecation and removal for 8.17
See #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.
1 parent 6004e9b commit c77baff

2 files changed

Lines changed: 44 additions & 8 deletions

File tree

IPython/core/inputsplitter.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,13 @@ def num_ini_spaces(s):
9191
-------
9292
n : int
9393
"""
94-
94+
warnings.warn(
95+
"`num_ini_spaces` is Pending Deprecation since IPython 8.17."
96+
"It is considered fro removal in in future version. "
97+
"Please open an issue if you believe it should be kept.",
98+
stacklevel=2,
99+
category=PendingDeprecationWarning,
100+
)
95101
ini_spaces = ini_spaces_re.match(s)
96102
if ini_spaces:
97103
return ini_spaces.end()

IPython/utils/text.py

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,11 @@
1313
import string
1414
import sys
1515
import textwrap
16+
import warnings
1617
from string import Formatter
1718
from pathlib import Path
1819

1920

20-
# datetime.strftime date format for ipython
21-
if sys.platform == 'win32':
22-
date_format = "%B %d, %Y"
23-
else:
24-
date_format = "%B %-d, %Y"
25-
2621
class LSString(str):
2722
"""String derivative with a special access attributes.
2823
@@ -336,7 +331,13 @@ def marquee(txt='',width=78,mark='*'):
336331

337332
def num_ini_spaces(strng):
338333
"""Return the number of initial spaces in a string"""
339-
334+
warnings.warn(
335+
"`num_ini_spaces` is Pending Deprecation since IPython 8.17."
336+
"It is considered fro removal in in future version. "
337+
"Please open an issue if you believe it should be kept.",
338+
stacklevel=2,
339+
category=PendingDeprecationWarning,
340+
)
340341
ini_spaces = ini_spaces_re.match(strng)
341342
if ini_spaces:
342343
return ini_spaces.end()
@@ -391,6 +392,13 @@ def wrap_paragraphs(text, ncols=80):
391392
-------
392393
list of complete paragraphs, wrapped to fill `ncols` columns.
393394
"""
395+
warnings.warn(
396+
"`wrap_paragraphs` is Pending Deprecation since IPython 8.17."
397+
"It is considered fro removal in in future version. "
398+
"Please open an issue if you believe it should be kept.",
399+
stacklevel=2,
400+
category=PendingDeprecationWarning,
401+
)
394402
paragraph_re = re.compile(r'\n(\s*\n)+', re.MULTILINE)
395403
text = dedent(text).strip()
396404
paragraphs = paragraph_re.split(text)[::2] # every other entry is space
@@ -465,6 +473,14 @@ def strip_ansi(source):
465473
source : str
466474
Source to remove the ansi from
467475
"""
476+
warnings.warn(
477+
"`strip_ansi` is Pending Deprecation since IPython 8.17."
478+
"It is considered fro removal in in future version. "
479+
"Please open an issue if you believe it should be kept.",
480+
stacklevel=2,
481+
category=PendingDeprecationWarning,
482+
)
483+
468484
return re.sub(r'\033\[(\d|;)+?m', '', source)
469485

470486

@@ -682,6 +698,13 @@ def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) :
682698
In [5]: all((info[k] == ideal[k] for k in ideal.keys()))
683699
Out[5]: True
684700
"""
701+
warnings.warn(
702+
"`compute_item_matrix` is Pending Deprecation since IPython 8.17."
703+
"It is considered fro removal in in future version. "
704+
"Please open an issue if you believe it should be kept.",
705+
stacklevel=2,
706+
category=PendingDeprecationWarning,
707+
)
685708
info = _find_optimal(list(map(len, items)), row_first, *args, **kwargs)
686709
nrow, ncol = info['max_rows'], info['num_columns']
687710
if row_first:
@@ -709,6 +732,13 @@ def columnize(items, row_first=False, separator=" ", displaywidth=80, spread=Fa
709732
-------
710733
The formatted string.
711734
"""
735+
warnings.warn(
736+
"`columnize` is Pending Deprecation since IPython 8.17."
737+
"It is considered fro removal in in future version. "
738+
"Please open an issue if you believe it should be kept.",
739+
stacklevel=2,
740+
category=PendingDeprecationWarning,
741+
)
712742
if not items:
713743
return '\n'
714744
matrix, info = compute_item_matrix(items, row_first=row_first, separator_size=len(separator), displaywidth=displaywidth)

0 commit comments

Comments
 (0)