QfM ddlZgdZdZGddZddZddZdZejd ejZ ejd ejZ d Z dd Z e d k(ree dyy)N) TextWrapperwrapfilldedentindentshortenz ceZdZ ej eeeedZdZ dZ de jezZ de ddzZe jde e e ed ze j Z[ [ [e jd e zZ[ e jd Z ddd d dZdZdZdZdZdZdZdZdZy)r z [\w!"\'&.,?]z[^\d\W]z[%s]z[^Na ( # any whitespace %(ws)s+ | # em-dash between words (?<=%(wp)s) -{2,} (?=\w) | # word, possibly hyphenated %(nws)s+? (?: # hyphenated word -(?: (?<=%(lt)s{2}-) | (?<=%(lt)s-%(lt)s-)) (?= %(lt)s -? %(lt)s) | # end of word (?=%(ws)s|\Z) | # em-dash (?<=%(wp)s) (?=-{2,}\w) ) ))wpltwsnwsz(%s+)z[a-z][\.\!\?][\"\']?\Zz [...]) max_lines placeholderc ||_||_||_||_||_||_||_||_| |_| |_ | |_ | |_ yN) widthinitial_indentsubsequent_indent expand_tabsreplace_whitespacefix_sentence_endingsbreak_long_wordsdrop_whitespacebreak_on_hyphenstabsizerr) selfrrrrrrrrrrrrs //opt/alt/python312/lib64/python3.12/textwrap.py__init__zTextWrapper.__init__psa ,!2&"4$8! 0. 0 "&c |jr|j|j}|jr|j |j }|Sr)r expandtabsrr translateunicode_whitespace_transrtexts r_munge_whitespacezTextWrapper._munge_whitespacesF   ??4<<0D  " ">>$"?"?@D r!c |jdur|jj|}n|jj|}|Dcgc]}|s| }}|Scc}wNT)r wordsep_resplitwordsep_simple_re)rr'chunkscs r_splitzTextWrapper._splitsa   D (__**40F++11$7F#)Vq!V) *s AAc d}|jj}|t|dz kr<||dzdk(r|||rd||dz<|dz }n|dz }|t|dz kr;yy)Nrr r z )sentence_end_researchlen)rr.i patsearchs r_fix_sentence_endingsz!TextWrapper._fix_sentence_endingss{  ((// #f+a-ac{c!iq &:"qs QQ #f+a-r!c\ |dkrd}n||z }|jrp|}|d}|jr@t||kDr2|jdd|}|dkDrt d|d|Dr|dz}|j |d|||d|d<y|s |j |j yy)Nr -rc3&K|] }|dk7 yw)r;N).0r/s r z0TextWrapper._handle_long_word..s%G1a3hs)rrr5rfindanyappendpop) rreversed_chunkscur_linecur_lenr space_leftendchunkhyphens r_handle_long_wordzTextWrapper._handle_long_words  19JJ  C#B'E$$Uj)@S!Z8A:#%Ggv%G"G 1*C OOE$3K ("'+OB   OOO//1 2r!c g}|jdkrtd|jz|jo|jdkDr |j}n |j}t |t |j jz|jkDr td|j|rg}d}|r |j}n |j}|jt |z }|jr|djdk(r|r|d=|r?t |d}||z|kr%|j|j||z }nn|r?|r>t |d|kDr-|j||||ttt |}|jr,|r*|djdk(r|t |dz}|d=|r|jOt |dz|jks4|r-|jrKt |dk(r=|djs*||kr%|j|dj!|zn|r|djr]|t |j z|krB|j|j |j|dj!|z |S|t |dz}|d=|r|rV|dj#}t |t |j z|jkr||j z|d< |S|j||j jz |S|r|S)Nrzinvalid width %r (must be > 0)r z#placeholder too large for max widthr:)r ValueErrorrrrr5rlstripreverserstriprBrCrKsummapjoinrstrip) rr.linesrrErFrl prev_lines r _wrap_chunkszTextWrapper._wrap_chunkss7  ::?= JK K >> %~~!//,,6{S!1!1!8!8!:;;djjH !FGG HG//,,JJV,E##r (8(8(:b(@U2Jr OQ;%'OOFJJL1qLG#fRj/E1&&vx%Hc#x01##Xb\5G5G5IR5O3x|,,RLNN*JNT^^3))[A%*50@LL"''(*;!;<"$RL..0#c$*:*:&;;uD$OOD,<,<=!LL"''(2C)CD!  3x|#44$RL#!(-b (8(8(:I #IT5E5E1F F$(JJ!/,58H8H,Hb %  Vd.>.>.E.E.G%GH SR r!cF|j|}|j|Sr)r(r0r&s r _split_chunkszTextWrapper._split_chunksUs!%%d+{{4  r!c |j|}|jr|j||j|Sr)r[rr8rY)rr'r.s rrzTextWrapper.wrap[sA ##D)  $ $  & &v .  ((r!cD dj|j|S)N )rTrr&s rrzTextWrapper.fillis  yy4))r!) FrMrMTTFTTT)__name__ __module__ __qualname__dictfromkeysrSord _whitespacer% word_punctletterreescape whitespace nowhitespacecompileVERBOSEr+r-r3r r(r0r8rKrYr[rrr=r!rrrs#.` $}}Sk-BCHM!J F9299[11J*QR.(L ! 77" #J$ FL # 8j#89!bjj"'(O  "#%!$(&+"&!%"&' %'> ,$!3ReN! )*r!rc @ tdd|i|}|j|SNrr=)rrr'rkwargsws rrrus) *%*6*A 66$<r!c @ tdd|i|}|j|Srq)rrrrs rrrs) *%*6*A 66$<r!c td|dd|}|jdj|jj S)Nr )rrr r=)rrrTrQr,rrs rrrsD  7%177A 66#((4::<--/0 11r!z^[ ]+$z(^[ ]*)(?:[^ ])cX d}tjd|}tj|}|D]Y}||}|j |r|j |r|}.t t ||D]\}\}}||k7s|d|}Y[ |rtjd|zd|}|S)NrMz(?m)^) _whitespace_only_resub_leading_whitespace_refindall startswith enumeratezipr,rj)r'marginindentsrr6xylines rrrs F  " "2t ,D$,,T2G >F  v &   v &F 's66':; 6Aq6#BQZF<#. vvh'T2 Kr!cN dfd}dj|S)Nc"|jSr)rQ)rs r predicatezindent..predicates::< r!c3\KjdD]}|r|zn|ywr*) splitlines)rrprefixr's rprefixed_lineszindent..prefixed_liness,OOD)D$-dO6D= >*s),rM)rT)r'rrrs``` rrrs. ? 77># $$r!__main__z Hello there. This is indented.)r_r)rj__all__rgrrrrrn MULTILINErxrzrrraprintr=r!rrs H  _*_*H   2$!bjjR\\:#$;R\\J0f%$ z &4 56r!