/usr/local/lib/python3.6/site-packages/click/__pycache__
NameSizeModeActions
core.cpython-36.pyc879320644editdlrm
decorators.cpython-36.pyc143500644editdlrm
exceptions.cpython-36.pyc100380644editdlrm
formatting.cpython-36.pyc92390644editdlrm
globals.cpython-36.pyc23600644editdlrm
parser.cpython-36.pyc134390644editdlrm
shell_completion.cpython-36.pyc166130644editdlrm
termui.cpython-36.pyc262610644editdlrm
testing.cpython-36.pyc146710644editdlrm
types.cpython-36.pyc329570644editdlrm
utils.cpython-36.pyc177250644editdlrm
_compat.cpython-36.pyc156730644editdlrm
_termui_impl.cpython-36.pyc156500644editdlrm
_textwrap.cpython-36.pyc14650644editdlrm
_unicodefun.cpython-36.pyc22950644editdlrm
_winconsole.cpython-36.pyc76780644editdlrm
__init__.cpython-36.pyc26480644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/click/__pycache__/parser.cpython-36.pyc (13439B)
3 _TBgdJ @s~dZddlZddlmZddlmZddlmZddlm Z ddlm Z dd lm Z dd lm Z ej rddlZdd lmZdd lmZdd lmZddlmZejdZeZejeejeejejej eejej!edfej"efdddZ#eejeefdddZ$eej!dedddZ%eej"edddZ&GdddZGdd d ZGd!d"d"Z'Gd#d$d$Z(dS)%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) ParameterV)args nargs_specreturncstt|}g}ddtjtdfdd x|rΈ|}|dkrJq4|dkrb|jq4|dkrfddt|D}dk r|j|jt|q4|d kr4dk rtd t ||jdq4Wdk r t|<gt |dd|dd<t|t fS) aGiven 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`. Nz te.Deque[V])crc s6ydkr|jS|jSWntk r0dSXdS)N)popleftpop IndexError)r)spos-/tmp/pip-build-0s3hx122/click/click/parser.py_fetchBs  z_unpack_args.._fetchrcsg|] }qSrr).0_)rrrr Tsz _unpack_args..rzCannot have two nargs < 0) rtOptionalrappendrangereversetuple TypeErrorlenreversedlist)rrrvnargsxr)rrrr _unpack_args1s4     r*)optrcCsT|dd}|jrd|fS|dd|krD|dd|ddfS||ddfS)Nr)isalnum)r+firstrrr split_optms  r0r )r+ctxrcCs4|dks|jdkr|St|\}}||j|S)N)Ztoken_normalize_funcr0)r+r1prefixrrr normalize_optvs r3)stringrc Cshddl}|j|dd}d|_d|_g}yx|D]}|j|q.WWn tk rb|j|jYnX|S)aSplit 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,)shlexwhitespace_split commentersr ValueErrortoken)r4r6lexoutr:rrrsplit_arg_string}s r=c@sdeZdZddejeejeejeeejejdddZ e e ddd Z ed dd d d Z dS)r Nr CoreOption)objoptsdestactionr(constc Csg|_g|_t|_xz|D]r}t|\}} |s>td|d|jj|dt|dkrtt| dkrt|jj|q|jj||jj|qW|dkrd}||_ ||_ ||_ ||_ ||_ dS)Nz$Invalid start character for option ()rrstore) _short_opts _long_optssetprefixesr0r9addr$rrArBr(rCr?) selfr?r@rArBr(rCr+r2valuerrr__init__s&    zOption.__init__)rcCs |jdkS)NrEr)rEr)rB)rKrrr takes_valueszOption.takes_value ParsingState)rLstatercCs|jdkr||j|j<n|jdkr2|j|j|j<n|jdkrT|jj|jgj|n^|jdkrx|jj|jgj|jn:|jdkr|jj|jdd|j|j<ntd|jd |jj|j dS) NrE store_constr append_constcountrrzunknown action '') rBr@rArC setdefaultrgetr9orderr?)rKrLrPrrrprocesss     zOption.process)NrN)__name__ __module__ __qualname__rSequencestrrintAnyrMpropertyboolrNrXrrrrr s 4r c@sTeZdZd dejeedddZejejeej ejefdddd d Z dS) r r CoreArgument)r?rAr(cCs||_||_||_dS)N)rAr(r?)rKr?rAr(rrrrMszArgument.__init__rON)rLrPrcCs|jdkr\|dk sttdd|D}|t|kr:d}n"|dkr\ttdj|j|jd|jdkr~|jj dk r~|fkr~d}||j |j<|j j |jdS)Nrcss|]}|dkrdVqdS)Nrr)rr)rrr sz#Argument.process..rz'Argument {name!r} takes {nargs} values.)namer() r(AssertionErrorsumr$rrformatrAr?Zenvvarr@rWr)rKrLrPZholesrrrrXs    zArgument.process)r) rYrZr[rrr]r^rMUnionr\rXrrrrr sr c@s"eZdZejeddddZdS)rON)rargsrcCsi|_g|_||_g|_dS)N)r@largsrjrW)rKrjrrrrMszParsingState.__init__)rYrZr[rListr]rMrrrrrOsrOc @s(eZdZdZd$ejdddddZd%dejeejeejee ejej dd d d Z d&d ejee dd ddZ ej eejejeej fej eej dfdddZeddddZeddddZeejeeddddZeeddddZeeeej dd d!Zeeddd"d#ZdS)' 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. Nr )r1rcCsJ||_d|_d|_|dk r*|j|_|j|_i|_i|_ddh|_g|_dS)NTF-z--)r1allow_interspersed_argsignore_unknown_options _short_opt _long_opt _opt_prefixes_args)rKr1rrrrM s zOptionParser.__init__rr>)r?r@rArBr(rCrc slfdd|D}t||||||d}jj|jx|jD]}|j|<q.)rBr(rCN)r rsupdaterIrFrqrGrr) rKr?r@rArBr(rCoptionr+r)rKr add_option#s  zOptionParser.add_optionrb)r?rAr(rcCs|jjt|||ddS)zAdds 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. )rAr(N)rtrr )rKr?rAr(rrr add_argument<szOptionParser.add_argument CoreParameter)rrc Cs\t|}y|j||j|Wn*tk rJ|jdksD|jj rFYnX|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) rO_process_args_for_options_process_args_for_argsr r1Zresilient_parsingr@rkrW)rKrrPrrr parse_argsFs  zOptionParser.parse_args)rPrcCsZt|j|jdd|jD\}}x&t|jD]\}}|j|||q.W||_g|_dS)NcSsg|] }|jqSr)r()rr)rrrrZsz7OptionParser._process_args_for_args..)r*rkrjrt enumeraterX)rKrPZpargsridxargrrrr{Xs  z#OptionParser._process_args_for_argscCs~xx|jrx|jjd}t|}|dkr(dS|dd|jkrP|dkrP|j||q|jrd|jj|q|jjd|dSqWdS)Nrz--r) rjrr$rs _process_optsrorkrinsert)rKrPrZarglenrrrrzcs z&OptionParser._process_args_for_options)r+explicit_valuerPrcCs||jkr2ddlm}|||j}t|||jd|j|}|jrh|dk rX|jjd||j|||}n$|dk rt |t dj |dnd}|j ||dS)Nr)get_close_matches) possibilitiesr1z&Option {name!r} does not take a value.)rd) rrdifflibrrr1rNrjr_get_value_from_staterrrhrX)rKr+rrPrrrvrLrrr_match_long_opts    zOptionParser._match_long_opt)rrPrc Csd}d}|d}g}x|ddD]}t|||j}|jj|} |d7}| sr|jrd|j|q"t||jd| jr|t|kr|j j d||dd}|j || |} nd} | j | ||r"Pq"W|jr|r|j j|dj|dS)NFrr)r1Tr,)r3r1rqrVrprrrNr$rjrrrXrkjoin) rKrrPstopir2Zunknown_optionschr+rvrLrrr_match_short_opts0     zOptionParser._match_short_opt) option_namervrPrcCs|j}t|j|kr@|jjr"t}qt|tdd|j||dnt|dkr|jd}|jjrt|t r|dd|j krt|dkrt}q|jj d}nt |jd|}|jd|=|S)Nz%Option {name!r} requires an argument.z+Option {name!r} requires {nargs} arguments.)rdr(rr) r(r$rjr?_flag_needs_valuerrrh isinstancer]rsrr")rKrrvrPr(rLZ next_rargrrrrs,    z"OptionParser._get_value_from_statec Csd}d|kr|jdd\}}n|}t||j}y|j|||WnJtk r|dd|jkrr|j||dS|jsz|jj |YnXdS)N=rr-) splitr3r1rrrsrrprkr)rKrrPrZlong_optZ norm_long_optrrrrs  zOptionParser._process_opts)N)NrN)r)rYrZr[__doc__rrrMr\r]r^r_rwrxrlTupleDictr|rOr{rzrrr rrrrrrrms$ ( 2 % )$rm))rZtypingr collectionsrrrr exceptionsrrrr Z TYPE_CHECKINGZtyping_extensionstecorer rbr r r>r ryZTypeVarrobjectrr\r]r^rrirrlr*r0r3r=rOrmrrrrs2            <: "6