| Server IP : 217.160.0.135 / Your IP : 216.73.216.115 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/ipython_genutils/__pycache__/ |
Upload File : |
�
��X � � � d Z ddlZddlZddlZddlZddlmZ ej dk rdZndZdd �Z d
� Z
dd�Zd
� Zd� Z
dd�Zdd�Zdd�Zdd�ZdS )z~
Utilities for working with strings and text.
Inheritance diagram:
.. inheritance-diagram:: IPython.utils.text
:parts: 3
� N)� Formatter�win32z %B %d, %Yz
%B %-d, %Y� Fc �F � | �dS d|z d|z z }|r t j dt j � � }nt j dt j � � }t j ||| � � }|� t
j |z � � r|dt |� � � S |S )a� Indent a string a given number of spaces or tabstops.
indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.
Parameters
----------
instr : basestring
The string to be indented.
nspaces : int (default: 4)
The number of spaces to be indented.
ntabs : int (default: 0)
The number of tabs to be indented.
flatten : bool (default: False)
Whether to scrub existing indentation. If True, all lines will be
aligned to the same indentation. If False, existing indentation will
be strictly increased.
Returns
-------
str|unicode : string indented by ntabs and nspaces.
N� � z^\s*�^)�re�compile� MULTILINE�sub�endswith�os�linesep�len)�instr�nspaces�ntabs�flatten�ind�pat�outstrs �7/usr/lib/python3/dist-packages/ipython_genutils/text.py�indentr s� � �2
�}���
�u�*�S��[�
�C�� -��j��"�,�/�/����j��r�|�,�,��
�V�C��e�
$�
$�F�
���r�z�#�~�&�&� ��j��C���y�j�!�!��
� c �. � | � d� � rt j | � � S | � dd� � }t |� � dk rt j | � � S |\ }}t j |� � }d� ||g� � S )z�Equivalent of textwrap.dedent that ignores unindented first line.
This means it will still dedent strings like:
'''foo
is a bar
'''
For use in wrap_paragraphs.
�
� )�
startswith�textwrap�dedent�splitr �join)�text�splits�first�rests r r! r! ? s� � � ���t��� %���t�$�$�$� �Z�Z��Q�
�
�F�
�6�{�{�a�����t�$�$�$��K�E�4��?�4� � �D��9�9�e�T�]�#�#�#r �P c � � t j dt j � � }t | � � � � � } |� | � � ddd� }g }t j dt j � � }|D ]A}|� |� � �t j ||� � }|� |� � �B|S )a Wrap multiple paragraphs to fit a specified width.
This is equivalent to textwrap.wrap, but with support for multiple
paragraphs, as separated by empty lines.
Returns
-------
list of complete paragraphs, wrapped to fill `ncols` columns.
z
\n(\s*\n)+N� z\n\s+)
r
r r r! �stripr"