jf% UddlZddlmZddlmZddlmZddlm Z dZ ej e e d<dejejeefd eje d ffd Zdejejeefd e d ejejed ffd Z ddede dededed ef dZGddZdejed ejeeffdZdS)N)contextmanager)gettext)term_len) split_opt FORCED_WIDTHrowsreturn.ci}|D]K}t|D]9\}}t||dt|||<:Lt dt |DS)Nrc3 K|] \}}|V dS)N).0xys p/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/click/formatting.py z measure_table..s&66tq!666666) enumeratemaxgetrtuplesorteditems)r widthsrowidxcols r measure_tabler s!FAA!# A AHCfjja00(3--@@F3KK A 66vfllnn55666 6 66r col_countc#HK|D]}|d|t|z zzVdS)N))len)r rrs r iter_rowsr#sE33EYS122222233rNr!Ftextwidthinitial_indentsubsequent_indentpreserve_paragraphsc ddlm}|}||||d}|s||Sgg d d fd }|D]]}|s |d  5t |} |}| t |z |^|g} D]\ } }|d z5| r)| | |n(| ||dddn #1swxYwYd | S) aA helper function that intelligently wraps text. By default, it assumes that it operates on a single paragraph of text but if the `preserve_paragraphs` parameter is provided it will intelligently handle paragraphs (defined by two empty lines). If paragraphs are handled, a paragraph can be prefixed with an empty line containing the ``\b`` character (``\x08``) to indicate that no rewrapping should happen in that block. :param text: the text that should be rewrapped. :param width: the maximum width for the text. :param initial_indent: the initial indent that should be placed on the first line as a string. :param subsequent_indent: the indent string that should be placed on each consecutive line. :param preserve_paragraphs: if this flag is set then the wrapping will intelligently handle paragraphs. r) TextWrapperF)r'r(replace_whitespaceNr c sdSddkr6pdddddfn-pdddfdd=dS)NrT rF )stripappendjoin)bufindentpsr _flush_parzwrap_text.._flush_parFs  F q6<<>>T ! ! HHfk43qrr7););< = = = = HHfk5#((3--8 9 9 9 FFFrr0z r N) _textwrapr+ expandtabsfill splitlinesrlstripr2 extra_indent indent_onlyr3)r%r&r'r(r)r+wrapperr7lineorig_lenrvrawr4r5r6s @@@r wrap_textrEs2'&&&&& ??  Dk %+ G "||D!!!)+AC F!!    JLLLFF~#D>>{{}}!HTNN2 JJt    JLLL B..T  ! !#, / / . . . '--d334444 ',,t,,---  . . . . . . . . . . . . . . . ;;r??s0AEE E c eZdZdZ d dedejedejeddfdZd eddfd Z d!d Z d!d Z d"dededejeddfdZ deddfdZ d!dZdeddfdZ d#dejejeefdededdfdZededejdfdZedejdfdZdefdZdS)$ HelpFormatteraThis class helps with formatting text-based help pages. It's usually just needed for very special internal cases, but it's also exposed so that developers can write their own fancy outputs. At present, it always writes into memory. :param indent_increment: the additional increment for each level. :param width: the width for the text. This defaults to the terminal width clamped to a maximum of 78. Nindent_incrementr& max_widthr cddl}||_|d}|At}|8tt |j|dz d}||_d|_g|_ dS)NrPrH2) shutilrIrrminget_terminal_sizecolumnsr&current_indentbuffer)selfrIr&rJrNs r__init__zHelpFormatter.__init__rsx  0  I = E}C 8 8 : : BINNQRRTVWW #% rstringc:|j|dS)z1Writes a unicode string into the internal buffer.N)rSr2)rTrVs rwritezHelpFormatter.writes 6"""""rc0|xj|jz c_dS)zIncreases the indentation.NrRrIrTs rr5zHelpFormatter.indent t44rc0|xj|jzc_dS)zDecreases the indentation.NrZr[s rdedentzHelpFormatter.dedentr\rr!progargsprefixc$|tdd}|d|j|d}|j|jz }|t|dzkr9dt|z}|t ||||nx|||ddt |jt|dzz}|t |||||ddS) zWrites a usage line into the buffer. :param prog: the program name. :param args: whitespace separated list of arguments. :param prefix: The prefix for the first line. Defaults to ``"Usage: "``. NzUsage:r0>)r'r(r/)_rRr&rrXrEr)rTr_r`ra usage_prefix text_widthr5s r write_usagezHelpFormatter.write_usagesE >( &&&F @4#6@@@@@@ Z$"55 (<0025 6 68L111F JJ#/&,      JJ| $ $ $ JJt   C 3Xf5E5EFFJKF JJ*Vv    4rheadingcL|dd|j|ddS)z!Writes a heading into the buffer.r!rcz: N)rXrR)rTrjs r write_headingzHelpFormatter.write_headings6 b=4.======>>>>>rcB|jr|ddSdS)z#Writes a paragraph into the buffer.r/N)rSrXr[s rwrite_paragraphzHelpFormatter.write_paragraphs. ;  JJt       rr%c d|jz}|t||j||d|ddS)zaWrites re-indented text into the buffer. This rewraps and preserves paragraphs. r0T)r'r(r)r/N)rRrXrEr&)rTr%r5s r write_textzHelpFormatter.write_textsdt**  %"($(        4rr col_max col_spacingct|}t|}t|dkrtdt |d||z}t |t|D]_\}}|dd|j||s|d@t|||z kr)|d|t|z zn5|d|d||jzzt|j |z dz d}t||d } | } | rS|| dd| d d D](} |dd||jz| d)J|dad S) anWrites a definition list into the buffer. This is how options and commands are usually formatted. :param rows: a list of two item tuples for the terms and values. :param col_max: the maximum width of the first column. :param col_spacing: the number of spaces between the first and second column. rHz(Expected two columns for definition listrr!rcr/r0 T)r)rN) listrr" TypeErrorrOr#rXrRrrr&rEr<) rTr rrrsr first_colfirstsecondrh wrapped_textlinesrAs rwrite_dlzHelpFormatter.write_dlsDzzt$$ v;;!  FGG Gq 7++k9 &tS[[99 ! !ME6 JJ"???? 4    3)d.A"ABCCCTZ)3a7<zjoin_options..,s !A$r)keyz, c3&K|] }|dV dS)rNr )rrs rrzjoin_options..-s&&&aQqT&&&&&&r)rr2r"sortr3)rrCany_prefix_is_slashoptras r join_optionsrs B&&3" S=="&  3v;;$%%%%GGG 99&&2&&& & &(; ;;r)r$r!r!F)typingr contextlibrrrf_compatrparserrrrr__annotations__Iterablerrrrr#boolrErGrrr rrrs%%%%%% !% ajo$$$7 1738#457!'#s(:K77773 *QWS#X& '3473ZS!"3333 % FF F FF F  F  FFFFRr$r$r$r$r$r$r$r$j