diff options
| author | robot-contrib <[email protected]> | 2022-05-18 00:43:36 +0300 |
|---|---|---|
| committer | robot-contrib <[email protected]> | 2022-05-18 00:43:36 +0300 |
| commit | 9e5f436a8b2a27bcc7802e443ea3ef3e41a82a75 (patch) | |
| tree | 78b522cab9f76336e62064d4d8ff7c897659b20e /contrib/python/ipython/py3/IPython/utils/text.py | |
| parent | 8113a823ffca6451bb5ff8f0334560885a939a24 (diff) | |
Update contrib/python/ipython/py3 to 8.3.0
ref:e84342d4d30476f9148137f37fd0c6405fd36f55
Diffstat (limited to 'contrib/python/ipython/py3/IPython/utils/text.py')
| -rw-r--r-- | contrib/python/ipython/py3/IPython/utils/text.py | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/contrib/python/ipython/py3/IPython/utils/text.py b/contrib/python/ipython/py3/IPython/utils/text.py index 256fdab5843..74bccddf68b 100644 --- a/contrib/python/ipython/py3/IPython/utils/text.py +++ b/contrib/python/ipython/py3/IPython/utils/text.py @@ -16,7 +16,6 @@ import textwrap from string import Formatter from pathlib import Path -from IPython.utils import py3compat # datetime.strftime date format for ipython if sys.platform == 'win32': @@ -254,7 +253,6 @@ def indent(instr,nspaces=4, ntabs=0, flatten=False): Parameters ---------- - instr : basestring The string to be indented. nspaces : int (default: 4) @@ -268,7 +266,6 @@ def indent(instr,nspaces=4, ntabs=0, flatten=False): Returns ------- - str|unicode : string indented by ntabs and nspaces. """ @@ -392,7 +389,6 @@ def wrap_paragraphs(text, ncols=80): Returns ------- - list of complete paragraphs, wrapped to fill `ncols` columns. """ paragraph_re = re.compile(r'\n(\s*\n)+', re.MULTILINE) @@ -463,7 +459,7 @@ def strip_email_quotes(text): def strip_ansi(source): """ Remove ansi escape codes from text. - + Parameters ---------- source : str @@ -474,11 +470,11 @@ def strip_ansi(source): class EvalFormatter(Formatter): """A String Formatter that allows evaluation of simple expressions. - - Note that this version interprets a : as specifying a format string (as per + + Note that this version interprets a `:` as specifying a format string (as per standard string formatting), so if slicing is required, you must explicitly create a slice. - + This is to be used in templating cases, such as the parallel batch script templates, where simple arithmetic on arguments is useful. @@ -643,7 +639,6 @@ def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) : Parameters ---------- - items list of strings to columize row_first : (default False) @@ -658,14 +653,11 @@ def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) : Returns ------- - strings_matrix - nested list of string, the outer most list contains as many list as rows, the innermost lists have each as many element as columns. If the total number of elements in `items` does not equal the product of rows*columns, the last element of some lists are filled with `None`. - dict_info some info to make columnize easier: @@ -698,21 +690,18 @@ def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) : 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): - """ Transform a list of strings into a single string with columns. +def columnize(items, row_first=False, separator=" ", displaywidth=80, spread=False): + """Transform a list of strings into a single string with columns. Parameters ---------- items : sequence of strings The strings to process. - row_first : (default False) Whether to compute columns for a row-first matrix instead of column-first (default). - separator : str, optional [default is two spaces] The string that separates columns. - displaywidth : int, optional [default is 80] Width of the display in number of characters. |
