Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/click/__pycache__/parser.cpython-37.pyc

112 lines
11 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
<00>/<2F>]<5D><<00>@s<>dZddlZddlmZddlmZmZmZmZdd<07>Z dd <09>Z
d
d <0B>Z d d <0A>Z dd<0F>Z Gdd<11>de<0E>ZGdd<13>de<0E>ZGdd<15>de<0E>ZGdd<17>de<0E>ZdS)aE
click.parser
~~~~~~~~~~~~
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.
<EFBFBD>N)<01>deque<75>)<04>
UsageError<EFBFBD> NoSuchOption<6F>BadOptionUsage<67>BadArgumentUsagecst<00><01><01>t|<01>}g}d<01><02>fdd<03><08>x<>|r<><72>|<01>}|dkrJ|<02><01><00><01><01>q&|dkr<><72><00>fdd<06>t|<03>D<00>}<04>dk rz|<04><03>|<02>t|<04><01>q&|dkr&<26>dk r<>td<08><01>t|<02><01>|<02>d<01>q&W<00>dk r<>t<04><01>|<02><g<00>t|<02>dd<01><00>|<02>dd<01><t|<02>t<08><01>fS) 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`.
Ncs6y<1C>dkr|<00><00>S|<00><01>SWntk
r0dSXdS)N)<03>popleft<66>pop<6F>
IndexError)<01>c)<01>spos<6F><00>//tmp/pip-install-c3kgu56x/click/click/parser.py<70>_fetch(s  z_unpack_args.<locals>._fetchrcsg|] }<01><00><01><01>qSr r )<02>.0<EFBFBD>_)r<00>argsr r<00>
<listcomp>6sz _unpack_args.<locals>.<listcomp>rzCannot have two nargs < 0) r<00>append<6E>range<67>reverse<73>tuple<6C> TypeError<6F>len<65>reversed<65>list)rZ
nargs_spec<EFBFBD>rv<72>nargs<67>xr )rrr r<00> _unpack_argss0
   rcCs,|dkrt|d|<00><02>t|d||f<00><02>dS)Nrz%s option requires an argumentz%s option requires %d arguments)r)r<00>optr r r<00>_error_opt_argsLsr!cCsT|dd<01>}|<01><00>rd|fS|dd<03>|krD|dd<03>|dd<00>fS||dd<00>fS)Nr<00><00>)<01>isalnum)r <00>firstr r r<00> split_optRs  r&cCs0|dks|jdkr|St|<00>\}}||<01>|<00>S)N)Ztoken_normalize_funcr&)r <00>ctx<74>prefixr r r<00> normalize_opt[s r)c Cs<>g}x<>t<00>d|tj<02>D]<5D>}|<02><03><00><04>}|dd<03>|dd<02>krh|dd<03>dkrh|dd<04><00>dd<07><02>d<08>}yt|<00>|<03>}Wntk
r<EFBFBD>YnX|<01> |<03>qW|S) zDGiven an argument string this attempts to split it into small parts.z>('([^'\\]*(?:\\.[^'\\]*)*)'|"([^"\\]*(?:\\.[^"\\]*)*)"|\S+)\s*Nr<00><><EFBFBD><EFBFBD><EFBFBD>z"'<27>ascii<69>backslashreplacezunicode-escape)
<EFBFBD>re<72>finditer<65>S<>group<75>strip<69>encode<64>decode<64>type<70> UnicodeErrorr)<04>stringr<00>match<63>argr r r<00>split_arg_stringbs (r9c@s*eZdZd dd<04>Zedd<06><00>Zdd<08>ZdS)
<EFBFBD>OptionNrc
Cs<>g|_g|_t<02>|_xv|D]n}t|<07>\}} |s:td|<00><01>|j<03>|d<00>t|<08>dkrpt| <09>dkrp|j<00>|<07>q|j<01>|<07>|j<03>|<08>qW|dkr<>d}||_ ||_
||_ ||_ ||_ dS)Nz'Invalid start character for option (%s)rr<00>store)<0E> _short_opts<74>
_long_opts<EFBFBD>set<65>prefixesr&<00>
ValueError<EFBFBD>addrr<00>dest<73>actionr<00>const<73>obj)
<EFBFBD>self<6C>optsrBrCrrDrEr r(<00>valuer r r<00>__init__vs(
  zOption.__init__cCs
|jdkS)N)r;r)rC)rFr r r<00> takes_value<75>szOption.takes_valuecCs<>|jdkr||j|j<n<>|jdkr2|j|j|j<n||jdkrT|j<01>|jg<00><02>|<01>nZ|jdkrx|j<01>|jg<00><02>|j<03>n6|jdkr<>|j<01>|jd<06>d|j|j<ntd|j<00><01>|j<08>|j <09>dS) Nr;<00> store_constr<00> append_const<73>countrrzunknown action %r)
rCrGrBrD<00>
setdefaultr<00>getr@<00>orderrE)rFrH<00>stater r r<00>process<73>s




zOption.process)NrNN)<07>__name__<5F>
__module__<EFBFBD> __qualname__rI<00>propertyrJrRr r r rr:ts
 r:c@seZdZddd<04>Zdd<06>ZdS)<08>ArgumentrNcCs||_||_||_dS)N)rBrrE)rFrBrrEr r rrI<00>szArgument.__init__cCsh|jdkrJtdd<03>|D<00><01>}|t|<01>kr.d}n|dkrJtd|j|jf<00><01>||j|j<|j<06>|j<08>dS)Nrcss|]}|dkrdVqdS)Nrr )rrr r r<00> <genexpr><3E>sz#Argument.process.<locals>.<genexpr>rzargument %s takes %d values) r<00>sumrrrBrGrPrrE)rFrHrQZholesr r rrR<00>s
  zArgument.process)rN)rSrTrUrIrRr r r rrW<00>s
rWc@seZdZdd<02>ZdS)<04> ParsingStatecCsi|_g|_||_g|_dS)N)rG<00>largs<67>rargsrP)rFr\r r rrI<00>szParsingState.__init__N)rSrTrUrIr r r rrZ<00>srZc@s^eZdZdZddd<04>Zddd<07>Zddd <09>Zd
d <0B>Zd d <0A>Zdd<0F>Z dd<11>Z
dd<13>Z dd<15>Z dS)<19> 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.
NcCsN||_d|_d|_|dk r*|j|_|j|_i|_i|_tddg<02>|_g|_dS)NTF<54>-z--)r'<00>allow_interspersed_args<67>ignore_unknown_options<6E>
_short_opt<EFBFBD> _long_optr><00> _opt_prefixes<65>_args)rFr'r r rrI<00>szOptionParser.__init__rc sx|dkr |}<06>fdd<03>|D<00>}t||||||d<04>}<07>j<01>|j<03>x|jD]}|<07>j|<qHWx|jD]}|<07>j|<qbWdS)ayAdds 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``, ``appnd_const`` or ``count``.
The `obj` can be used to identify the option in the order list
that is returned from the parser.
Ncsg|]}t|<01>j<01><02>qSr )r)r')rr )rFr rr<00>sz+OptionParser.add_option.<locals>.<listcomp>)rCrrDrE)r:rc<00>updater?r<rar=rb) rFrGrBrCrrDrE<00>optionr r )rFr<00>
add_option<EFBFBD>s


  zOptionParser.add_optioncCs&|dkr |}|j<00>t|||d<02><03>dS)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.
N)rBrrE)rdrrW)rFrBrrEr r r<00> add_argument<6E>szOptionParser.add_argumentcCsZt|<01>}y|<00>|<02>|<00>|<02>Wn(tk
rH|jdksB|jjsD<73>YnX|j|j|jfS)aZParses positional arguments and returns ``(values, args, order)``
for the parsed options and arguments as well as the leftover
arguments if there are any. The order is a list of objects as they
appear on the command line. If arguments appear multiple times they
will be memorized multiple times as well.
N) rZ<00>_process_args_for_options<6E>_process_args_for_argsrr'Zresilient_parsingrGr[rP)rFrrQr r r<00>
parse_argss
zOptionParser.parse_argscCsZt|j|jdd<02>|jD<00><01>\}}x&t|j<03>D]\}}|<05>|||<01>q.W||_g|_dS)NcSsg|]
}|j<00>qSr )r)rrr r rrsz7OptionParser._process_args_for_args.<locals>.<listcomp>)rr[r\rd<00> enumeraterR)rFrQZpargsr<00>idxr8r r rrjs  z#OptionParser._process_args_for_argscCs~xx|jrx|j<00>d<01>}t|<02>}|dkr(dS|dd<03>|jkrP|dkrP|<00>||<01>q|jrd|j<06>|<02>q|j<00>d|<02>dSqWdS)Nrz--r) r\r rrc<00> _process_optsr_r[r<00>insert)rFrQr8Zarglenr r rris z&OptionParser._process_args_for_optionscs<><00>|jkr.<2E>fdd<02>|jD<00>}t<01>||jd<03><03>|j<00>}|jr<>|dk rT|j<04>d|<02>|j}t|j<04>|krtt|<06><00>q<>|dkr<>|j<04> d<04>}q<>t
|jd|<06><00>}|jd|<06>=n|dk r<>t <0B>d<06><00><02>nd}|<05> ||<03>dS)Ncsg|]}|<01><00><00>r|<01>qSr )<01>
startswith)r<00>word)r r rrCsz0OptionParser._match_long_opt.<locals>.<listcomp>)<02> possibilitiesr'rrz%s option does not take a value) rbrr'rJr\rorrr!r rrrR)rFr <00>explicit_valuerQrrrfrrHr )r r<00>_match_long_optAs$

 zOptionParser._match_long_optc Cs2d}d}|d}g}x<>|dd<00>D]<5D>}t|||j<01>}|j<02>|<08>} |d7}| sn|jr`|<06>|<07>q"t||jd<04><02>| jr<>|t|<01>kr<>|j <09>
