ܾPjdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddlmZmZddlmZddlmZdd lmZdd lmZmZdd lmZdd lmZmZeje Z!Gd dej"Z#Gdde#Z$Gddej%Z&Gdde&Z'dS)zBase option parser setup) annotationsN) Generator)suppress)AnyNoReturnescape)Theme) UNKNOWN_ERROR) ConfigurationConfigurationError) PipConsole)redact_auth_from_url strtoboolceZdZdZdddddZddd Zd"fd Zd#dZd#dZd$dZ d%dZ d&dZ d'dZ d#fd Z d(d!ZxZS))PrettyHelpFormatterz4A prettier/less verbose help formatter for optparse.greencyanz bold blueyellow)zoptparse.shortargszoptparse.longargszoptparse.groupszoptparse.metavar shortargslongargs)z\s(-{1}[\w]+[\w-]*)z\s(-{2}[\w]+[\w-]*)argsrkwargsreturnNonecd|d<d|d<tjddz |d<tj|i|dS)Nmax_help_positionindent_incrementrwidth)shutilget_terminal_sizesuper__init__)selfrr __class__s x/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/pip/_internal/cli/parser.pyr&zPrettyHelpFormatter.__init__)sW&("#%&!" 244Q7!;w$)&)))))optionoptparse.Optionstrcg}|jr$|d|jdd|jr$|d|jddt|dkr|dd|ra|jJ|jp|j}|dt|d d |S) z=Return a comma-separated list of option strings and metavars.z[optparse.shortargs]rz[/]z[optparse.longargs]rz, Nz [optparse.metavar][/]) _short_optsappend _long_optsleninsert takes_valuedestmetavarlowerr join)r'r+optsr7s r)format_option_stringsz)PrettyHelpFormatter.format_option_strings0s    K KKIv/A!/DIII J J J   I KKGf.?.BGGG H H H t99q== KK4      N;***n; (9(9(;(;G KKLvgmmoo/F/FLLL M M Mwwt}}r*cg}j|}jjz dz }tjdd|}t |t |z }t ||krdjd|fz}j}ndjd||z|fz}d}|||jrz|}tj |j } |d|d| dfz| fd| dd Dn!|d d kr|d d |S) z$Overridden method with Rich support.r!z(\[[a-z.]+\])|(\[\/\])r/%*s%s z %*s%-*s rc*g|]}djd|fzS)r=r/) help_position).0liner's r) z5PrettyHelpFormatter.format_option..Ys8777#%(:B'EE777r*rN )option_stringsr?current_indentresubr3r1helpexpand_defaulttextwrapwrap help_widthextendr9) r'r+resultr: opt_widthstrippedstyle_tag_length indent_first help_text help_liness ` r) format_optionz!PrettyHelpFormatter.format_optionBs"6*&)<>t99s8}}4 x==9 $ $ 3R>>D-LL$"5r"+.>">"FFDL d ; ++F33I!y$/BBJ MM)|RA&GG H H H MM7777'1!""~777 8 8 8 8 "X   MM$   wwvr*headingc<|dkrdSdt|zdzS)NOptionsr/z[optparse.groups]z:[/] r)r'rWs r)format_headingz"PrettyHelpFormatter.format_heading`s( i  2"VG__4x??r*usagec||tj|d}dt|d}|S)zz Ensure there is only one newline between usage and the first heading if there is no description.  z [optparse.groups]Usage:[/] rD) indent_linesrKdedentr )r'r[contentsmsgs r) format_usagez PrettyHelpFormatter.format_usagees@ $$X_U%;%;TBBBfX.>.>BBB r* description str | Nonec|rut|jdrd}nd}|d}|}|t j|d}|d|d}|SdS)Nmainz[optparse.groups]Commands:[/]z [optparse.groups]Description:[/]rDr]r/)hasattrparserlstriprstripr^rKr_)r'rclabels r)format_descriptionz&PrettyHelpFormatter.format_descriptionns  t{F++ ;7:&,,T22K%,,..K++HOK,H,H$OOK"55k555K 2r*epilogc(|rt|SdS)Nr/r)r'rms r) format_epilogz!PrettyHelpFormatter.format_epilogs  &>> !2r*ctt|}|jD]\}}t j|d|d|} |S)z@Overridden HelpFormatter.expand_default() which colorizes flags.z [optparse.z] \1[/])r r%rJ highlightsitemsrGrH)r'r+rIregexstyler(s r)rJz"PrettyHelpFormatter.expand_defaultskegg,,V4455 O1133 E ELE56%!=u!=!=!=tDDDD r*textindentcpfd|dD}d|S)Ncg|]}|zSry)r@rArvs r)rBz4PrettyHelpFormatter.indent_lines..s@@@tVd]@@@r*rD)splitr9)r'rurv new_liness ` r)r^z PrettyHelpFormatter.indent_liness:@@@@tzz$/?/?@@@ yy###r*)rrrrrrr+r,rr-)rWr-rr-)r[r-rr-)rcrdrr-)rmrdrr-)rur-rvr-rr-)__name__ __module__ __qualname____doc__stylesrqr&r;rVrZrbrlrorJr^ __classcell__r(s@r)rrs>>&#&$ F!, *J ******$<@@@@ &$$$$$$$$r*rc$eZdZdZdfd ZxZS)UpdatingDefaultsHelpFormatterzCustom help formatter for use in ConfigOptionParser. This is updates the defaults before expanding them, allowing them to show up correctly in the help listing. Also redact auth from url type options r+r,rr-cd}|jmt|jtsJ|j|jj|jJ|jj|j}t|}|rb|j dkrWt|tr|g}t|tsg}|D]%}| |t|}&|S)NURL)rh isinstanceConfigOptionParser_update_defaultsdefaultsr6getr%rJr7r-listreplacer)r'r+default_valuesrTvalr(s r)rJz,UpdatingDefaultsHelpFormatter.expand_defaults ; "dk+=>> > >> K ( ()= > > >;***![155fkBBNGG**622  Nfn55.#.. 2"0!1nd33 $!#% N N%--c3G3L3LMM r*r|)r}r~rrrJrrs@r)rrsGr*rc.eZdZd dZed d Zd S)CustomOptionParseridxintrrrroptparse.OptionGroupc|j|i|}|j|j|||S)z*Insert an OptionGroup at a given position.)add_option_group option_groupspopr4)r'rrrgroups r)insert_option_groupz&CustomOptionParser.insert_option_groupsN&%t6v66     !!#u--- r*list[optparse.Option]cl|jdd}|jD]}||j|S)zzGConfigOptionParser._get_ordered_configuration_items..s'9 9 9 D"9 9 9 r*.rcZi|]'}|d|D(S)c g|] \}}|||f Sryry)r@kvs r)rBzRConfigOptionParser._get_ordered_configuration_items...s%LLLda!LAq6LLLr*)rr)r@rsection_items_dicts r)rzGConfigOptionParser._get_ordered_configuration_items..sL    LL&8&>&D&D&F&FLLL   r*)rrrrrz) r'override_order_value section_keyrsectionr section_itemsrs @r) _get_ordered_configuration_itemsz3ConfigOptionParser._get_ordered_configuration_itemss#DIw7 9 9 !/9 9 9  ))++ ; ;HAu$)KKMM ; ; S*00a88 n,,7:&w/4  ;    &   & . .G$W- - - - - - - - - . .r*rdict[str, Any]ctjj_t }D]\}dz!jJjdvr> t|}n#t$r |ddYnwxYwjdkrtt5t|}dddn #1swxYwYtt5t|}dddn #1swxYwYt|tr|dkr |ddnƉjd kr%|}fd |D}njd krtjJ|j}||}jpd }jpi}j||g|Ri|n|}||j<|D]t/j|<d_|S) zUpdates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).z--N) store_true store_falsez is not a valid value for zO option, please specify a boolean value like yes/no, true/false or 1/0 instead.countrz option, please instead specify either a non-negative integer or a boolean value like yes/no or false/true which is equivalent to 1/0.r1c>g|]}|Sry)r)r@rrr+r's r)rBz7ConfigOptionParser._update_defaults..-s+GGGat))&#q99GGGr*callbackry)rValuesrvaluessetr get_optionr6actionr ValueErrorerrorrrrrzraddget_opt_string convert_value callback_argscallback_kwargsrgetattr) r'r late_evalropt_strrrrr+s ` @@r)rz#ConfigOptionParser._update_defaultssQ odm44 EE ==??0 (0 (HC__TCZ00F ~;***} ===#C..CC!JJ55#555 '))j))))#C..C)))))))))))))))j))##c((C###############!#s++sQwwJJ66#666 (**iikkGGGGGG3GGG*,,222 fk*** //11**7C88+1r/52dLTLLLVLLLL((c::$'HV[ ! ! 6 6C#DK55HSMM s68B  %B21B2C00C4 7C4 D++D/ 2D/ optparse.Valuescx|jstj|jS |jn?#t $r2}|tt|Yd}~nd}~wwxYw| |j }| D]l}|j J||j }t|tr2|}|||||j <mtj|S)zOverriding to make updating the defaults after instantiation of the option parser possible, _update_defaults() does the dirty work.N)process_default_valuesrrrrloadr rr r-rcopy_get_all_optionsr6rrrr)r'errrr+defaultrs r)get_default_valuesz%ConfigOptionParser.get_default_valuesAs7* 2?4=11 1 / K      ! / / / IImSXX . . . . . . . . /((););)=)=>>++-- M MF;***ll6;//G'3'' M //11(.(:(:7G(L(L%x(((s< A8(A33A8rarc|tj|t|ddS)NrD) print_usagerstderrrr )r'ras r)rzConfigOptionParser.errorWs8 $$$ -C,,,,,r*Nfilec~dtjvpItttjddpdp dtjv}tttj ||}| | ddS)Nz --no-color PIP_NO_COLORnoNO_COLOR)themeno_colorrF) highlight)rargvrrosenvironrrr rrr format_helprj)r'rrconsoles r) print_helpzConfigOptionParser.print_help[s CH $ (Ibjnn^TBBJdKKLL (RZ'  +233hT     d&&((//11U CCCCCr*) rrrr-rrrrrr)r+r,rr-rrrr)rr)rrrr)rr)rar-rrr)rrrr) r}r~rrr&rrrrrrrrs@r)rrs77 * * * * * * * *....>>>>>@)))),---- D D D D D D D D Dr*r)(r __future__rloggingrrrGr#rrKcollections.abcr contextlibrtypingrrpip._vendor.rich.markupr pip._vendor.rich.themer pip._internal.cli.status_codesr pip._internal.configurationr r pip._internal.utils.loggingrpip._internal.utils.miscrr getLoggerr}loggerIndentedHelpFormatterrr OptionParserrrryr*r)rs"""""" %%%%%% ******((((((888888IIIIIIII222222DDDDDDDD  8 $ $v$v$v$v$v$(8v$v$v$r$7@.,\D\D\D\D\D+\D\D\D\D\Dr*