HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/python/__pycache__/text.cpython-38.pyc
U


W[j�@sRdZddd�Zdd�Zdd�Zdd	d
�ZeZdd�Zd
d�Zdd�Zddd�Z	dS)z'
Miscellany of text-munging functions.
�c	Cs�d}g}t|�tkr�d}|��D]r\}}t||d�}t|�rnt|�rX|dtd��}|�d|||f�q |�d|||t|�dd�f�q n~t|�tks�t|�t	kr�t|�tkr�d	}nd
}|D]$}t||d�}|�|�
�d�q�n$t|fd
d�t|��
d��|dd�<|�s$|�|�|�rf||d|dt|�dd�|d<|d|d|d<d�|�}t|��r�t|��s�|d}|S)al
    Expansive string formatting for sequence types.

    C{list.__str__} and C{dict.__str__} use C{repr()} to display their
    elements.  This function also turns these sequence types
    into strings, but uses C{str()} on their elements instead.

    Sequence elements are also displayed on separate lines, and nested
    sequences have nested indentation.
    rz{}z   N�
z	%s %s:
%sz	%s %s: %s�z()z[]� �,cSs||S�N�)�s�irr�5/usr/lib/python3/dist-packages/twisted/python/text.py�<lambda>0�zstringyString.<locals>.<lambda>�����)�type�dict�items�
stringyString�isMultiline�
endsInNewline�len�append�tuple�list�rstrip�map�str�split�join)�objectZindentationZbracesZsl�key�value�elementrrrr
rs@
��
(
rcCs|�d�dkS)z=
    Returns C{True} if this string has a newline in it.
    rr)�find�rrrr
rBsrcCs|td�d�dkS)z;
    Returns C{True} if this string ends in a newline.
    rN)rr$rrr
rIsr�Pc	Cs�g}|�d�dkr@|�d�}|D]}|�t||�dg�q |S|��}d}d}|r�|t||�}|d}||kr�|dkr~n|d}|d|�||d�}}|�d�|��d}d}qPt|�|ks�|�d�|��|dd�=qP|d}qP|S)a
    Given a string and a column width, return a list of lines.

    Caveat: I'm use a stupid greedy word-wrapping
    algorythm.  I won't put two spaces at the end
    of a sentence.  I don't do full justification.
    And no, I've never even *heard* of hypenation.
    z

r
rrNr)r#r�extend�
greedyWraprrr)	ZinString�widthZoutLinesZ
paragraphsZparaZinWords�columnZptr_line�lrrr
r'Ps2


r'cCs(g}|D]}|s|��r|�|�q|Sr)�stripr)�linesZret�linerrr
�removeLeadingBlanks�s
r.cCs4t|�d��}|��t|�}|��d�|�dS)Nr)r.r�reverser)rr,rrr
�removeLeadingTrailingBlanks�s
r0cCs�g}d}d}|��D]�}|dkrH|rH|ddkrH|d}|dd�}g}|dkr\|�|�q|r�|d|kr�|dd�}|�|�|�d�|��d}q|�|�q|S)a=
    Like a string split, but don't break substrings inside quotes.

    >>> splitQuoted('the "hairy monkey" likes pie')
    ['the', 'hairy monkey', 'likes', 'pie']

    Another one of those "someone must have a better solution for
    this" things.  This implementation is a VERY DUMB hack done too
    quickly.
    Nr
)�"�'rrr)rrr)r�outZquot�phraseZwordrrr
�splitQuoted�s$
r5TcCs�t|��}tt|�d�}|s$|��}|�|t|��}|sB|��}t|�}|dkrVdSt|�||}|dkrx||}n||d�|}|�|�dkr$dSq$dS)z[
    Find whether string C{p} occurs in a read()able object C{f}.

    @rtype: C{bool}
    ir
FNrT)r�maxr�lower�readr#)�p�fZ
caseSensitiveZbufZbuf_len�rZ
bytes_readr*rrr
�strFile�s 

r<N)r)r%)T)
�__doc__rrrr'ZwordWrapr.r0r5r<rrrr
�<module>s
7
2#