d||d<00><00>d}| j }
t|j <09>|
kr<>t |
|<08>q<>|
dkr<>|j <09> d<03>} q<>t|j d|
<EFBFBD><00>} |j d|
<EFBFBD>=nd} | <09>| |<02>|r"Pq"W|j<04>r.|<06>r.|j<10>|d<06>|<06><00>dS)NFrr)r'Tr")r)r'rarOr`rrrJrr\rorr!r rrRr[<00>join) rFr8rQ<00>stop<6F>ir(Zunknown_options<6E>chr rfrrHr r r<00>_match_short_optas< 
   zOptionParser._match_short_optcCs<>d}d|kr|<01>dd<02>\}}n|}t||j<02>}y|<00>|||<02>WnFtk
r<EFBFBD>|dd<03>|jkrn|<00>||<02>S|jsv<73>|j<08> |<01>YnXdS)N<>=rr#)
<EFBFBD>splitr)r'rtrrcryr`r[r)rFr8rQrsZlong_optZ norm_long_optr r rrn<00>s  zOptionParser._process_opts)N)NrNN)rN) rSrTrU<00>__doc__rIrgrhrkrjrirtryrnr r r rr]<00>s 



$ /r])r|r-<00> collectionsr<00>
exceptionsrrrrrr!r&r)r9<00>objectr:rWrZr]r r r r<00><module>s 3 0