7f;*.dZddlZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z mZddlmZddlmZmZddlmZmZejeZGdd ejZGd d eZGd d ejZGddeZdS)zBase option parser setupN)suppress)AnyDict GeneratorListOptionalTuple) UNKNOWN_ERROR) ConfigurationConfigurationError)redact_auth_from_url strtoboolc eZdZdZdededdffd ZdejdefdZ ddejd ed edefd Z dedefdZ dedefdZ de edefdZde edefdZdededefdZxZS)PrettyHelpFormatterz4A prettier/less verbose help formatter for optparse.argskwargsreturnNcd|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.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_internal/cli/parser.pyrzPrettyHelpFormatter.__init__sW&("#%&!" 244Q7!;w$)&)))))optionc,||SN)_format_option_strings)rr#s r!format_option_stringsz)PrettyHelpFormatter.format_option_stringss**6222r" <{}>, mvarfmtoptsepc g}|jr ||jd|jr ||jdt|dkr|d||rc|jJ|jp|j}|| |d |S)z Return a comma-separated list of option strings and metavars. :param option: tuple of (short opt, long opt), e.g: ('-f', '--format') :param mvarfmt: metavar format string :param optsep: separator rrN) _short_optsappend _long_optsleninsert takes_valuedestmetavarlowerformatjoin)rr#r*r+optsr5s r!r&z*PrettyHelpFormatter._format_option_stringss   / KK*1- . . .   . KK)!, - - - t99q== KK6 " " "      9;***n; (9(9(;(;G KKw}}77 8 8 8wwt}}r"headingc|dkrdS|dzS)NOptionsr-: )rr:s r!format_headingz"PrettyHelpFormatter.format_heading9s i  2r"usagec|d|tj|d}|S)zz Ensure there is only one newline between usage and the first heading if there is no description. z Usage: {}  )r7 indent_linestextwrapdedent)rr@msgs r! format_usagez PrettyHelpFormatter.format_usage>s6 $$T%6%6xu7M7Mt%T%TUU r" descriptionc|rut|jdrd}nd}|d}|}|t j|d}|d|d}|SdS)NmainCommands Description rBr=r-)hasattrparserlstriprstriprCrDrE)rrHlabels r!format_descriptionz&PrettyHelpFormatter.format_descriptionFs  t{F++ &"%%,,T22K%,,..K++HOK,H,H$OOK"66{666K 2r"epilogc|r|SdS)Nr-r>)rrTs r! format_epilogz!PrettyHelpFormatter.format_epilogXs  M2r"textindentcpfd|dD}d|S)Ncg|]}|zSr>r>).0linerXs r! z4PrettyHelpFormatter.indent_lines..`s@@@tVd]@@@r"rM)splitr8)rrWrX new_liness ` r!rCz PrettyHelpFormatter.indent_lines_s:@@@@tzz$/?/?@@@ yy###r")r(r))__name__ __module__ __qualname____doc__rroptparseOptionstrr'r&r?rGrrSrVrC __classcell__r s@r!rrsw>>*c*S*T******3HO33333NRo03GJ 4cc ##hsm$HSMc$$c$c$$$$$$$$r"rc6eZdZdZdejdeffd 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#rcd}|jmt|jtsJ|j|jj|jJ|jj|j}t|}|rb|j dkrWt|tr|g}t|tsg}|D]%}| |t|}&|S)NURL)rO isinstanceConfigOptionParser_update_defaultsdefaultsr4getrexpand_defaultr5rflistreplacer )rr#default_values help_textvalr s r!rrz,UpdatingDefaultsHelpFormatter.expand_defaultms ; "dk+=>> > >> K ( ()= > > >;***![155fkBBNGG**622  Nfn55.#.. 2"0!1nd33 $!#% N N%--c3G3L3LMM r") r`rarbrcrdrerfrrrgrhs@r!rjrjdsWX_r"rjcbeZdZdedededejfdZede ej fdZ dS)CustomOptionParseridxrrrc|j|i|}|j|j|||S)z*Insert an OptionGroup at a given position.)add_option_group option_groupspopr2)rrzrrgroups r!insert_option_groupz&CustomOptionParser.insert_option_groupsN&%t6v66     !!#u--- r"cl|jdd}|jD]}||j|S)zr"r!ryrysy  " .1       ho!6Xr"ryc eZdZdZdddededededd f fd Zd ej d ed edefdZ de e eefd d ffdZ deeefdeeeffdZdejfdZdedd fdZxZS)rnzsCustom option parser which updates its defaults by checking the configuration files and environmental variablesF)isolatedrnamerrrNc||_t||_|jsJtj|i|dSr%)rr configrr)rrrrrr s r!rzConfigOptionParser.__init__sJ #H-- yy$)&)))))r"r#keyrwc |||S#tj$r1}td|t jdYd}~dSd}~wwxYw)Nz(An error occurred during configuration: ) check_valuerdOptionValueErrorprintsysexit)rr#rrwexcs r! check_defaultz ConfigOptionParser.check_defaultso %%c3// /(    BSBB C C C HQKKKKKKKKK sA&AAc#VKd|jdg}d|D}|jD]]\}}|std|#|dd\}}||vr||||f^|D]}||D] \}}||fV dS)Nglobalz:env:ci|]}|gSr>r>)r[rs r! zGConfigOptionParser._get_ordered_configuration_items..s'; ; ; D"; ; ; r"z7Ignoring configuration key '%s' as it's value is empty..r)rritemsloggerdebugr^r/)roverride_order section_items section_keyrwsectionrs r! _get_ordered_configuration_itemsz3ConfigOptionParser._get_ordered_configuration_itemss #DIw7; ; !/; ; ; !% 1 1 3 3 : : K  M&,,S!44LGS.((g&--sCj999&  G)'2  S3h   r"rpctjj_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.r/c>g|]}|Sr>)r)r[vrr#rs r!r]z7ConfigOptionParser._update_defaults..s+GGGat))&#q99GGGr"callbackr>)rdValuesrpvaluessetr get_optionr4actionr ValueErrorerrorrrrmr^raddget_opt_string convert_value callback_argscallback_kwargsrgetattr) rrp late_evalrwopt_strrrrr#s ` @@r!roz#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/ cx|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_valuesrdrrprloadr rr rfrocopy_get_all_optionsr4rqrmrr)rerrrpr#defaultrs r!get_default_valuesz%ConfigOptionParser.get_default_valuess7* 2?4=11 1 / K      ! / / / IImSXX . . . . . . . . /((););)=)=>>++-- M MF;***ll6;//G'3'' M //11(.(:(:7G(L(L%x(((s< A8(A33A8rFc|tj|t|ddS)NrM) print_usagerstderrrr )rrFs r!rzConfigOptionParser.error$s8 $$$ -C,,,,,r")r`rarbrcrrfboolrrdrerrr rrrorrrrgrhs@r!rnrnsZ77 * * * * * *  *  * * * * * *HO#CC 5c?D$. /8>c3h>DcN>>>>@)HO)))),----------r"rn) rcloggingrdrrrD contextlibrtypingrrrrrr pip._internal.cli.status_codesr pip._internal.configurationr r pip._internal.utils.miscr r getLoggerr`rIndentedHelpFormatterrrj OptionParserryrnr>r"r!rs >>>>>>>>>>>>>>>>888888IIIIIIIIDDDDDDDD  8 $ $O$O$O$O$O$(8O$O$O$d$7@.,L-L-L-L-L-+L-L-L-L-L-r"