z\n6dZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z mZddlmZddlmZmZdd lmZmZejeZGd d ejZGd d eZGddejZGddeZdS)zBase option parser setup) annotationsN) Generator)suppress)AnyNoReturn) UNKNOWN_ERROR) ConfigurationConfigurationError)redact_auth_from_url strtoboolc`eZdZdZdfd Zdd Z dd dZd!dZd"dZd#dZ d$dZ d%dZ xZ S)&PrettyHelpFormatterz4A prettier/less verbose help formatter for optparse.argsrkwargsreturnNonecd|d<d|d<tjddz |d<tj|i|dS)Nmax_help_positionindent_incrementrwidth)shutilget_terminal_sizesuper__init__)selfrr __class__s j/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pip/_internal/cli/parser.pyrzPrettyHelpFormatter.__init__sW&("#%&!" 244Q7!;w$)&)))))optionoptparse.Optionstrc,||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,optsr6s r r'z*PrettyHelpFormatter._format_option_strings"s   / 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_heading<s 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: {}  )r8 indent_linestextwrapdedent)rrAmsgs r format_usagez PrettyHelpFormatter.format_usageAs6 $$T%6%6xu7M7Mt%T%TUU r! description str | Nonec|rut|jdrd}nd}|d}|}|t j|d}|d|d}|SdS)NmainCommands Description rCr>r.)hasattrparserlstriprstriprDrErF)rrIlabels r format_descriptionz&PrettyHelpFormatter.format_descriptionIs  t{F++ &"%%,,T22K%,,..K++HOK,H,H$OOK"66{666K 2r!epilogc|r|SdS)Nr.r?)rrVs r format_epilogz!PrettyHelpFormatter.format_epilog[s  M2r!textindentcpfd|dD}d|S)Ncg|]}|zSr?r?).0linerZs r z4PrettyHelpFormatter.indent_lines..cs@@@tVd]@@@r!rO)splitr9)rrYrZ new_liness ` r rDz PrettyHelpFormatter.indent_linesbs:@@@@tzz$/?/?@@@ yy###r!)rrrrrrr"r#rr$)r)r*)r"r#r+r$r,r$rr$)r;r$rr$)rAr$rr$)rIrJrr$)rVrJrr$)rYr$rZr$rr$) __name__ __module__ __qualname____doc__rr(r'r@rHrUrXrD __classcell__rs@r rrs>>******3333NR4 $$$$$$$$$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)rQ isinstanceConfigOptionParser_update_defaultsdefaultsr5getrexpand_defaultr6r$listreplacer )rr"default_values help_textvalrs r rrz,UpdatingDefaultsHelpFormatter.expand_defaultps ; "dk+=>> > >> K ( ()= > > >;***![155fkBBNGG**622  Nfn55.#.. 2"0!1nd33 $!#% N N%--c3G3L3LMM r!rb)rcrdrerfrrrgrhs@r rjrjgsGr!rjc.eZdZd dZed d Zd S)CustomOptionParseridxintrrrroptparse.OptionGroupc|j|i|}|j|j|||S)z*Insert an OptionGroup at a given position.)add_option_group option_groupspopr3)rrzrrgroups 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'; ; ; D"; ; ; r!z6Ignoring configuration key '%s' as its value is empty..r)rritemsloggerdebugr`r0) roverride_order section_items_value section_keyrwsectionrs r _get_ordered_configuration_itemsz3ConfigOptionParser._get_ordered_configuration_itemss#DIw7; ; !/; ; ;  ))++ > >HAu$)KKMM > > SLLP#*00a88 n,,!'*113*=== >& . .G$W- - - - - - - - - . .r!rpdict[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.r0c>g|]}|Sr?)r)r]vrr"rs r r_z7ConfigOptionParser._update_defaults..s+GGGat))&#q99GGGr!callbackr?)rValuesrpvaluessetr get_optionr5actionr ValueErrorerrorrr{rmr`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/ 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_valuesrrrprloadr rrr$rocopy_get_all_optionsr5rqrmrr)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(A33A8rGrc|tj|t|ddS)NrO) print_usagerstderrrr)rrGs r rzConfigOptionParser.error(s8 $$$ -C,,,,,r!) rrrr$rrrrrr)r"r#rr$rwrrr)rr)rprrr)rr)rGr$rr) rcrdrerfrrrrorrrgrhs@r rnrns77 * * * * * * * *....:>>>>@)))),--------r!rn) rf __future__rloggingrrrrEcollections.abcr contextlibrtypingrrpip._internal.cli.status_codesrpip._internal.configurationr r pip._internal.utils.miscr r getLoggerrcrIndentedHelpFormatterrrj OptionParserryrnr?r!r rs"""""" %%%%%% 888888IIIIIIIIDDDDDDDD  8 $ $O$O$O$O$O$(8O$O$O$d$7@.,M-M-M-M-M-+M-M-M-M-M-r!