0i*4dZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z mZddlmZddlmZmZdd lmZmZej.eZGd d ej4ZGd d eZGddej:ZGddeZy)zBase option parser setup) annotationsN) Generator)suppress)AnyNoReturn) UNKNOWN_ERROR) ConfigurationConfigurationError)redact_auth_from_url strtoboolcneZdZdZd fd Zd dZ d d dZddZddZddZ ddZ dd Z xZ S)PrettyHelpFormatterz4A prettier/less verbose help formatter for optparse.crd|d<d|d<tjddz |d<t| |i|y)Nmax_help_positionindent_incrementrwidth)shutilget_terminal_sizesuper__init__)selfargskwargs __class__s G/opt/hc_python/lib/python3.12/site-packages/pip/_internal/cli/parser.pyrzPrettyHelpFormatter.__init__sG&("#%&!" 224Q7!;w $)&)c$|j|SN)_format_option_strings)roptions rformat_option_stringsz)PrettyHelpFormatter.format_option_stringss**622rcg}|jr|j|jd|jr|j|jdt|dkDr|j d||j rd|j J|jxs|j j}|j|j|jdj|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 rr) _short_optsappend _long_optsleninsert takes_valuedestmetavarlowerformatjoin)rr#mvarfmtoptsepoptsr.s rr"z*PrettyHelpFormatter._format_option_strings"s    KK**1- .    KK))!, - t9q= KK6 "    ;;* **nn; (9(9(;G KKw}}7 8wwt}rc|dk(ry|dzS)NOptionsr&: )rheadings rformat_headingz"PrettyHelpFormatter.format_heading<s i rcndj|jtj|d}|S)zz Ensure there is only one newline between usage and the first heading if there is no description. z Usage: {}  )r0 indent_linestextwrapdedent)rusagemsgs r format_usagez PrettyHelpFormatter.format_usageAs/ $$T%6%6xu7Mt%TU rc|rkt|jdrd}nd}|jd}|j}|j t j |d}|d|d}|Sy)NmainCommands Description r<r7r&)hasattrparserlstriprstripr=r>r?)r descriptionlabels rformat_descriptionz&PrettyHelpFormatter.format_descriptionIsq t{{F+"%%,,T2K%,,.K++HOOK,H$OK"G3{m26K rc |r|Sy)Nr&r8)repilogs r format_epilogz!PrettyHelpFormatter.format_epilog[s Mrcp|jdDcgc]}||z }}dj|Scc}wNrG)splitr1)rtextindentline new_liness rr=z PrettyHelpFormatter.indent_linesbs:/3zz$/?@/?tVd]/? @yy##As 3)rrrrreturnNoner#optparse.OptionrYstr)z <{}>z, )r#r\r2r]r3r]rYr])r9r]rYr])r@r]rYr])rL str | NonerYr])rPr^rYr])rUr]rVr]rYr]) __name__ __module__ __qualname____doc__rr$r"r:rBrNrQr= __classcell__rs@rrrsU>*3NR%03GJ 4 $$rrc$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 cd}|jt|jtsJ|jj|jj|j J|jjj |j }t|!|}|rV|jdk(rGt|tr|g}t|tsg}|D]}|j|t|}|S)NURL)rI isinstanceConfigOptionParser_update_defaultsdefaultsr-getrexpand_defaultr.r]listreplacer )rr#default_values help_textvalrs rrnz,UpdatingDefaultsHelpFormatter.expand_defaultps ;; "dkk+=> >> KK ( ()=)= >;;* **![[1155fkkBNG*62 fnn5.#."0!1nd3!#%%--c3G3LM &rr[)r_r`rarbrnrcrds@rrfrfgsrrfc6eZdZ ddZeddZy)CustomOptionParserc|j|i|}|jj|jj|||S)z*Insert an OptionGroup at a given position.)add_option_group option_groupspopr+)ridxrrgroups rinsert_option_groupz&CustomOptionParser.insert_option_groupsH&%%t6v6   !!#u- rc||jdd}|jD]}|j|j|S)z++-F;;* **ll6;;/G'3' //1(.(:(:7G(L% . x((" / IImSX . . /sD D5 D00D5ct|jtj|jt|dyrS) print_usagerstderrrr)rrAs rrzConfigOptionParser.error(s( $ -C5,r) rrrr]rboolrrrYrZ)r#r\rr]rsrrYr)rYz&Generator[tuple[str, Any], None, None])rldict[str, Any]rYr)rYzoptparse.Values)rAr]rYr) r_r`rarbrrrrkrrrcrds@rrjrjsd7 * * * *  *  *. /.:>@),-rrj) rb __future__rloggingrrrr>collections.abcr contextlibrtypingrrpip._internal.cli.status_codesrpip._internal.configurationr r pip._internal.utils.miscr r getLoggerr_rIndentedHelpFormatterrrf OptionParserrurjr8rrrs" % 8ID   8 $O$(88O$d$7@..,M-+M-r