/snap/core20/2769/usr/lib/python3.8/__pycache__
NameSizeModeActions
abc.cpython-38.pyc53340644editdlrm
aifc.cpython-38.pyc254740644editdlrm
antigravity.cpython-38.pyc7970644editdlrm
argparse.cpython-38.pyc625910644editdlrm
ast.cpython-38.pyc167630644editdlrm
asynchat.cpython-38.pyc68510644editdlrm
asyncore.cpython-38.pyc160280644editdlrm
base64.cpython-38.pyc170710644editdlrm
bdb.cpython-38.pyc249210644editdlrm
binhex.cpython-38.pyc121340644editdlrm
bisect.cpython-38.pyc23540644editdlrm
bz2.cpython-38.pyc114450644editdlrm
calendar.cpython-38.pyc270640644editdlrm
cgi.cpython-38.pyc265440644editdlrm
cgitb.cpython-38.pyc101500644editdlrm
chunk.cpython-38.pyc48390644editdlrm
cmd.cpython-38.pyc126260644editdlrm
code.cpython-38.pyc99130644editdlrm
codecs.cpython-38.pyc339560644editdlrm
codeop.cpython-38.pyc64170644editdlrm
colorsys.cpython-38.pyc32400644editdlrm
compileall.cpython-38.pyc94100644editdlrm
configparser.cpython-38.pyc457180644editdlrm
contextlib.cpython-38.pyc202290644editdlrm
contextvars.cpython-38.pyc2430644editdlrm
copy.cpython-38.pyc69870644editdlrm
copyreg.cpython-38.pyc43180644editdlrm
cProfile.cpython-38.pyc54800644editdlrm
crypt.cpython-38.pyc33870644editdlrm
csv.cpython-38.pyc119100644editdlrm
dataclasses.cpython-38.pyc236530644editdlrm
datetime.cpython-38.pyc571730644editdlrm
decimal.cpython-38.pyc3590644editdlrm
difflib.cpython-38.pyc594380644editdlrm
dis.cpython-38.pyc158080644editdlrm
doctest.cpython-38.pyc759740644editdlrm
dummy_threading.cpython-38.pyc11100644editdlrm
enum.cpython-38.pyc259620644editdlrm
filecmp.cpython-38.pyc84270644editdlrm
fileinput.cpython-38.pyc133730644editdlrm
fnmatch.cpython-38.pyc33550644editdlrm
formatter.cpython-38.pyc175450644editdlrm
fractions.cpython-38.pyc187390644editdlrm
ftplib.cpython-38.pyc280070644editdlrm
functools.cpython-38.pyc279010644editdlrm
genericpath.cpython-38.pyc40010644editdlrm
getopt.cpython-38.pyc62710644editdlrm
getpass.cpython-38.pyc41780644editdlrm
gettext.cpython-38.pyc180000644editdlrm
glob.cpython-38.pyc43430644editdlrm
gzip.cpython-38.pyc181840644editdlrm
hashlib.cpython-38.pyc67270644editdlrm
heapq.cpython-38.pyc140700644editdlrm
hmac.cpython-38.pyc63880644editdlrm
imaplib.cpython-38.pyc414640644editdlrm
imghdr.cpython-38.pyc41180644editdlrm
imp.cpython-38.pyc98090644editdlrm
inspect.cpython-38.pyc805930644editdlrm
io.cpython-38.pyc34540644editdlrm
ipaddress.cpython-38.pyc628290644editdlrm
keyword.cpython-38.pyc9980644editdlrm
linecache.cpython-38.pyc38670644editdlrm
locale.cpython-38.pyc346740644editdlrm
lzma.cpython-38.pyc120180644editdlrm
mailbox.cpython-38.pyc602640644editdlrm
mailcap.cpython-38.pyc72060644editdlrm
mimetypes.cpython-38.pyc160310644editdlrm
modulefinder.cpython-38.pyc161150644editdlrm
netrc.cpython-38.pyc37770644editdlrm
nntplib.cpython-38.pyc339740644editdlrm
ntpath.cpython-38.pyc140910644editdlrm
nturl2path.cpython-38.pyc17440644editdlrm
numbers.cpython-38.pyc122020644editdlrm
opcode.cpython-38.pyc54200644editdlrm
operator.cpython-38.pyc136910644editdlrm
optparse.cpython-38.pyc480570644editdlrm
os.cpython-38.pyc313970644editdlrm
pathlib.cpython-38.pyc442090644editdlrm
pdb.cpython-38.pyc472260644editdlrm
pickle.cpython-38.pyc469080644editdlrm
pickletools.cpython-38.pyc672040644editdlrm
pipes.cpython-38.pyc77950644editdlrm
pkgutil.cpython-38.pyc163090644editdlrm
platform.cpython-38.pyc243260644editdlrm
plistlib.cpython-38.pyc273740644editdlrm
poplib.cpython-38.pyc135560644editdlrm
posixpath.cpython-38.pyc104610644editdlrm
pprint.cpython-38.pyc162810644editdlrm
profile.cpython-38.pyc147580644editdlrm
pstats.cpython-38.pyc220660644editdlrm
pty.cpython-38.pyc39550644editdlrm
pyclbr.cpython-38.pyc104510644editdlrm
pydoc.cpython-38.pyc836460644editdlrm
py_compile.cpython-38.pyc73520644editdlrm
queue.cpython-38.pyc106260644editdlrm
quopri.cpython-38.pyc57480644editdlrm
random.cpython-38.pyc201080644editdlrm
re.cpython-38.pyc144220644editdlrm
reprlib.cpython-38.pyc53030644editdlrm
rlcompleter.cpython-38.pyc57550644editdlrm
runpy.cpython-38.pyc81810644editdlrm
sched.cpython-38.pyc65320644editdlrm
secrets.cpython-38.pyc21900644editdlrm
selectors.cpython-38.pyc169350644editdlrm
shelve.cpython-38.pyc94900644editdlrm
shlex.cpython-38.pyc75360644editdlrm
shutil.cpython-38.pyc372190644editdlrm
signal.cpython-38.pyc28430644editdlrm
site.cpython-38.pyc171680644editdlrm
sitecustomize.cpython-38.pyc2200644editdlrm
smtpd.cpython-38.pyc264630644editdlrm
smtplib.cpython-38.pyc355320644editdlrm
sndhdr.cpython-38.pyc69890644editdlrm
socket.cpython-38.pyc277870644editdlrm
socketserver.cpython-38.pyc253610644editdlrm
sre_compile.cpython-38.pyc151420644editdlrm
sre_constants.cpython-38.pyc63590644editdlrm
sre_parse.cpython-38.pyc216470644editdlrm
ssl.cpython-38.pyc450370644editdlrm
stat.cpython-38.pyc43720644editdlrm
statistics.cpython-38.pyc336530644editdlrm
string.cpython-38.pyc73000644editdlrm
stringprep.cpython-38.pyc110170644editdlrm
struct.cpython-38.pyc3300644editdlrm
subprocess.cpython-38.pyc419670644editdlrm
sunau.cpython-38.pyc170800644editdlrm
symbol.cpython-38.pyc24040644editdlrm
symtable.cpython-38.pyc113220644editdlrm
sysconfig.cpython-38.pyc158370644editdlrm
tabnanny.cpython-38.pyc70300644editdlrm
tarfile.cpython-38.pyc630430644editdlrm
telnetlib.cpython-38.pyc182370644editdlrm
tempfile.cpython-38.pyc266530644editdlrm
textwrap.cpython-38.pyc135190644editdlrm
this.cpython-38.pyc12610644editdlrm
threading.cpython-38.pyc399760644editdlrm
timeit.cpython-38.pyc117770644editdlrm
token.cpython-38.pyc24850644editdlrm
tokenize.cpython-38.pyc171600644editdlrm
trace.cpython-38.pyc200260644editdlrm
traceback.cpython-38.pyc199380644editdlrm
tracemalloc.cpython-38.pyc173630644editdlrm
tty.cpython-38.pyc10760644editdlrm
turtle.cpython-38.pyc1300220644editdlrm
types.cpython-38.pyc91770644editdlrm
typing.cpython-38.pyc624200644editdlrm
uu.cpython-38.pyc36050644editdlrm
uuid.cpython-38.pyc236830644editdlrm
warnings.cpython-38.pyc136520644editdlrm
wave.cpython-38.pyc181490644editdlrm
weakref.cpython-38.pyc195180644editdlrm
webbrowser.cpython-38.pyc171200644editdlrm
xdrlib.cpython-38.pyc82210644editdlrm
zipapp.cpython-38.pyc58540644editdlrm
zipfile.cpython-38.pyc593360644editdlrm
zipimport.cpython-38.pyc172750644editdlrm
_bootlocale.cpython-38.pyc12430644editdlrm
_collections_abc.cpython-38.pyc287410644editdlrm
_compat_pickle.cpython-38.pyc55010644editdlrm
_compression.cpython-38.pyc41460644editdlrm
_dummy_thread.cpython-38.pyc60370644editdlrm
_markupbase.cpython-38.pyc77900644editdlrm
_osx_support.cpython-38.pyc115930644editdlrm
_pydecimal.cpython-38.pyc1607350644editdlrm
_pyio.cpython-38.pyc740790644editdlrm
_py_abc.cpython-38.pyc46700644editdlrm
_sitebuiltins.cpython-38.pyc34810644editdlrm
_strptime.cpython-38.pyc160440644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-38.pyc211210644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-38.pyc211150644editdlrm
_threading_local.cpython-38.pyc64460644editdlrm
_weakrefset.cpython-38.pyc76000644editdlrm
__future__.cpython-38.pyc41580644editdlrm
__phello__.foo.cpython-38.pyc1270644editdlrm
Edit: /snap/core20/2769/usr/lib/python3.8/__pycache__/argparse.cpython-38.pyc (62591B)
U yi7x@sRdZdZdddddddd d d d d dddddgZddlZddlZddlZzddl m Z m Z Wn$e k r~ddZ ddZ YnXdZ dZdZdZdZdZd ZGd!d"d"eZd#d$ZGd%ddeZGd&ddeZGd'd d eZGd(ddeZGd)d d eZd*d+ZGd,ddeZGd-ddeZGd.d d eZ Gd/d0d0e Z!Gd1d2d2e Z"Gd3d4d4e"Z#Gd5d6d6e"Z$Gd7d8d8e Z%Gd9d:d:e Z&Gd;d<dd>e Z(Gd?d@d@e Z)GdAdBdBe Z*GdCdDdDe%Z+GdEddeZ,GdFd d eZ-GdGdHdHeZ.GdIdJdJe.Z/GdKdLdLe/Z0GdMddee.Z1dS)Na Command-line parsing library This module is an optparse-inspired command-line parsing library that: - handles both optional and positional arguments - produces highly informative usage messages - supports parsers that dispatch to sub-parsers The following is a simple usage example that sums integers from the command-line and writes the result to a file:: parser = argparse.ArgumentParser( description='sum the integers at the command line') parser.add_argument( 'integers', metavar='int', nargs='+', type=int, help='an integer to be summed') parser.add_argument( '--log', default=sys.stdout, type=argparse.FileType('w'), help='the file where the sum should be written') args = parser.parse_args() args.log.write('%s' % sum(args.integers)) args.log.close() The module contains the following public classes: - ArgumentParser -- The main entry point for command-line parsing. As the example above shows, the add_argument() method is used to populate the parser with actions for optional and positional arguments. Then the parse_args() method is invoked to convert the args at the command-line into an object with attributes. - ArgumentError -- The exception raised by ArgumentParser objects when there are errors with the parser's actions. Errors raised while parsing the command-line are caught by ArgumentParser and emitted as command-line messages. - FileType -- A factory for defining types of files to be created. As the example above shows, instances of FileType are typically passed as the type= argument of add_argument() calls. - Action -- The base class for parser actions. Typically actions are selected by passing strings like 'store_true' or 'append_const' to the action= argument of add_argument(). However, for greater customization of ArgumentParser actions, subclasses of Action may be defined and passed as the action= argument. - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter, ArgumentDefaultsHelpFormatter -- Formatter classes which may be passed as the formatter_class= argument to the ArgumentParser constructor. HelpFormatter is the default, RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser not to change the formatting for help text, and ArgumentDefaultsHelpFormatter adds information about argument defaults to the help. All other classes in this module are considered implementation details. (Also note that HelpFormatter and RawDescriptionHelpFormatter are only considered public as object names -- the API of the formatter objects is still considered an implementation detail.) z1.1ArgumentParser ArgumentErrorArgumentTypeErrorFileType HelpFormatterArgumentDefaultsHelpFormatterRawDescriptionHelpFormatterRawTextHelpFormatterMetavarTypeHelpFormatter NamespaceAction ONE_OR_MOREOPTIONALPARSER REMAINDERSUPPRESS ZERO_OR_MOREN)gettextngettextcCs|SN)messagerr/usr/lib/python3.8/argparse.py_^srcCs|dkr |S|SdSNr)ZsingularZpluralnrrrr`srz ==SUPPRESS==?*+zA......Z_unrecognized_argsc@s(eZdZdZddZddZddZdS) _AttributeHolderaAbstract base class that provides __repr__. The __repr__ method returns a string in the format:: ClassName(attr=name, attr=name, ...) The attributes are determined either by a class-level attribute, '_kwarg_names', or by inspecting the instance __dict__. cCst|j}g}i}|D]}|t|q|D],\}}|rZ|d||fq6|||<q6|rz|dt|d|d|fS)N%s=%rz**%s%s(%s), )type__name__ _get_argsappendrepr _get_kwargs isidentifierjoin)selfZ type_name arg_stringsZ star_argsargnamevaluerrr__repr__|s   z_AttributeHolder.__repr__cCst|jSr)sorted__dict__itemsr-rrrr*sz_AttributeHolder._get_kwargscCsgSrrr6rrrr'sz_AttributeHolder._get_argsN)r& __module__ __qualname____doc__r2r*r'rrrrr!ssr!cCs6|dkr gSt|tkr$|ddSddl}||S)Nr)r%listcopy)r5r;rrr _copy_itemss   r<c@seZdZdZd;ddZddZd d ZGd d d eZd dZ ddZ ddZ ddZ dd}YnX||_||_t|t|d|d|_||_ d|_ d|_ d|_ | |d|_|j|_tdtj|_td|_dS)Nrr=Fz\s+z\n\n\n+)Zshutilget_terminal_sizecolumns ImportError_prog_indent_incrementminmax_max_help_position_width_current_indent_level_action_max_length_Section _root_section_current_section_recompileASCII_whitespace_matcher_long_break_matcher)r-progZindent_incrementZmax_help_positionwidthZ_shutilrrr__init__s(   zHelpFormatter.__init__cCs"|j|j7_|jd7_dSr)rJrErKr6rrr_indentszHelpFormatter._indentcCs4|j|j8_|jdks"td|jd8_dS)NrzIndent decreased below 0.r)rJrEAssertionErrorrKr6rrr_dedentszHelpFormatter._dedentc@seZdZdddZddZdS)zHelpFormatter._SectionNcCs||_||_||_g|_dSr) formatterparentheadingr5)r-r[r\r]rrrrWszHelpFormatter._Section.__init__cCs|jdk r|j|jj}|dd|jD}|jdk rD|j|sLdS|jtk rz|jdk rz|jj}d|d|jf}nd}|d||dgS)NcSsg|]\}}||qSrr).0funcargsrrr sz6HelpFormatter._Section.format_help..z%*s%s:  ) r\r[rX _join_partsr5rZr]rrJ)r-r,Z item_helpZcurrent_indentr]rrr format_helps    z"HelpFormatter._Section.format_help)N)r&r7r8rWrerrrrrMs rMcCs|jj||fdSr)rOr5r()r-r_r`rrr _add_itemszHelpFormatter._add_itemcCs0||||j|}||jg||_dSr)rXrMrOrfre)r-r]Zsectionrrr start_sectionszHelpFormatter.start_sectioncCs|jj|_|dSr)rOr\rZr6rrr end_sections zHelpFormatter.end_sectioncCs$|tk r |dk r ||j|gdSr)rrf _format_text)r-textrrradd_textszHelpFormatter.add_textcCs&|tk r"||||f}||j|dSr)rrf _format_usage)r-usageactionsgroupsprefixr`rrr add_usages zHelpFormatter.add_usagecCsv|jtk rr|j}||g}||D]}|||q$tdd|D}||j}t|j||_||j |gdS)NcSsg|] }t|qSrlenr^srrrrasz.HelpFormatter.add_argument..) helpr_format_action_invocation_iter_indented_subactionsr(rGrJrLrf_format_action)r-actionZget_invocationZ invocations subactionZinvocation_lengthZ action_lengthrrr add_argument s   zHelpFormatter.add_argumentcCs|D]}||qdSr)r|)r-rnrzrrr add_argumentsszHelpFormatter.add_argumentscCs.|j}|r*|jd|}|dd}|S)N rc)rNrerTsubstrip)r-rvrrrre%s  zHelpFormatter.format_helpcCsddd|DS)NrbcSsg|]}|r|tk r|qSr)r)r^partrrrra-sz-HelpFormatter._join_parts..)r,)r-Z part_stringsrrrrd,s zHelpFormatter._join_partscs6|dkrtd}|dk r,|t|jd}n|dkrL|sLdt|jd}n|dkr*dt|jd}g}g}|D] }|jr||qr||qr|j} | |||} ddd|| fD}|j|jt |t |kr*d} | ||} | ||} t | | }t | | }d|| ks&t d|| ks:t dfdd }t |t |d krdt |t |d }|r||g|||}| |||n |r||g|||}n|g}nZdt |}||}|||}t |d krg}| |||| ||||g|}d |}d ||fS)Nzusage: rUz%(prog)s cSsg|] }|r|qSrrrtrrrraMsz/HelpFormatter._format_usage..z%\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+csg}g}|dk rt|d}n t|d}|D]Z}|dt|krn|rn||d|g}t|d}|||t|d7}q.|r||d||dk r|dt|d|d<|S)Nrrr)rsr(r,)partsindentrplineslineZline_lenr text_widthrr get_linesas"   z.HelpFormatter._format_usage..get_linesg?rrcz%s%s )N)rdictrDoption_stringsr(_format_actions_usager,rIrJrsrPfindallrYextend)r-rmrnrorprU optionals positionalsrzformatZ action_usageZ part_regexpZ opt_usageZ pos_usageZ opt_partsZ pos_partsrrrrrrrrl1s\             zHelpFormatter._format_usagec Cst}i}|D]}z||jd}Wntk r@YqYqX|t|j}||||jkr|jD]}||qh|js||kr||d7<nd||<||kr||d7<nd||<nF||kr||d7<nd||<||kr||d7<nd||<t|d|D]} d || <qqg} t|D]"\} }|j t kr| d| | d krr| | n"| | dd krX| | dn|js||} ||| } ||kr| ddkr| d dkr| dd } | | nf|jd} |jdkrd | } n"||} ||| }d | |f} |jsN||krNd | } | | q6t|ddD]} || g| | | <qhddd| D}d}d}td|d|}td|d|}td||fd|}tdd|}|}|S)Nrz [[]z (()r|%s%s %s[%s]T)reversercSsg|]}|dk r|qSrr)r^itemrrrrasz7HelpFormatter._format_actions_usage..z[\[(]z[\])]z(%s) z\1 (%s)z%s *%srbz \(([^|]*)\))setindex_group_actions ValueErrorrsaddrequiredrange enumeratervrr(getpopr#_get_default_metavar_for_positional _format_argsnargs!_get_default_metavar_for_optionalr3r,rPrr)r-rnro group_actionsZinsertsgroupstartendrzirdefaultr option_string args_stringrjopencloserrrrsz                    z#HelpFormatter._format_actions_usagecCsFd|kr|t|jd}t|j|jd}d|j}||||dS)Nz%(prog)r rr~)rrDrGrIrJ _fill_text)r-rjrrrrrris  zHelpFormatter._format_textc Cs:t|jd|j}t|j|d}||jd}||}|jsV|jd|f}d|}n@t||kr~|jd||f}d|}d}n|jd|f}d|}|}|g}|jr| |} | | |} | d|d| df| ddD]} | d|d| fqn| ds| d| |D]} | || q||S) Nr=rrbz%*s%s z %*s%-*s rrrc)rFrLrHrGrIrJrwrvrs _expand_help _split_linesr(endswithrxryrd) r-rzZ help_positionZ help_widthZ action_widthZ action_headertupZ indent_firstrZ help_textZ help_linesrr{rrrrys8          zHelpFormatter._format_actioncCs|js&||}|||d\}|Sg}|jdkrB||jn4||}|||}|jD]}|d||fq^d|SdS)Nrrrr$) rr_metavar_formatterrrrrr(r,)r-rzrmetavarrrrrrrrw.s     z'HelpFormatter._format_action_invocationcsP|jdk r|jn.|jdk r.z{%s},csttrSf|SdSr) isinstancetuple)Z tuple_sizeresultrrrOs z0HelpFormatter._metavar_formatter..format)rchoicesr,)r-rzdefault_metavarZ choice_strsrrrrrFs   z HelpFormatter._metavar_formattercCs|||}|jdkr$d|d}n|jtkr.zinvalid nargs valuer) rrr rr rrrr TypeErrorrr,)r-rzrZ get_metavarrZformatsrrrrVs*        zHelpFormatter._format_argscCstt||jd}t|D]}||tkr||=qt|D] }t||dr:||j||<q:|ddk rddd|dD}||d<| ||S)Nrr&rr$cSsg|] }t|qSrr)r^crrrrawsz.HelpFormatter._expand_help..) rvarsrDr:rhasattrr&rr,_get_help_string)r-rzZparamsr0Z choices_strrrrrns   zHelpFormatter._expand_helpccs@z |j}Wntk rYnX||EdH|dSr)_get_subactionsAttributeErrorrXrZ)r-rzZget_subactionsrrrrx{s  z'HelpFormatter._iter_indented_subactionscCs&|jd|}ddl}|||S)Nrr)rSrrtextwrapZwrap)r-rjrVrrrrrszHelpFormatter._split_linescCs,|jd|}ddl}|j||||dS)Nrr)Zinitial_indentZsubsequent_indent)rSrrrZfill)r-rjrVrrrrrrs zHelpFormatter._fill_textcCs|jSr)rvr-rzrrrrszHelpFormatter._get_help_stringcCs |jSr)destupperrrrrrsz/HelpFormatter._get_default_metavar_for_optionalcCs|jSr)rrrrrrsz1HelpFormatter._get_default_metavar_for_positional)r=r>N)N) r&r7r8r9rWrXrZobjectrMrfrgrhrkrqr|r}rerdrlrriryrwrrrrxrrrrrrrrrrs> " `g/  c@seZdZdZddZdS)rzHelp message formatter which retains any formatting in descriptions. Only the name of this class is considered a public API. All the methods provided by the class are considered an implementation detail. cs dfdd|jddDS)Nrbc3s|]}|VqdSrr)r^rrrr sz9RawDescriptionHelpFormatter._fill_text..T)keepends)r, splitlines)r-rjrVrrrrrsz&RawDescriptionHelpFormatter._fill_textN)r&r7r8r9rrrrrrsc@seZdZdZddZdS)rzHelp message formatter which retains formatting of all help text. Only the name of this class is considered a public API. All the methods provided by the class are considered an implementation detail. cCs|Sr)r)r-rjrVrrrrsz!RawTextHelpFormatter._split_linesN)r&r7r8r9rrrrrrsc@seZdZdZddZdS)rzHelp message formatter which adds default values to argument help. Only the name of this class is considered a public API. All the methods provided by the class are considered an implementation detail. cCs>|j}d|jkr:|jtk r:ttg}|js2|j|kr:|d7}|S)Nz %(default)z (default: %(default)s))rvrrr rrr)r-rzrvZdefaulting_nargsrrrrs  z.ArgumentDefaultsHelpFormatter._get_help_stringN)r&r7r8r9rrrrrrsc@s eZdZdZddZddZdS)r a Help message formatter which uses the argument 'type' as the default metavar value (instead of the argument 'dest') Only the name of this class is considered a public API. All the methods provided by the class are considered an implementation detail. cCs|jjSrr%r&rrrrrsz:MetavarTypeHelpFormatter._get_default_metavar_for_optionalcCs|jjSrrrrrrrsz.rr-namesrr6rr*Ks zAction._get_kwargscCsttddS)Nz.__call__() not defined)NotImplementedErrorrr-parser namespacevaluesrrrr__call__YszAction.__call__)NNNNNFNN)N)r&r7r8r9rWr*rrrrrr s5 cs(eZdZdfdd ZdddZZS) _StoreActionNFc sT|dkrtd|dk r,|tkr,tdttt|j||||||||| | d dS)Nrznargs for store actions must be != 0; if you have nothing to store, actions such as store true or store const may be more appropriate nargs must be %r to supply constr)rr superrrWr __class__rrrW_s   z_StoreAction.__init__cCst||j|dSr)setattrrrrrrr|sz_StoreAction.__call__)NNNNNFNN)Nr&r7r8rWr __classcell__rrrrr]srcs(eZdZdfdd ZdddZZS) _StoreConstActionNFc s"tt|j||d||||ddS)Nr)rrrrrrrv)rrrWr-rrrrrrvrrrrrWs z_StoreConstAction.__init__cCst||j|jdSr)rrrrrrrrsz_StoreConstAction.__call__)NFNN)Nrrrrrrs rcseZdZdfdd ZZS)_StoreTrueActionFNcs tt|j||d|||ddS)NTrrrrrrv)rrrWr-rrrrrvrrrrWs z_StoreTrueAction.__init__)FFNr&r7r8rWrrrrrrsrcseZdZdfdd ZZS)_StoreFalseActionTFNcs tt|j||d|||ddS)NFr)rrrWrrrrrWs z_StoreFalseAction.__init__)TFNrrrrrrsrcs(eZdZdfdd ZdddZZS) _AppendActionNFc sT|dkrtd|dk r,|tkr,tdttt|j||||||||| | d dS)Nrznargs for append actions must be != 0; if arg strings are not supplying the value to append, the append const action may be more appropriaterr)rr rrrWrrrrrWs   z_AppendAction.__init__cCs2t||jd}t|}||t||j|dSr)rrr<r(rr-rrrrr5rrrrs z_AppendAction.__call__)NNNNNFNN)Nrrrrrrsrcs(eZdZdfdd ZdddZZS) _AppendConstActionNFc s$tt|j||d|||||ddS)Nr)rrrrrrrvr)rrrWrrrrrWs z_AppendConstAction.__init__cCs4t||jd}t|}||jt||j|dSr)rrr<r(rrrrrrrs z_AppendConstAction.__call__)NFNN)Nrrrrrrs rcs(eZdZdfdd ZdddZZS) _CountActionNFcs tt|j||d|||ddS)Nr)rrrrrrv)rrrWrrrrrWs z_CountAction.__init__cCs0t||jd}|dkrd}t||j|ddSNrr)rrr)r-rrrrcountrrrr sz_CountAction.__call__)NFN)Nrrrrrrs rcs.eZdZeedffdd ZdddZZS) _HelpActionNcstt|j|||d|ddSNr)rrrrrv)rrrW)r-rrrrvrrrrWs z_HelpAction.__init__cCs||dSr) print_helpexitrrrrrsz_HelpAction.__call__)Nr&r7r8rrWrrrrrrrs  rcs0eZdZdeedffdd ZdddZZS)_VersionActionNz&show program's version number and exitcs$tt|j|||d|d||_dSr)rrrWversion)r-rrrrrvrrrrW&s z_VersionAction.__init__cCsD|j}|dkr|j}|}||||tj|dSr)r_get_formatterrk_print_messagere_sysstdoutr)r-rrrrrr[rrrr4s z_VersionAction.__call__)Nrrrrrr$s rcsPeZdZGdddeZedddffdd ZddZd d Zd d d Z Z S)_SubParsersActioncseZdZfddZZS)z&_SubParsersAction._ChoicesPseudoActioncs@|}}|r|dd|7}ttj|}|jg|||ddS)Nrr$)rrrvr)r,rr _ChoicesPseudoActionrW)r-r0aliasesrvrrZsuprrrrWBs  z/_SubParsersAction._ChoicesPseudoAction.__init__rrrrrr @sr FNc s<||_||_i|_g|_tt|j||t|j|||ddS)N)rrrrrrvr) _prog_prefix _parser_class_name_parser_map_choices_actionsrr rWr)r-rrU parser_classrrrvrrrrrWJs  z_SubParsersAction.__init__cKs|ddkr d|j|f|d<|dd}d|krX|d}||||}|j||jf|}||j|<|D]}||j|<qr|S)NrUrrrrv)rrrr rr(rr)r-r0kwargsrrvZ choice_actionraliasrrr add_parseras      z_SubParsersAction.add_parsercCs|jSr)rr6rrrrxsz!_SubParsersAction._get_subactionsc Cs|d}|dd}|jtk r,t||j|z|j|}Wn<tk rv|d|jd}td|}t||YnX||d\} }t |  D]\} } t|| | q|rt | t gt |t |dS)Nrrr$) parser_namerz5unknown parser %(parser_name)r (choices: %(choices)s))rrrrKeyErrorr,rrparse_known_argsrr5 setdefault_UNRECOGNIZED_ARGS_ATTRrr) r-rrrrrr.r`msgZ subnamespacekeyr1rrrr{s$     z_SubParsersAction.__call__)N) r&r7r8r r rrWrrrrrrrrr >sr c@seZdZdddZdS) _ExtendActionNcCs2t||jd}t|}||t||j|dSr)rrr<rrrrrrrs z_ExtendAction.__call__)N)r&r7r8rrrrrrsrc@s*eZdZdZd ddZddZd d ZdS) raFactory for creating file object types Instances of FileType are typically passed as type= arguments to the ArgumentParser add_argument() method. Keyword Arguments: - mode -- A string indicating how the file is to be opened. Accepts the same values as the builtin open() function. - bufsize -- The file's desired buffer size. Accepts the same values as the builtin open() function. - encoding -- The file's encoding. Accepts the same values as the builtin open() function. - errors -- A string indicating how encoding and decoding errors are to be handled. Accepts the same value as the builtin open() function. rrNcCs||_||_||_||_dSr)_mode_bufsize _encoding_errors)r-modebufsizeencodingerrorsrrrrWszFileType.__init__c Cs|dkr>d|jkrtjSd|jkr(tjStd|j}t|zt||j|j|j|j WSt k r}z"||d}td}t ||W5d}~XYnXdS)N-rwzargument "-" with mode %r)filenameerrorz$can't open '%(filename)s': %(error)s) r r stdinr rrrr!r"r#OSErrorr)r-stringrer`rrrrrs   zFileType.__call__cCsT|j|jf}d|jfd|jfg}ddd|Ddd|D}dt|j|fS)Nr&r'r$cSsg|]}|dkrt|qS)r)r))r^r/rrrrasz%FileType.__repr__..cSs$g|]\}}|dk rd||fqS)Nr"r)r^kwr/rrrrasr#)r r!r"r#r,r%r&)r-r`rZargs_strrrrr2s   zFileType.__repr__)rrNN)r&r7r8r9rWrr2rrrrrs c@s(eZdZdZddZddZddZdS) r zSimple object for storing attributes. Implements equality by attribute names and values, and provides a simple string representation. cKs|D]}t||||qdSr)r)r-rr0rrrrWszNamespace.__init__cCst|tstSt|t|kSr)rr NotImplementedr)r-otherrrr__eq__s zNamespace.__eq__cCs ||jkSr)r4)r-rrrr __contains__szNamespace.__contains__N)r&r7r8r9rWr3r4rrrrr scseZdZfddZddZd&ddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZd'ddZddZd d!Zd"d#Zd$d%ZZS)(_ActionsContainercstt|||_||_||_||_i|_|ddt |ddt |ddt |ddt |ddt |ddt |ddt|ddt|dd t|dd t|dd t|dd t|g|_i|_g|_g|_i|_td |_g|_dS)NrzZstoreZ store_const store_trueZ store_falser(Z append_constrrvrparsersrz^-\d+$|^-\d*\.\d+$)rr5rW descriptionargument_default prefix_charsconflict_handler _registriesregisterrrrrrrrrrr r _get_handler_actions_option_string_actions_action_groups_mutually_exclusive_groups _defaultsrPrQ_negative_number_matcher_has_negative_number_optionals)r-r8r:r9r;rrrrWs4 z_ActionsContainer.__init__cCs|j|i}|||<dSr)r<r)r- registry_namer1rregistryrrrr=(sz_ActionsContainer.registerNcCs|j|||Sr)r<r)r-rFr1rrrr _registry_get,sz_ActionsContainer._registry_getcKs2|j||jD]}|j|kr||j|_qdSr)rCupdater?rr)r-rrzrrr set_defaults2s   z_ActionsContainer.set_defaultscCs8|jD]"}|j|kr|jdk r|jSq|j|dSr)r?rrrCr)r-rrzrrr get_default;s  z_ActionsContainer.get_defaultcOsD|j}|r&t|dkrH|dd|krH|r:d|kr:td|j||}n |j||}d|kr|d}||jkr~|j||d<n|jdk r|j|d<||}t|std|f|f|}| d|j |j }t|std |f|t krtd |ft |d r:z| |dWntk r8td YnX||S) z add_argument(dest, ..., name=value, ...) add_argument(option_string, option_string, ..., name=value, ...) rrrz+dest supplied twice for positional argumentrNzunknown action "%s"r%%r is not callablez<%r is a FileType class object, instance of it must be passedrz,length of metavar tuple does not match nargs)r:rsr_get_positional_kwargs_get_optional_kwargsrCr9_pop_action_classcallablerHr%rrrrr _add_action)r-r`rcharsrZ action_classrz type_funcrrrr|Es:          z_ActionsContainer.add_argumentcOs t|f||}|j||Sr)_ArgumentGrouprAr()r-r`rrrrradd_argument_groupxs z$_ActionsContainer.add_argument_groupcKst|f|}|j||Sr)_MutuallyExclusiveGrouprBr()r-rrrrradd_mutually_exclusive_group}s  z._ActionsContainer.add_mutually_exclusive_groupcCs`|||j|||_|jD]}||j|<q"|jD]"}|j|r8|js8|jdq8|S)NT) _check_conflictr?r( containerrr@rDmatchrE)r-rzrrrrrQs      z_ActionsContainer._add_actioncCs|j|dSr)r?removerrrr_remove_actionsz _ActionsContainer._remove_actioncCsi}|jD].}|j|kr.td}t||j|||j<q i}|jD]D}|j|krn|j|j|j|jd||j<|jD]}||j||<qtqD|jD]&}|j |j d}|jD] }|||<qq|j D]}| || |qdS)Nz.cannot merge actions - two groups are named %r)titler8r;)r)rAr]rrrUr8r;rrBrWrr?rrQ)r-rYZtitle_group_maprrZ group_maprz mutex_grouprrr_add_container_actionss0           z(_ActionsContainer._add_container_actionscKs^d|krtd}t||dttfkr2d|d<|dtkrPd|krPd|d<t||gdS)Nrz1'required' is an invalid argument for positionalsrTrrr)rrrr rr)r-rrrrrrrMsz(_ActionsContainer._get_positional_kwargsc Osg}g}|D]n}|d|jkr>||jd}td}t|||||d|jkr t|dkr |d|jkr ||q |dd}|dkr|r|d}n|d}||j}|std}t|||dd}t|||d S) Nr)optionr:zNinvalid option string %(option)r: must start with a character %(prefix_chars)rrrz%dest= is required for options like %rr(rr`) r:rrr(rsrlstripreplacer) r-r`rrZlong_option_stringsrrrZdest_option_stringrrrrNs2         z&_ActionsContainer._get_optional_kwargscCs|d|}|d||S)Nrz)rrH)r-rrrzrrrrOs z#_ActionsContainer._pop_action_classcCsFd|j}z t||WStk r@td}t||jYnXdS)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)r;rrrr)r-Zhandler_func_namerrrrr>s   z_ActionsContainer._get_handlercCsLg}|jD]&}||jkr |j|}|||fq |rH|}|||dSr)rr@r(r>)r-rzZconfl_optionalsrZconfl_optionalr;rrrrXs   z!_ActionsContainer._check_conflictcCs6tddt|}ddd|D}t|||dS)Nzconflicting option string: %szconflicting option strings: %sr$cSsg|] \}}|qSrr)r^rrzrrrrasz<_ActionsContainer._handle_conflict_error..)rrsr,r)r-rzconflicting_actionsrZconflict_stringrrr_handle_conflict_errors z(_ActionsContainer._handle_conflict_errorcCs>|D]4\}}|j||j|d|js|j|qdSr)rr[r@rrYr\)r-rzrdrrrr_handle_conflict_resolves   z*_ActionsContainer._handle_conflict_resolve)N)N)r&r7r8rWr=rHrJrKr|rUrWrQr\r_rMrNrOr>rXrerfrrrrrr5s$ 5   3($   r5cs6eZdZdfdd ZfddZfddZZS) rTNc s|j}|d|j|d|j|d|jtt|j}|fd|i|||_g|_|j |_ |j |_ |j |_ |j |_ |j |_ |j|_dS)Nr;r:r9r8)rr;r:r9rrTrWr]rr<r?r@rCrErB)r-rYr]r8rrIZ super_initrrrrW+s    z_ArgumentGroup.__init__cs tt||}|j||Sr)rrTrQrr(rrrrrQAs z_ArgumentGroup._add_actioncs tt|||j|dSr)rrTr\rr[rrrrr\Fsz_ArgumentGroup._remove_action)NNr&r7r8rWrQr\rrrrrrT)s rTcs.eZdZdfdd ZddZddZZS) rVFcs tt||||_||_dSr)rrVrWr _container)r-rYrrrrrWMsz _MutuallyExclusiveGroup.__init__cCs2|jrtd}t||j|}|j||S)Nz-mutually exclusive arguments must be optional)rrrrhrQrr()r-rzrrrrrQRs   z#_MutuallyExclusiveGroup._add_actioncCs|j||j|dSr)rhr\rr[rrrrr\Zs z&_MutuallyExclusiveGroup._remove_action)FrgrrrrrVKsrVc s*eZdZdZddddgeddddddf fdd Zdd Zd d Zd d ZddZ ddZ dAddZ dBddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%ZdCd&d'ZdDd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5ZdEd6d7ZdFd8d9ZdGd:d;ZdHd=d>Z d?d@Z!Z"S)IraObject for parsing command line strings into Python objects. Keyword Arguments: - prog -- The name of the program (default: sys.argv[0]) - usage -- A usage message (default: auto-generated from arguments) - description -- A description of what the program does - epilog -- Text following the argument descriptions - parents -- Parsers whose arguments should be copied into this one - formatter_class -- HelpFormatter class for printing help messages - prefix_chars -- Characters that prefix optional arguments - fromfile_prefix_chars -- Characters that prefix files containing additional arguments - argument_default -- The default value for all arguments - conflict_handler -- String indicating how to handle conflicts - add_help -- Add a -h/-help option - allow_abbrev -- Allow long options to be abbreviated unambiguously Nr(r+Tc  s"tt|j} | ||| | d|dkr6tjtjd}||_||_ ||_ ||_ ||_ | |_ | |_|j}|td|_|td|_d|_dd}|dd|d|krdn|d}|j r|j|d |d d d ttd d |D]<}||z |j}Wntk rYqX|j|qdS)N)r8r:r9r;rzpositional argumentszoptional argumentscSs|Srr)r.rrridentitysz)ArgumentParser.__init__..identityr%r(hr=rvzshow this help message and exit)rzrrv)rrrW_ospathbasenamer argvrUrmepilogformatter_classfromfile_prefix_charsadd_help allow_abbrevrUr _positionals _optionals _subparsersr=r|rr_rCrrI)r-rUrmr8roparentsrpr:rqr9r;rrrsZ superinitZ add_groupriZdefault_prefixr\defaultsrrrrWrsJ    zArgumentParser.__init__cs"ddddddg}fdd|DS) NrUrmr8rpr;rrcsg|]}|t|fqSrrrr6rrrasz.ArgumentParser._get_kwargs..rrrr6rr*szArgumentParser._get_kwargsc Ks|jdk r|td|dt|d|ks8d|krht|dd}t|dd}||||_n|j|_|ddkr| }| }|j }| |j ||d||d<||d}|fd gi|}|j||S) Nz(cannot have multiple subparser argumentsrr]r8Z subcommandsrUrbr7r)rvr+rrr%rrUrtrr_get_positional_actionsrBrqrmrerrOrQ) r-rr]r8r[rroZ parsers_classrzrrradd_subparserss$   zArgumentParser.add_subparserscCs$|jr|j|n |j||Sr)rrurQrtrrrrrQs zArgumentParser._add_actioncCsdd|jDS)NcSsg|]}|jr|qSrrr^rzrrrrasz8ArgumentParser._get_optional_actions..r?r6rrr_get_optional_actionssz$ArgumentParser._get_optional_actionscCsdd|jDS)NcSsg|]}|js|qSrr{r|rrrrasz:ArgumentParser._get_positional_actions..r}r6rrrrysz&ArgumentParser._get_positional_actionscCs4|||\}}|r0td}||d||SNzunrecognized arguments: %sr)rrr+r,r-r`rrnrrrr parse_argss zArgumentParser.parse_argscCs|dkrtjdd}nt|}|dkr.t}|jD]4}|jtk r4t||js4|jtk r4t ||j|jq4|j D] }t||spt |||j |qpz>| ||\}}t|t r| t|t t|t ||fWStk rtd}|t|YnXdSr)r rnr:r r?rrrrrrC_parse_known_argsrrrdelattrrexc_infor+r)r-r`rrzrerrrrrrs,          zArgumentParser.parse_known_argscs jdk r i jD]R}|j}t|jD]<\}}|g}||d||||ddq2qig}t} t| D]^\}} | dkr|d| D]} |dqq | } | dkrd} n | |<d} || qd |t t d fdd  fd d }  fd d }gd r`t }nd} |krt fddD} |kr| }| kr| qdn| kr҈ |}|| |  qd| }|dg} jD]|}|kr|jr(|t|nT|jdk rt|jtrt|jr|jt|jkrt|j ||jq|r tdd | jD]X}|jr|jD]}|krqqdd|jD}td} |d |qfS)Nr--r(AOrbcs||||}||jk rb||gD]*}|kr6td}t|}t|||q6|tk rx|||dS)Nznot allowed with argument %s)r _get_valuesrrrrrr)rzZargument_stringsrZargument_valuesZconflict_actionrZ action_name)action_conflictsr seen_actionsseen_non_default_actionsr-rr take_actionLs    z5ArgumentParser._parse_known_args..take_actioncs|}|\}}}j}g}|dkr:||dS|dk r||d}j}|dkr|d|kr||g|f|d} | |d}|ddpd} j} || kr| |}| }ntd} t|| |nB|dkr|d} |g}||||fq\ntd} t|| |q|d}|d}|||}||} || }||||fq\q|sft|D]\}}}|||qj| S)Nrrrzignored explicit argument %r)_match_argumentr(r:r@rrrY) start_index option_tuplerzr explicit_argZmatch_argumentZ action_tuples arg_countrRcharZnew_explicit_argZ optionals_maprstopr`rZselected_patterns)r.arg_strings_patternextrasoption_string_indicesr-rrrconsume_optionalasN        z:ArgumentParser._parse_known_args..consume_optionalcsnj}|d}||}t|D]*\}}|||}||7}||q&t|ddd<|Sr)_match_arguments_partialziprs)rZ match_partialZselected_patternZ arg_countsrzrr`)r.rrr-rrrconsume_positionalss   z=ArgumentParser._parse_known_args..consume_positionalsrrcsg|]}|kr|qSrr)r^r)rrrrasz4ArgumentParser._parse_known_args..z(the following arguments are required: %sr$cSsg|]}|jtk rt|qSr)rvrrr|rrrra s z#one of the arguments %s is requiredr)N)rq_read_args_from_filesrBrrrriterr(_parse_optionalr,rryrGrFr?rrrrrrrrr _get_valuer+r)r-r.rr^rrZ mutex_actionZ conflictsZarg_string_pattern_partsZarg_strings_iter arg_stringrpatternrrZmax_option_string_indexZnext_option_string_indexZpositionals_end_indexZstringsZ stop_indexZrequired_actionsrzrrrr) rr.rrrrrrrr-rrrrs        J                    z ArgumentParser._parse_known_argsc Csg}|D]}|r|d|jkr*||qzdt|ddJ}g}|D]}||D]}||q\qN||}||W5QRXWqtk rt d}| t |YqXq|Sr) rqr(rreadrconvert_arg_line_to_argsrrr-r rr+r)r-r.Znew_arg_stringsrZ args_filearg_liner/rrrrrs    z$ArgumentParser._read_args_from_filescCs|gSrr)r-rrrrr-sz'ArgumentParser.convert_arg_line_to_argscCsz||}t||}|dkrldtdttdttdi}||j}|dkrbtdd|j|j}t ||t | dS)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsr) _get_nargs_patternrPrZrr r rrrrrsr)r-rzr nargs_patternrZZ nargs_errorsrrrrr0s(    zArgumentParser._match_argumentcsrg}tt|ddD]X}|d|}dfdd|D}t||}|dk r|dd|Dqnq|S)Nrrrbcsg|]}|qSr)rr|r6rrraLsz;ArgumentParser._match_arguments_partial..cSsg|] }t|qSrrr)r^r.rrrraPs)rrsr,rPrZrro)r-rnrrrZ actions_slicerrZrr6rrFs  z'ArgumentParser._match_arguments_partialc Cs|sdS|d|jkrdS||jkr8|j|}||dfSt|dkrHdSd|kr~|dd\}}||jkr~|j|}|||fS||}t|dkrddd|D}||d}td}|||nt|dkr|\} | S|j |r|j sdSd |krdSd|dfS) Nrr=r$cSsg|]\}}}|qSrr)r^rzrrrrrrausz2ArgumentParser._parse_optional..)raZmatchesz4ambiguous option: %(option)s could match %(matches)sr) r:r@rssplit_get_option_tuplesr,rr+rDrZrE) r-rrzrrZ option_tuplesZoptionsr`rrrrrrVs>              zArgumentParser._parse_optionalc Cs0g}|j}|d|kr|d|kr|jr~d|krB|dd\}}n|}d}|jD],}||rP|j|}|||f}||qPn|d|kr|d|kr|}d}|dd}|dd} |jD]T}||kr|j|}||| f}||q||r|j|}|||f}||qn|td||S)Nrrrr=zunexpected option string: %s)r:rsrr@ startswithr(r+r) r-rrrRZ option_prefixrrzrZshort_option_prefixZshort_explicit_argrrrrs:             z!ArgumentParser._get_option_tuplescCs|j}|dkrd}nf|tkr"d}nX|tkr0d}nJ|tkr>d}n<|tkrLd}n.|tkrZd}n |tkrhd}ndd d |}|jr| d d }| d d }|S) Nz(-*A-*)z(-*A?-*)z (-*[A-]*)z (-*A[A-]*)z([-AO]*)z (-*A[-AO]*)z(-*-*)z(-*%s-*)z-*rrbr() rr rr rrrr,rrc)r-rzrrrrrrs(  z!ArgumentParser._get_nargs_patterncCs4|||\}}|r0td}||d||Sr)parse_known_intermixed_argsrr+r,rrrrparse_intermixed_argss z$ArgumentParser.parse_intermixed_argsc s|ddD}|r,td|djfdd|jDrHtdzN|j}z|jdkrp|dd|_D] }|j|_t |_|j|_t |_qt| ||\}}D]J}t ||j rt ||j gkrddlm}|d |j |ft||j qW5D]}|j|_|j|_qX|}zJ|D]}|j|_d |_q$|jD]} | j| _d | _q@| ||\}} W5|D]}|j|_qn|jD]} | j| _qXW5||_X|| fS) NcSsg|]}|jttfkr|qSr)rrrr|rrrra sz>ArgumentParser.parse_known_intermixed_args..z3parse_intermixed_args: positional arg with nargs=%srcs&g|]}|jD]}|kr|jqqSr)rr)r^rrzrrrra s z;parse_intermixed_args: positional in mutuallyExclusiveGroup)warnzDo not expect %s in %sF)ryrrrBrmZ save_nargsZ save_defaultr format_usagerrrrrwarningsrrr~Z save_requiredr) r-r`raZ save_usagerzZremaining_argsrrrrrrrrs`           z*ArgumentParser.parse_known_intermixed_argscsjttfkr2z|dWntk r0YnX|szjtkrzjrNj}nj}t |t rv |} |n|sjt krjsjdk rj}n|} |nt|dkrjdtfkr|\} |} |njtkrfdd|D}npjtkr@fdd|D} |dn>jtkrRt}n,fdd|D}|D]} |qj|S)Nrrcsg|]}|qSrrr^vrzr-rrraf sz.ArgumentParser._get_values..csg|]}|qSrrrrrrraj srcsg|]}|qSrrrrrrras s)rrrr[rr rrrrrr _check_valuerrsr)r-rzr.r1rrrrrrB sD       zArgumentParser._get_valuesc Cs|d|j|j}t|s0td}t|||z ||}Wntk r~t|jdt|j}tt d}t||YnLt t fk rt|jdt|j}||d}td}t|||YnX|S)Nr%rLr&r)r%r1z!invalid %(type)s value: %(value)r) rHr%rPrrrrr)rr rrr)r-rzrrSrrr0r`rrrrz s   zArgumentParser._get_valuecCsF|jdk rB||jkrB|dtt|jd}td}t|||dS)Nr$)r1rz3invalid choice: %(value)r (choose from %(choices)s))rr,mapr)rr)r-rzr1r`rrrrr s zArgumentParser._check_valuecCs$|}||j|j|j|Sr)rrqrmr?rBre)r-r[rrrr s  zArgumentParser.format_usagecCst|}||j|j|j||j|jD]0}||j ||j| |j | q.||j |Sr)rrqrmr?rBrkr8rArgr]r}rrhrore)r-r[Z action_grouprrrre s        zArgumentParser.format_helpcCs|j|jdS)Nr)rprUr6rrrr szArgumentParser._get_formattercCs"|dkrtj}|||dSr)r r r rr-filerrr print_usage szArgumentParser.print_usagecCs"|dkrtj}|||dSr)r r r rerrrrr szArgumentParser.print_helpcCs |r|dkrtj}||dSr)r stderrwrite)r-rrrrrr  szArgumentParser._print_messagercCs |r||tjt|dSr)r r rr)r-Zstatusrrrrr szArgumentParser.exitcCs0|tj|j|d}|dtd|dS)zerror(message: string) Prints a usage message incorporating the message to stderr and exits. If you override this in a subclass, it should not return -- it should either exit or raise an exception. )rUrr=z%(prog)s: error: %(message)s N)rr rrUrr)r-rr`rrrr+ s  zArgumentParser.error)NN)NN)NN)NN)N)N)N)rN)#r&r7r8r9rrWr*rzrQr~ryrrrrrrrrrrrrrrrrrerrrr rr+rrrrrr_sV@  #w:-1  M8    )2r9 __version____all__osrkrerPsysr rrrrCrr rr rrrrr!r<rrrrr r Exceptionrrr rrrrrrrrrr rrr r5rTrVrrrrrs=~    [#&] 7:"