Files
cms-website/.deps_siteforge_v812/click/__pycache__/parser.cpython-312.pyc
T

176 lines
21 KiB
Plaintext
Raw Normal View History

Ë
îÅÙj{Jã óª—dZddlZddlmZddlmZddlmZddlm Z ddlm
Z
dd lm Z dd
lm Z ejrddlZdd lmZdd lmZdd
lmZddlmZej0d«Ze«Zdej8edej8edej>ej8ej@eej8ejBedfejDeffd„Z#dedej>eeffd„Z$dedejBddefd„Z%dedejDefd„Z&Gd„d«ZGd„d«ZGd„d «Z'Gd!„d"«Z(y)#a;
This module started out as largely a copy paste from the stdlib's
optparse module with the features removed that we do not need from
optparse because we implement them in Click on a higher level (for
instance type handling, help formatting and a lot more).
The plan is to remove more and more from here over time.
The reason this is a different module and not optparse from the stdlib
is that there are differences in 2.x and 3.x about the error messages
generated and optparse in the stdlib uses gettext for no good reason
and might cause us issues.
Click uses parts of optparse written by Gregory P. Ward and maintained
by the Python Software Foundation. This is limited to code in parser.py.
Copyright 2001-2006 Gregory P. Ward. All rights reserved.
Copyright 2002-2006 Python Software Foundation. All rights reserved.
éN)Údeque)Úgettext)Úngettexté)ÚBadArgumentUsage)ÚBadOptionUsage)Ú NoSuchOption)Ú
UsageError)ÚArgument)ÚContext)ÚOption)Ú ParameterÚVÚargsÚ
nargs_specÚreturncóT‡—t|«}t|«}g}dŠdddtjtfˆfd„ }|r©||«}|€Œ
|dk(r|j ||««n~|dkDrKt |«D�cgc]
}||«‘Œ }}‰�|j
«|j t|««n.|dkr)‰� td«‚t|«Š|j d«|rŒ©‰�'t|«|‰<g}t|‰dzd«|‰dzdt|«t|«fScc}w) a�Given an iterable of arguments and an iterable of nargs specifications,
it returns a tuple with all the unpacked arguments at the first index
and all remaining arguments as the second.
The nargs specification is the number of arguments that should be consumed
or `-1` to indicate that this position should eat up all the remainders.
Missing items are filled with `None`.
NÚcz te.Deque[V]rcóh•— ‰€|j«S|j«S#t$rYywxYw©N)ÚpopleftÚpopÚ
IndexError)rÚsposs €úPC:\Users\30997\AppData\Local\Temp\pip-target-6g32zz5s\lib\python\click/parser.pyÚ_fetchz_unpack_args.<locals>._fetchDs6ø€ð ؈|Ø—y‘y“{Ð"à—u‘u“w�øÜò Ùð úsƒ%•%¥ 1°1rrzCannot have two nargs < 0) rÚtÚOptionalrÚappendÚrangeÚreverseÚtupleÚ TypeErrorÚlenÚreversedÚlist)rrÚrvrÚnargsÚ_Úxrs @rÚ _unpack_argsr+3s1ø€ô �‹;€DÜ�zÓ"€JØDF€BØ €Dð�-ð¤A§J¡J¬q¡Mõñ Ù�zÓ"ˆà ˆ=Ø à �AŠ:Ø �I‰I‘f˜T“lÕ #Ø
�QŠYÜ',¨U¤|Ó4¡| !‘˜• |ˆAÐ4ðÐØ— ‘ ” à �I‰I”e˜A“hÕ Ø
�QŠYØÐÜÐ ;Ó<Ð<ä�r“7ˆDØ �I‰I�dŒOò- ð4 Ðܘ“;ˆˆ4‰ØˆÜ! " T¨A¡X Z .Ó1ˆˆ4�!‰8ˆ:ˆä �‹9”d˜4“jÐ Ð ùò-5sÁ7D%Úoptcóf—|dd}|j«rd|fS|dd|k(r
|dd|ddfS||ddfS)NrÚé)Úisalnum)r,Úfirsts rÚ split_optr2osT€Ø ��ˆG€EØ ‡}�}„Ø�3ˆwˆØ
ˆ1ˆQ€x�5ÒØ�2�Aˆw˜˜A˜B˜ÐÐØ �#�a�b�'ˆ>ÐóÚctxr cóh—|� |j€|St|«\}}|›|j|«›�Sr)Útoken_normalize_funcr2)r,r4Úprefixs rÚ
normalize_optr8xs?ۯ
€{�c×.Ñ.Ð6؈
ܘC“.�K€FˆC؈X�c×.Ñ.¨sÓ3Ð4Ð 5Ð5r3ÚstringcóÞ—ddl}|j|d¬«}d|_d|_g} |D]}|j|«Œ |S#t$r|j|j
«Y|SwxYw)aŸSplit an argument string as with :func:`shlex.split`, but don't
fail if the string is incomplete. Ignores a missing closing quote or
incomplete escape sequence and uses the partial token as-is.
.. code-block:: python
split_arg_string("example 'my file")
["example", "my file"]
split_arg_string("example my\")
["example", "my"]
:param string: String to split.
rNT)Úposixr.)ÚshlexÚwhitespace_splitÚ
commentersrÚ
ValueErrorÚtoken)r9r<ÚlexÚoutr@s rÚsplit_arg_stringrCsw€óà
�+‰+�f Dˆ+Ó
)€CØ€CÔØ€C„NØ
€CðÛˆEØ �J‰J�uÕ ñð €Jøô
òð �
‰
�3—9‘9Õà €Jð
ús©AÁ$A,Á+A,cóî—eZdZ ddddejedej edej ededej ejf d „Z e
d
e fd „«Z d ejd
dd
dfd„Z
y)r
NÚobjÚ
CoreOptionÚoptsÚdestÚactionr(Úconstcóð—g|_g|_t«|_|D]­}t |«\}} |st d|›d�«‚|jj
|d«t|«dk(r*t| «dk(r|jj|«Œx|jj|«|jj
|«Œ¯|€d}||_ ||_
||_ ||_ ||_
y)Nz$Invalid start character for option (Ú)rrÚstore)Ú _short_optsÚ
_long_optsÚsetÚprefixesr2r?Úaddr$rrHrIr(rJrE)
ÚselfrErGrHrIr(rJr,r7Úvalues
rÚ__init__zOption.__init__¢sÞ€ðˆÔ؈ŒÜ$'£EˆŒ
ãˆCÜ% c›N‰MˆF�EÙÜ Ð#GÈÀuÈAÐ!NÓOÐOØ �M‰M× Ñ ˜f Q™iÔ (Ü�6‹{˜aÒ¤C¨£J°!¢OØ× Ñ ×'Ñ'¨Õ,à—‘×&Ñ& sÔ+Ø—
‘
×!Ñ! &Õ)ðð ˆ>؈FàˆŒ ؈Œ ؈Œ
؈Œ
؈�r3rcó—|jdvS)N)rMr)rI)rSs rÚ takes_valuezOption.takes_valueÃs€à�{‰{Ð1Ð1Ð1r3rTÚstateÚ ParsingStatecó—|jdk(r||j|j<�n0|jdk(r$|j|j|j<ný|jdk(r6|jj |jg«j |«n¸|jdk(r@|jj |jg«j |j«ni|jdk(rA|jj
|jd«dz|j|j<ntd|j›d �«‚|jj |j«y)
NrMÚ store_constrÚ append_constÚcountrrzunknown action 'Ú')
rIrGrHrJÚ
setdefaultrÚgetr?ÚorderrE)rSrTrXs rÚprocesszOption.processÇs €Ø �;‰;˜'Ò !Ø$)ˆE�J‰J�t—y‘yÓ !Ø
�[‰[˜MÒ
)Ø$(§J¡JˆE�J‰J�t—y‘yÒ !Ø
�[‰[˜HÒ
$Ø �J‰J× !Ñ ! $§)¡)¨RÓ 0× 7Ñ 7¸Õ >Ø
�[‰[˜NÒ
*Ø �J‰J× !Ñ ! $§)¡)¨RÓ 0× 7Ñ 7¸¿
¹
Õ CØ
�[‰[˜GÒ
#Ø$)§J¡J§N¡N°4·9±9¸aÓ$@À1Ñ$DˆE�J‰J�t—y‘yÒ !äÐ/°· ± ¨}¸AÐ>Ó?Ð ?Ø
� ‰ ×ј4Ÿ8™8Õ$r3©NrN)Ú__name__Ú
__module__Ú __qualname__rÚSequenceÚstrrÚintÚAnyrUÚpropertyÚboolrWrb©r3rr
r
¡s«„ð #'ØØ#'ñà
ðð�j‰j˜‰oðð�j‰j˜‰oð ð
—
‘
˜3‘ð ð ð
ð�z‰z˜!Ÿ%™%Ñ óðBð2˜Tò2óð2ð
%˜QŸU™Uð
%¨>ð
%¸dô
%r3r
có¼—eZdZd dddejedefd„Zdejejeejejefddd d
fd „Z
y
)
r rEÚ CoreArgumentrHr(có.—||_||_||_yr)rHr(rE©rSrErHr(s rrUzArgument.__init__Øs€ØˆŒ ؈Œ
؈�r3rTrXrYrNcóÀ—|jdkDre|€J‚td„|D««}|t|«k(rd}n>|dk7r9tt d«j |j |j¬««‚|jdk(r|jj�|dk(rd}||j|j <|jj|j«y)Nrc3ó&K—|] }|�Œd–—Œ y­w)Nrrm)Ú.0r*s rÚ <genexpr>z#Argument.process.<locals>.<genexpr>äsèø€Ð6¡5˜a¨A©Iœ¡5ùs‚Šrz'Argument {name!r} takes {nargs} values.©Únamer(éÿÿÿÿrm) r(Úsumr$rr)ÚformatrHrEÚenvvarrGrar)rSrTrXÚholess rrbzArgument.processÝsÇ€ð
�:‰:˜Š>ØÐ$Ð $Ð$ÜÑ6¡5Ó6Ó6ˆEØœ˜E›
Ò"ؘؑ!’Ü&ÜÐ?Ó@×GÑGØ!ŸY™Y¨d¯j©jðHóóðð �:‰:˜Ò  §¡§¡Ð ;ÀÈ ðˆEà %ˆ�
‰
�4—9‘9ÑØ
� ‰ ×ј4Ÿ8™8Õ$r3©r) rdrerfrrrhrirUÚUnionrgrbrmr3rr r ×sl„ñ˜Nð°!·*±*¸S±/ðÈ#óð
%à�w‰w�q—z‘z #‘¨¯
©
°1·:±:¸c±?Ñ(CÐCÑDð%ðð%ð
ô %r3r có6—eZdZdejeddfd„Zy)rYÚrargsrNcó<—i|_g|_||_g|_yr)rGÚlargsr€ra)rSr€s rrUzParsingState.__init__øs€Ø(*ˆŒ Ø"$ˆŒ
؈Œ
Ø,.ˆ�
r3)rdrerfrÚListrhrUrmr3rrYrY÷s„ð/˜aŸf™f S™kð/¨dô/r3rYcóp—eZdZdZd dej
dddfd„Z d!ddd ejed
ej
ed ej
ed e d
ej
ejddfd„Z d"ddd
ej
ed e ddfd„Z dejedejejeejfejeejdffd„Zdeddfd„Zdeddfd„Zdedej
ededdfd„Zdededdfd„Zdedededejfd„Zdededdfd„Zy)#Ú OptionParsera+The option parser is an internal class that is ultimately used to
parse options and arguments. It's modelled after optparse and brings
a similar but vastly simplified API. It should generally not be used
directly as the high level Click classes wrap it for you.
It's not nearly as extensible as optparse or argparse as it does not
implement features that are implemented on a higher level (such as
types or defaults).
:param ctx: optionally the :class:`~click.Context` where this parser
should go with.
Nr4r rcó²—||_d|_d|_|�"|j|_|j|_i|_i|_ddh|_g|_y)NTFÚ-ú--)r4Úallow_interspersed_argsÚignore_unknown_optionsÚ
_short_optÚ _long_optÚ
_opt_prefixesÚ_args)rSr4s rrUzOptionParser.__init__
sa€ðˆŒð
.2ˆÔ$ð
-2ˆÔ#à ˆ?Ø+.×+FÑ+FˆDÔ (Ø*-×*DÑ*DˆDÔ 'à/1ˆŒØ.0ˆŒØ! 4˜[ˆÔØ')ˆ�
r3rErFrGrHrIr(rJcó@—|D�cgc]}t||j«‘Œ}}t||||||¬«}|jj |j
«|j D]}||j|<Œ|jD]}||j|<Œycc}w)azAdds a new option named `dest` to the parser. The destination
is not inferred (unlike with optparse) and needs to be explicitly
provided. Action can be any of ``store``, ``store_const``,
``append``, ``append_const`` or ``count``.
The `obj` can be used to identify the option in the order list
that is returned from the parser.
)rIr(rJN)
r8r4r
r�ÚupdaterQrNr‹rOrŒ) rSrErGrHrIr(rJr,Úoptions rÚ
add_optionzOptionParser.add_option%s�€ñ"9=Ó=¹°”
˜c 4§8¡8Õ,¸ˆÐ=ܘ˜T 4°¸eÈ5ÔQˆØ ×Ñ×!Ñ! &§/¡/Ô2Ø×%Ô%ˆCØ#)ˆD�O‰O˜CÒ ð&à×$Ô$ˆCØ"(ˆD�N‰N˜3Ò ñ%ùò >s…BrocóR—|jjt|||¬««y)z±Adds a positional argument named `dest` to the parser.
The `obj` can be used to identify the option in the order list
that is returned from the parser.
)rHr(N)rŽrr rqs rÚ add_argumentzOptionParser.add_argument>s€ð
�
‰