From 78b577f62915b87f4235f0352c92be1760c79c4e Mon Sep 17 00:00:00 2001 From: "steven.bethard" Date: Sun, 26 Jul 2009 15:44:42 +0000 Subject: Bump versions to 1.0 and generate documentation for 1.0 release. --- README.txt | 6 ++--- argparse.py | 2 +- doc/ArgumentParser.html | 55 ++++++++++++++++++++++++++++++++++++------- doc/add_argument.html | 26 +++++++++++++++----- doc/api-docs.html | 12 ++++++---- doc/argparse-vs-optparse.html | 10 ++++---- doc/genindex.html | 13 +++++----- doc/index.html | 10 ++++---- doc/other-methods.html | 49 ++++++++++++++++++++++++++++++++++---- doc/other-utilities.html | 10 ++++---- doc/overview.html | 10 ++++---- doc/parse_args.html | 10 ++++---- doc/search.html | 10 ++++---- doc/searchindex.js | 2 +- doc/source/conf.py | 4 ++-- 15 files changed, 161 insertions(+), 68 deletions(-) diff --git a/README.txt b/README.txt index 4e3cfc6..f651f30 100644 --- a/README.txt +++ b/README.txt @@ -1,5 +1,5 @@ -argparse 0.9.2 -============== +argparse 1.0 +============ The argparse module makes writing command line tools in Python easy. Just briefly describe your command line interface and argparse will @@ -24,7 +24,7 @@ including: REQUIREMENTS & INSTALLATION --------------------------- -The argparse module requires Python 2.4 or greater, and can be +The argparse module requires Python 2.3 or greater, and can be installed with the standard Python installation procedure: python setup.py install diff --git a/argparse.py b/argparse.py index 05dbffb..73b48b6 100644 --- a/argparse.py +++ b/argparse.py @@ -75,7 +75,7 @@ considered public as object names -- the API of the formatter objects is still considered an implementation detail.) """ -__version__ = '0.9.2' +__version__ = '1.0' __all__ = [ 'ArgumentParser', 'ArgumentError', diff --git a/doc/ArgumentParser.html b/doc/ArgumentParser.html index 8574874..9741cb2 100644 --- a/doc/ArgumentParser.html +++ b/doc/ArgumentParser.html @@ -5,13 +5,13 @@ - ArgumentParser objects — argparse v0.9.1 documentation + ArgumentParser objects — argparse v1.0 documentation - + @@ -37,7 +37,7 @@
  • previous |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • API documentation »
  • @@ -61,7 +61,8 @@ class ArgumentParser(add_help - Add a -h/–help option to the parser. (default: True)
  • argument_default - Set the global default value for arguments. (default: None)
  • parents - A list of :class:ArgumentParser objects whose arguments should also be included.
  • -
  • prefix_chars - The set of characters that indicate optional arguments. (default: ‘-‘)
  • +
  • prefix_chars - The set of characters that prefix optional arguments. (default: ‘-‘)
  • +
  • fromfile_prefix_chars - The set of characters that prefix files from which additional arguments should be read. (default: None)
  • formatter_class - A class for customizing the help output.
  • conflict_handler - Usually unnecessary, defines strategy for resolving conflicting optionals.
  • prog - Usually unnecessary, the name of the program (default: sys.argv[0])
  • @@ -107,7 +108,7 @@ class ArgumentParser(

    version

    Programs which want to display the program version at the command line can supply a version message as the version= argument to ArgumentParser. This will add a -v/--version option to the ArgumentParser that can be invoked to print the version string:

    -
    >>> parser = argparse.ArgumentParser(prog='PROG', version='%(prog)s 1.2.1')
    +
    >>> parser = argparse.ArgumentParser(prog='PROG', version='%(prog)s 3.5')
     >>> parser.print_help()
     usage: PROG [-h] [-v]
     
    @@ -115,7 +116,7 @@ class ArgumentParser(  -h, --help     show this help message and exit
       -v, --version  show program's version number and exit
     >>> parser.parse_args(['-v'])
    -PROG 1.2.1
    +PROG 3.5
     

    Note you can use the %(prog)s format specifier to insert the program name into the version string.

    @@ -161,9 +162,24 @@ optional arguments:

    The prefix_chars= argument defaults to '-'. Supplying a set of characters that does not include '-' will cause -f/--foo options to be disallowed. Note that most parent parsers will specify add_help() =False. Otherwise, the ArgumentParser will see two -h/--help options (one in the parent and one in the child) and raise an error.

    +
    +

    fromfile_prefix_chars

    +

    Sometimes, e.g. for particularly long argument lists, it may make sense to keep the list of arguments in a file rather than typing it out at the command line. +If the fromfile_prefix_chars= argument is given to the ArgumentParser constructor, then arguments that start with any of the specified characters will be treated as files, and will be replaced by the arguments they contain. For example:

    +
    >>> open('args.txt', 'w').write('-f\nbar')
    +>>> parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
    +>>> parser.add_argument('-f')
    +>>> parser.parse_args(['-f', 'foo', '@args.txt'])
    +Namespace(f='bar')
    +
    +
    +

    Arguments read from a file must be one per line (with each whole line being considered a single argument) and are treated as if they were in the same place as the original file referencing argument on the command line. +So in the example above, the expression ['-f', 'foo', '@args.txt'] is considered equivalent to the expression ['-f', 'foo', '-f', 'bar'].

    +

    The fromfile_prefix_chars= argument defaults to None, meaning that arguments will never be treated as file references.

    +

    argument_default

    -

    Generally, argument defaults are specified either by passing a default_ to add_argument() or by calling the set_defaults() methods with a specific set of name-value pairs. Sometimes however, it may be useful to specify a single parser-wide default for arguments. This can be accomplished by passing the argument_default= keyword argument to ArgumentParser. For example, to globally suppress attribute creation on parse_args() calls, we supply argument_default=SUPPRESS:

    +

    Generally, argument defaults are specified either by passing a default to add_argument() or by calling the set_defaults() methods with a specific set of name-value pairs. Sometimes however, it may be useful to specify a single parser-wide default for arguments. This can be accomplished by passing the argument_default= keyword argument to ArgumentParser. For example, to globally suppress attribute creation on parse_args() calls, we supply argument_default=SUPPRESS:

    >>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)
     >>> parser.add_argument('--foo')
     >>> parser.add_argument('bar', nargs='?')
    @@ -194,6 +210,9 @@ Note that most parent parsers will specify 
     

    formatter_class

    +

    ArgumentParser objects allow the help formatting to be customized by specifying an alternate formatting class. +Currently, there are three such classes: argparse.RawDescriptionHelpFormatter, argparse.RawTextHelpFormatter and argparse.ArgumentDefaultsHelpFormatter. +The first two allow more control over how textual descriptions are displayed, while the last automatically adds information about argument default values.

    By default, ArgumentParser objects line-wrap the description and epilog texts in command-line help messages:

    >>> parser = argparse.ArgumentParser(
     ...     prog='PROG',
    @@ -241,6 +260,23 @@ Note that most parent parsers will specify 

    If you want to maintain whitespace for all sorts of help text (including argument descriptions), you can use argparse.RawTextHelpFormatter.

    +

    The other formatter class available, argparse.ArgumentDefaultsHelpFormatter, will add information about the default value of each of the arguments:

    +
    >>> parser = argparse.ArgumentParser(
    +...     prog='PROG',
    +...     formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    +>>> parser.add_argument('--foo', type=int, default=42, help='FOO!')
    +>>> parser.add_argument('bar', nargs='*', default=[1, 2, 3], help='BAR!')
    +>>> parser.print_help()
    +usage: PROG [-h] [--foo FOO] [bar [bar ...]]
    +
    +positional arguments:
    +  bar         BAR! (default: [1, 2, 3])
    +
    +optional arguments:
    +  -h, --help  show this help message and exit
    +  --foo FOO   FOO! (default: 42)
    +
    +

    conflict_handler

    @@ -363,6 +399,7 @@ optional arguments:
  • version
  • add_help
  • prefix_chars
  • +
  • fromfile_prefix_chars
  • argument_default
  • parents
  • formatter_class
  • @@ -413,7 +450,7 @@ optional arguments:
  • previous |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • API documentation »
  • diff --git a/doc/add_argument.html b/doc/add_argument.html index 1d2cbe6..306c0df 100644 --- a/doc/add_argument.html +++ b/doc/add_argument.html @@ -5,13 +5,13 @@ - The add_argument() method — argparse v0.9.1 documentation + The add_argument() method — argparse v1.0 documentation - + @@ -37,7 +37,7 @@
  • previous |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • API documentation »
  • @@ -71,7 +71,7 @@

    name or flags

    -

    The add_argument() method needs to know whether you’re expecting an optional argument, e.g. -f or ``–foo`, or a positional argument, e.g. a list of filenames. The first arguments passed to add_argument() must therefore be either a series of flags, or a simple argument name. For example, an optional argument could be created like:

    +

    The add_argument() method needs to know whether you’re expecting an optional argument, e.g. -f or --foo, or a positional argument, e.g. a list of filenames. The first arguments passed to add_argument() must therefore be either a series of flags, or a simple argument name. For example, an optional argument could be created like:

    >>> parser.add_argument('-f', '--foo')
     
    @@ -420,6 +420,20 @@

    Note that metavar only changes the displayed name - the name of the attribute on the parse_args() object is still determined by the dest value.

    +

    Different values of nargs may cause the metavar to be used multiple times. +If you’d like to specify a different display name for each of the arguments, you can provide a tuple to metavar:

    +
    >>> parser = argparse.ArgumentParser(prog='PROG')
    +>>> parser.add_argument('-x', nargs=2)
    +>>> parser.add_argument('--foo', nargs=2, metavar=('bar', 'baz'))
    +>>> parser.print_help()
    +usage: PROG [-h] [-x X X] [--foo bar baz]
    +
    +optional arguments:
    +  -h, --help     show this help message and exit
    +  -x X X
    +  --foo bar baz
    +
    +
    diff --git a/doc/api-docs.html b/doc/api-docs.html index d459cd4..49409ff 100644 --- a/doc/api-docs.html +++ b/doc/api-docs.html @@ -5,13 +5,13 @@ - API documentation — argparse v0.9.1 documentation + API documentation — argparse v1.0 documentation - + @@ -36,7 +36,7 @@
  • previous |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • @@ -54,6 +54,7 @@
  • version
  • add_help
  • prefix_chars
  • +
  • fromfile_prefix_chars
  • argument_default
  • parents
  • formatter_class
  • @@ -86,6 +87,7 @@
  • Other methods
  • previous |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • @@ -345,7 +345,7 @@
  • previous |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • @@ -162,7 +162,7 @@ $ more log.txt
  • next |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • @@ -49,6 +49,25 @@

    Other methods

    +
    +

    Partial parsing

    +
    +
    +parse_known_args([args][, namespace])
    +
    + +

    Sometimes a script may only parse a few of the command line arguments, passing the remaining arguments on to another script or program. +In these cases, the parse_known_args() method can be useful. +It works much like parse_args() except that it does not produce an error when extra arguments are present. +Instead, it returns a two item tuple containing the populated namespace and the list of remaining argument strings.

    +
    >>> parser = argparse.ArgumentParser()
    +>>> parser.add_argument('--foo', action='store_true')
    +>>> parser.add_argument('bar')
    +>>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])
    +(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])
    +
    +
    +

    Printing help

    In most typical applications, parse_args() will take care of formatting and printing any usage or error messages. However, should you want to format or print these on your own, several methods are available:

    @@ -157,6 +176,25 @@ --baz {X,Y,Z} baz help
    +

    The add_subparsers() method also supports title and description keyword arguments. When either is present, the subparser’s commands will appear in their own group in the help output. For example:

    +
    >>> parser = argparse.ArgumentParser()
    +>>> subparsers = parser.add_subparsers(title='subcommands',
    +...                                    description='valid subcommands',
    +...                                    help='additional help')
    +>>> subparsers.add_parser('foo')
    +>>> subparsers.add_parser('bar')
    +>>> parser.parse_args(['-h'])
    +usage:  [-h] {foo,bar} ...
    +
    +optional arguments:
    +  -h, --help  show this help message and exit
    +
    +subcommands:
    +  valid subcommands
    +
    +  {foo,bar}   additional help
    +
    +

    One particularly effective way of handling sub-commands is to combine the use of the add_subparsers() method with calls to set_defaults() so that each subparser knows which Python function it should execute. For example:

    >>> # sub-command functions
     >>> def foo(args):
    @@ -291,6 +329,7 @@
                 

    Table Of Contents

    diff --git a/doc/other-utilities.html b/doc/other-utilities.html index ca587b6..0f54fcb 100644 --- a/doc/other-utilities.html +++ b/doc/other-utilities.html @@ -5,13 +5,13 @@ - Other utilities — argparse v0.9.1 documentation + Other utilities — argparse v1.0 documentation - + @@ -33,7 +33,7 @@
  • previous |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • API documentation »
  • @@ -118,7 +118,7 @@ class FileType(mode='r',
  • previous |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • API documentation »
  • diff --git a/doc/overview.html b/doc/overview.html index 6aeea30..0f6019c 100644 --- a/doc/overview.html +++ b/doc/overview.html @@ -5,13 +5,13 @@ - Introduction to argparse — argparse v0.9.1 documentation + Introduction to argparse — argparse v1.0 documentation - + @@ -36,7 +36,7 @@
  • previous |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • @@ -150,7 +150,7 @@ $ script.py --sum 1 2 3 4
  • previous |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • @@ -263,7 +263,7 @@
  • previous |
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • API documentation »
  • diff --git a/doc/search.html b/doc/search.html index 776edbe..c3ae9f4 100644 --- a/doc/search.html +++ b/doc/search.html @@ -5,13 +5,13 @@ - Search — argparse v0.9.1 documentation + Search — argparse v1.0 documentation - + @@ -77,7 +77,7 @@
  • index
  • -
  • argparse v0.9.1 documentation »
  • +
  • argparse v1.0 documentation »
  • diff --git a/doc/searchindex.js b/doc/searchindex.js index 4452a56..5013c17 100644 --- a/doc/searchindex.js +++ b/doc/searchindex.js @@ -1 +1 @@ -Search.setIndex({desctypes:{"0":"method","1":"class"},terms:{all:[6,3,7,5,2],code:[0,7,6],partial:7,messg:7,whatev:2,illustr:[7,5],global:6,four:5,prefix:[1,6,5],upgrad:[0,7],follow:[0,7,5,6,3],formatter_class:[8,6],whose:[5,6],typeerror:5,"const":[8,3,7,1,5],readabl:4,prefix_char:[8,7,6],program:[6,0,5,2,3],present:[7,1,2,5],sens:5,worth:5,consum:[7,5],everi:3,string:[1,2,3,5,6,7],fals:[6,7,5,2],subcommand:7,util:[8,0,4],parent_pars:6,default_:6,exact:7,implement:5,level:2,list:[1,2,3,5,6,7],"try":[7,6],item:5,adjust:6,stderr:2,pleas:6,subparser_nam:2,bacon:1,dogmat:7,past:7,zero:[7,5],fyoyo:7,group1:2,pass:[4,7,1,6,5],append:5,compat:7,what:[3,7,1,6,5],abc:[7,5],sub:[8,7,2],neg:1,section:[6,7,5,2],advanc:7,brief:[6,5,2],current:2,abbrevi:[8,1],version:[8,6],"new":[7,1,6,5],method:[0,1,2,3,5,6,7,8],told:5,deriv:[7,5],gener:[0,7,5,6,3],never:7,here:[7,1],let:2,inher:1,path:7,along:1,infil:[4,5],modifi:2,sinc:7,interpret:5,convert:[3,4,7,1,5],produc:[7,5],convers:5,pick:1,action:[1,2,3,5,6,7,8],weird:6,commonli:5,regardless:6,extra:1,appli:5,modul:[0,7,5,3],prefer:7,filenam:5,api:[8,0,7,5],txt:[0,5],select:[5,2],add_argument_group:2,from:[1,2,3,5,6,7],describ:[6,5,2],would:[7,5],frobbl:[5,2],regist:2,two:[3,1,6,5],few:[7,5],call:[0,1,2,3,5,6,7],add_help:[8,7,6,2],recommend:2,taken:[7,1,5],rawtexthelpformatt:6,type:[0,1,2,3,4,5,6,7,8],tell:[3,1],more:[0,1,3,5,6,7],sort:[3,5,6],parser_a:2,parser_b:2,notic:[7,1],warn:5,flag:[8,7,5],indic:[6,5,2],particular:[7,5,2],known:7,hold:[3,5],easiest:[7,5,2],must:[1,5],dictat:7,none:[4,7,1,6,5],word:6,dest:[1,2,3,5,7,8],work:[6,2],conceptu:2,remain:[3,7,5],itself:5,can:[0,1,2,3,4,5,6,7],def:[7,5,2],overrid:[7,6,2],traceback:6,prompt:1,puriti:7,give:[1,6],frabbl:3,share:[7,6],add_argu:[0,1,2,3,4,5,6,7,8],accept:[7,5,2],cautiou:1,want:[6,3,7,5,2],alwai:[6,5,2],multipl:[7,5,2],thing:5,rather:[1,6],anoth:[5,6],check_method:7,fooaction:[7,5],write:[0,7,3],how:[6,3,1,2,5],sever:[6,1,2],instead:[7,5,2],narg:[0,1,3,5,6,7,8],simpl:[0,7,5,3],updat:2,parser_abc:7,foo_pars:[7,6],overridden:6,mess:6,max:[3,1],after:[6,7,1,2,5],variant:2,invok:[6,3,7,5,2],befor:[5,6],wrong:1,okai:6,mai:[6,7,1,2,5],end:[7,5,2],associ:[5,2],xfoox:7,"0x013a2410":[],"short":[1,6,5],attempt:[7,1],practic:7,stdin:[4,5],explicit:5,correspond:[3,7],ambigu:1,caus:6,callback:7,type_:[],maintain:[7,6],combin:[1,2],allow:[6,7,1,2,5],callabl:[7,5],origin:7,least:[5,2],help:[0,1,2,3,5,6,7,8],over:7,becaus:6,through:7,same:[7,5,6],hierarchi:7,metavar_:[],still:5,subparser2:2,subparser1:2,paramet:[7,5,6],style:1,interspers:7,group:[8,2],fit:6,better:[7,2],main:2,easier:1,them:[0,5,1,6,3],good:2,"return":[3,7,1,2,5],thei:[7,1,6,5],python:[0,7,6,2],initi:[3,5],option_str:[7,5],now:[3,7],discuss:7,introduct:[0,3],choic:[1,2,3,5,7,8],allow_interspersed_arg:7,optionerror:7,name:[1,2,3,5,6,7,8],anyth:[7,5],choices_:[],separ:[1,2],easili:7,achiev:[1,6],mode:[4,7,5],each:[6,3,7,5,2],fulli:2,difficult:7,mean:[3,7,5],myprogram:6,replac:7,idea:2,heavi:1,expect:[3,1,5],our:3,happen:7,beyond:[8,1],metavar:[0,1,3,5,7,8],special:[5,2],out:[0,4,5,3],variabl:7,accomplish:[1,6],space:6,foo_bar:5,newli:1,parser_xyz:7,perfect_squar:5,print:[1,2,3,5,6,7,8],factori:[4,5],math:5,common:[3,5,6],optionvalueerror:7,worthwhil:7,situat:[1,5],given:6,argv:[8,3,1,6],standard:7,mmm:1,reason:7,base:7,dictionari:7,care:[7,2],indent:6,could:[1,5],omit:5,refus:7,turn:3,isn:[7,5],retain:6,const_:[],assign:1,first:5,oper:5,rang:[3,1],directli:5,carri:3,onc:3,number:[6,7,1,2,5],restrict:5,instruct:3,alreadi:[7,1,6],construct:[7,6],wasn:5,open:[4,7,5],size:4,differ:[7,5,2],script:3,top:2,sometim:[6,1,2],messag:[0,1,2,5,6,7],too:5,similarli:2,conveni:[7,5],"final":[],store:[3,5],monkei:7,option:[0,1,2,3,5,6,7,8],namespac:[1,2,3,4,5,6,7,8],copi:7,specifi:[0,1,2,3,5,6,7],pars:[0,1,2,3,5,7],store_tru:[3,7,1,2,5],exactli:[3,1,6],than:[6,7,1,2,5],format_usag:2,wide:6,kind:2,setattr:[7,5],whenev:[1,5],provid:[0,7,1,2,5],remov:6,charact:[7,1,6,5],str:5,were:5,posit:[0,1,2,3,5,6,7],seri:[3,5],sai:7,abov:[6,0,1,2,3],"0x013a2380":[],group2:2,argument:[0,1,2,3,4,5,6,7,8],dash:7,add_pars:[7,2],manner:[3,7],have:[4,7,1,6,5],"__main__":[0,3],need:[6,7,5,2],seem:7,built:[3,1],inform:[3,7,2],self:[7,5],append_const:5,also:[6,1,2,5],builtin:5,exampl:[0,1,2,3,5,6],take:[1,2,3,5,6,7],which:[6,7,1,2,5],singl:[1,2,3,5,6,7],uppercas:5,begin:[3,1],sure:[7,5,2],though:5,buffer:4,previou:[7,1],most:[6,3,7,5,2],regular:2,pair:[7,6],choos:[7,5],"class":[4,7,1,6,5],don:[7,1,5],gather:5,request:[4,5,2],doe:[7,5,6],declar:7,determin:[1,2,3,5,6,7],occasion:6,sum:[0,1,3],"0x00b8fb18":[],parser_bar:2,show:[6,0,7,5,2],text:6,filetyp:[8,0,4,5],syntax:[8,7,1],particularli:[7,2],hack:7,find:[3,1,2],onli:[6,7,1,2,5],eas:5,just:[5,2],pretti:3,"true":[1,2,3,5,6,7],parser_foo:2,figur:5,start:3,should:[0,2,3,5,6,7],store_const:[3,7,1,5],wood:1,dict:5,"__call__":[7,5],add_opt:7,variou:[5,6],get:[3,7,1,6],likewis:6,report:5,requir:[8,7,1,2,5],bar:[1,2,3,5,6,7],keyword:[1,2,3,5,6,7],baz:[7,5,2],dramat:7,patch:7,store_fals:[5,2],whether:[5,6],bad:[1,5],calcul:6,bac:1,contain:[1,2,5,6,7,8],where:[0,5,6],set:[6,3,7,5,2],"float":[7,5,2],see:[1,2,3,5,6,7],arg:[0,1,2,3,4,5,6,7],close:0,extend:[7,5],correctli:6,someth:3,written:0,subdir:6,between:6,"import":[0,7,5,6,3],awai:5,badger:[7,1,2],across:6,attribut:[1,2,3,5,6,7],parent:[8,7,6,2],xrang:[3,7,1,5],disallow:[7,6],extens:7,outfil:5,come:7,addit:[6,7,5,2],both:[7,1],last:[1,6],howev:[6,7,5,2],against:7,etc:[7,1,2,5],mani:[7,5],simpli:[6,7,1,2,5],point:7,argumentpars:[0,1,2,3,4,5,6,7,8],dispatch:7,featur:7,suppli:[6,3,7,5,2],respect:5,assum:[0,5,2,3],duplic:7,quit:[7,5],coupl:[6,2],addition:5,empti:1,implicit:7,accumul:[3,1],secret:7,much:[3,7,1,5],valu:[8,7,1,6,5],basic:5,unambigu:1,print_usag:2,popul:1,strategi:6,epilog:[8,6],suppress:[7,5,6],xxx:[7,5,6],great:5,ani:[6,7,5,2],understand:4,togeth:[1,5],func:2,child:6,repetit:5,those:[7,1],"case":[3,1,5],therefor:5,look:[3,7,1],format_help:2,defin:[6,5,2],"while":[7,1,5],behavior:[3,5,6],error:[6,7,1,2,5],argpars:[0,1,2,3,4,5,6,7],advantag:[0,7],stdout:[0,4,5],readi:3,kwarg:[7,2],"__init__":7,clearli:1,perform:[5,2],make:[6,3,7,5,2],format:[6,7,5,2],sqrt:5,check:[7,1,2,5],handl:[7,5,2],complex:[7,5],help_:[],split:[1,2,3,5,6,7],document:[8,0,1],infer:5,dest_:[],complet:2,dedent:6,foo_bar_baz_pars:7,effect:2,rais:[5,6],user:[6,7,1,2,5],store_act:7,typic:[3,7,5,2],recent:6,appropri:[0,2,3,5,6,7],older:6,thu:7,inherit:[7,6],without:2,command:[0,1,2,3,4,5,6,7,8],thi:[0,1,2,3,4,5,6,7],conflict:6,everyth:[7,1],sibl:2,usual:[6,7,5,2],identifi:5,execut:2,add_mutually_exclusive_group:2,note:[6,7,5,2],action_:[],exclus:[8,2],expos:7,had:7,except:6,add:[0,2,3,5,6,7],valid:[7,5],remaining_arg:7,rawdescriptionhelpformatt:6,save:[0,3],match:[6,7,1,2,5],applic:[6,2],transpar:7,read:5,textwrap:6,writabl:[4,5],know:[7,5,2],print_help:[6,7,5,2],insert:[1,6],like:[1,2,3,5,6,7],specif:6,arbitrari:5,whitespac:6,manual:7,resolv:6,integ:[0,5,7,1,3],collect:6,necessari:[3,7,5,2],either:[3,7,1,6,5],argumenterror:[7,6],output:[4,5,6],unnecessari:6,encount:[3,1,5],old:[6,2],often:5,"0x00b1f020":[],interact:1,some:[1,2,3,5,6,7],back:2,intern:5,mistak:1,proper:7,librari:7,absent:5,subpars:[7,2],avoid:5,normal:[1,2,5],definit:6,exit:[0,1,2,5,6,7],prog:[1,2,5,6,7,8],foo:[1,2,3,5,6,7],refer:[1,5],nargs_:[],object:[0,1,2,3,4,5,6,7,8],run:[0,3],inspect:[3,2],usag:[0,1,2,5,6,7,8],argument_default:[8,6],found:1,add_subpars:[7,2],"__name__":[0,3],"super":7,xyzz:1,about:[3,7,5,2],actual:7,callback_:7,optpars:[0,7],constructor:[7,6,2],commit:2,disabl:6,own:[6,7,5,2],xyz:[7,2],within:6,automat:[4,5],suppl:2,been:[3,7,5],strip:5,wrap:6,chang:[6,7,5,2],mark:5,yyi:[5,6],your:[6,3,7,5,2],manag:3,inclus:5,fill:[3,6],log:0,wai:[6,7,1,2,5],spam:[7,1,2],support:[6,7,1,2,5],"long":[7,1,5],custom:[6,8,1,2,5],avail:[6,5,2],almost:[5,6],interfac:[0,7,5,3],includ:[6,7,1,2,5],lot:[7,2],parse_arg:[0,1,2,3,4,5,6,7,8],treat:2,"function":[1,2,5],reduc:7,creation:[6,2],form:[3,7,5],bufsiz:[4,5],parents_:[],"0x00b8fe78":[],line:[0,1,2,3,4,5,6,7],conflict_handl:[8,6],concaten:1,made:1,input:5,temp:5,possibl:5,"default":[0,1,2,3,5,6,7,8],checkout:2,displai:[6,7,5,2],below:[7,5,6],otherwis:6,similar:7,later:3,constant:5,creat:[0,1,2,3,4,5,6,7],"int":[0,1,2,3,5,6,7],descript:[0,2,3,5,6,8],parser:[0,1,2,3,4,5,6,7,8],"0x00b1f068":[],doesn:[7,5],strongli:2,exist:1,file:[0,2,3,4,5,6,7],xyzyx:2,simplest:1,probabl:5,again:7,mutual:[8,2],titl:2,when:[0,1,2,3,5,6,7],detail:[1,6,5],invalid:[8,7,1,5],other:[0,1,2,4,7,8],futur:2,scriptnam:0,varieti:1,test:7,set_default:[6,2],you:[1,2,3,5,6,7],bar_pars:[7,6],repeat:6,clean:6,why:7,consid:[5,6],"0x00adf020":[],svn:2,receiv:7,longer:[7,1,2],pseudo:[4,1],time:[7,5,2],backward:7},titles:["Documentation","The parse_args() method","Other methods","Introduction to argparse","Other utilities","The add_argument() method","ArgumentParser objects","argparse vs. optparse","API documentation"],modules:{},descrefs:{"":{parse_args:[1,0],add_mutually_exclusive_group:[2,0],set_defaults:[2,0],FileType:[4,1],add_argument:[5,0],ArgumentParser:[6,1],add_subparsers:[2,0],add_argument_group:[2,0]}},filenames:["index","parse_args","other-methods","overview","other-utilities","add_argument","ArgumentParser","argparse-vs-optparse","api-docs"]}) \ No newline at end of file +Search.setIndex({desctypes:{"0":"method","1":"class"},terms:{all:[6,3,7,5,2],code:[0,7,6],partial:[8,7,2],messg:7,whatev:2,illustr:[7,5],global:6,four:5,prefix:[1,6,5],follow:[0,7,5,6,3],concaten:1,formatter_class:[8,6],whose:[5,6],typeerror:5,"const":[8,3,7,1,5],readabl:4,prefix_char:[8,7,6],program:[6,0,5,2,3],those:[7,1],sens:[5,6],worth:5,consum:[7,5],everi:3,string:[1,2,3,5,6,7],fals:[6,7,5,2],subcommand:[7,2],util:[8,0,4],prog:[1,2,5,6,7,8],default_:[],exact:7,implement:5,level:2,list:[1,2,3,5,6,7],"try":[7,6],item:[5,2],adjust:6,stderr:2,readi:3,pleas:6,subparser_nam:2,bacon:1,dogmat:7,past:7,zero:[7,5],fyoyo:7,group1:2,pass:[1,2,4,5,6,7],append:5,compat:7,what:[3,7,1,6,5],abc:[7,5],sub:[8,7,2],neg:1,section:[6,7,5,2],advanc:7,brief:[6,5,2],current:[6,2],abbrevi:[8,1],version:[8,6],"new":[7,1,6,5],method:[0,1,2,3,5,6,7,8],told:5,deriv:[7,5],gener:[0,7,5,6,3],never:[7,6],here:[7,1],let:2,inher:1,path:7,along:1,standard:7,modifi:2,sinc:7,interpret:5,convert:[3,4,7,1,5],convers:5,pick:1,action:[1,2,3,5,6,7,8],weird:6,commonli:5,control:6,regardless:6,extra:[1,2],appli:5,modul:[0,7,5,3],prefer:7,"while":[7,1,6,5],filenam:5,api:[8,0,7,5],txt:[0,5,6],select:[5,2],add_argument_group:2,from:[1,2,3,5,6,7],describ:[6,5,2],would:[7,5],frobbl:[5,2],regist:2,two:[6,3,1,2,5],few:[7,5,2],call:[0,1,2,3,5,6,7],add_help:[8,7,6,2],recommend:2,taken:[7,1,5],care:[7,2],type:[0,1,2,3,4,5,6,7,8],tell:[3,1],more:[0,1,3,5,6,7],sort:[3,5,6],parser_a:2,parser_b:2,line:[0,1,2,3,4,5,6,7],notic:[7,1],warn:5,flag:[8,7,5],indic:[6,5,2],particular:[7,5,2],known:7,hold:[3,5],easiest:[7,5,2],must:[1,6,5],dictat:7,none:[4,7,1,6,5],word:6,work:[6,2],conceptu:2,remain:[3,7,5,2],kwarg:[7,2],can:[0,1,2,3,4,5,6,7],def:[7,5,2],overrid:[7,6,2],omit:5,prompt:1,puriti:7,give:[1,6],frabbl:3,share:[7,6],add_argu:[0,1,2,3,4,5,6,7,8],accept:[7,5,2],cautiou:1,want:[6,3,7,5,2],alwai:[6,5,2],multipl:[7,5,2],turn:3,rather:[1,6],anoth:[6,5,2],check_method:7,fooaction:[7,5],write:[0,7,6,3],how:[6,3,1,2,5],"__init__":7,instead:[7,5,2],narg:[0,1,3,5,6,7,8],simpl:[0,7,5,3],updat:2,parser_abc:7,foo_pars:[7,6],referenc:6,mess:6,max:[3,1],after:[6,7,1,2,5],variant:2,befor:[5,6],wrong:1,okai:6,mai:[6,7,1,2,5],end:[7,5,2],associ:[5,2],xfoox:7,"0x013a2410":[],"short":[1,6,5],store_tru:[3,7,1,2,5],practic:7,read:[5,6],stdin:[4,5],explicit:5,correspond:[3,7],ambigu:1,caus:[5,6],inform:[3,7,6,2],type_:[],maintain:[7,6],combin:[1,2],allow:[6,7,1,2,5],callabl:[7,5],origin:[7,6],least:[5,2],help:[0,1,2,3,5,6,7,8],over:[7,6],becaus:6,through:7,sqrt:5,hierarchi:7,metavar_:[],still:5,subparser2:2,subparser1:2,paramet:[7,5,6],style:1,interspers:7,group:[8,2],fit:6,better:[7,2],main:2,easier:1,them:[0,5,1,6,3],good:2,"return":[3,7,1,2,5],thei:[7,1,6,5],python:[0,7,6,2],initi:[3,5],option_str:[7,5],now:[3,7],discuss:7,introduct:[0,3],choic:[1,2,3,5,7,8],allow_interspersed_arg:7,optionerror:7,name:[1,2,3,5,6,7,8],anyth:[7,5],choices_:[],separ:[1,2],easili:7,achiev:[1,6],mode:[4,7,5],each:[6,3,7,5,2],fulli:2,complet:2,nbar:6,mean:[3,7,5,6],myprogram:6,replac:[7,6],idea:2,heavi:1,expect:[3,1,5],our:3,happen:7,beyond:[8,1],metavar:[0,1,3,5,7,8],special:[5,2],out:[0,4,5,6,3],variabl:7,accomplish:[1,6],overridden:6,space:6,foo_bar:5,newli:1,parser_xyz:7,perfect_squar:5,print:[1,2,3,5,6,7,8],factori:[4,5],math:5,bac:1,optionvalueerror:7,worthwhil:7,situat:[1,5],given:6,argv:[8,3,1,6],infil:[4,5],mmm:1,reason:7,base:7,dictionari:7,rawtexthelpformatt:6,indent:6,could:[1,5],traceback:6,refus:7,keep:6,fromfile_prefix_char:[8,6],thing:5,place:6,isn:[7,5],retain:6,const_:[],assign:1,first:[5,6],oper:5,rang:[3,1],directli:5,carri:3,onc:3,number:[6,7,1,2,5],restrict:5,instruct:3,alreadi:[7,1,6],construct:[7,6],wasn:5,open:[4,7,5,6],size:4,differ:[7,5,2],"long":[7,1,6,5],script:[3,2],top:2,sometim:[6,1,2],messag:[0,1,2,5,6,7],too:5,similarli:2,gather:5,conveni:[7,5],"final":[],store:[3,5],monkei:7,option:[0,1,2,3,5,6,7,8],namespac:[1,2,3,4,5,6,7,8],copi:7,specifi:[0,1,2,3,5,6,7],pars:[0,1,2,3,5,7,8],attempt:[7,1],exactli:[3,1,6],than:[6,7,1,2,5],format_usag:2,wide:6,kind:2,setattr:[7,5],whenev:[1,5],provid:[0,7,1,2,5],remov:6,charact:[7,1,6,5],str:5,were:[5,6],posit:[0,1,2,3,5,6,7],seri:[3,5],sai:7,behavior:[3,5,6],"0x013a2380":[],group2:2,argument:[0,1,2,3,4,5,6,7,8],dash:7,add_pars:[7,2],manner:[3,7],have:[4,7,1,6,5],"__main__":[0,3],need:[6,7,5,2],seem:7,probabl:5,built:[3,1],equival:6,callback:7,self:[7,5],append_const:5,also:[6,1,2,5],builtin:5,without:2,take:[1,2,3,5,6,7],which:[6,7,1,2,5],singl:[1,2,3,5,6,7],uppercas:5,begin:[3,1],sure:[7,5,2],though:5,buffer:4,previou:[7,1],most:[6,3,7,5,2],regular:2,pair:[7,6],choos:[7,5],"class":[4,7,1,6,5],appear:2,don:[7,1,5],later:3,request:[4,5,2],doe:[6,7,5,2],declar:7,determin:[1,2,3,5,6,7],occasion:6,sum:[0,1,3],"0x00b8fb18":[],parser_bar:2,show:[6,0,7,5,2],text:6,filetyp:[8,0,4,5],syntax:[8,7,1],particularli:[7,6,2],hack:7,find:[3,1,2],onli:[6,7,1,2,5],parse_known_arg:2,execut:2,pretti:3,"true":[1,2,3,5,6,7],parser_foo:2,written:0,should:[0,2,3,5,6,7],store_const:[3,7,1,5],wood:1,dict:5,"__call__":[7,5],add_opt:7,variou:[5,6],get:[3,7,1,6],express:6,report:5,requir:[8,7,1,2,5],bar:[1,2,3,5,6,7],keyword:[1,2,3,5,6,7],baz:[7,5,2],dramat:7,patch:7,store_fals:[5,2],"default":[0,1,2,3,5,6,7,8],bad:[1,5],calcul:6,common:[3,5,6],contain:[1,2,5,6,7,8],where:[0,5,6],set:[6,3,7,5,2],see:[1,2,3,5,6,7],arg:[0,1,2,3,4,5,6,7],close:0,parent:[8,7,6,2],correctli:6,someth:3,figur:5,subdir:6,between:6,"import":[0,7,5,6,3],awai:5,badger:[7,1,2],across:6,attribut:[1,2,3,5,6,7],altern:6,extend:[7,5],xrang:[3,7,1,5],disallow:[7,6],extens:7,outfil:5,come:7,addit:[6,7,5,2],both:[7,1],last:[1,6],howev:[6,7,5,2],against:7,etc:[7,1,2,5],mani:[7,5],whole:6,simpli:[6,7,1,2,5],point:7,within:6,argumentpars:[0,1,2,3,4,5,6,7,8],dispatch:7,suppli:[6,3,7,5,2],respect:5,assum:[0,5,2,3],duplic:7,quit:[7,5],coupl:[6,2],addition:5,three:6,empti:1,implicit:7,accumul:[3,1],secret:7,much:[3,7,1,2,5],valu:[8,7,1,6,5],basic:5,unambigu:1,print_usag:2,popul:[1,2],strategi:6,epilog:[8,6],suppress:[7,5,6],xxx:[7,5,6],great:5,ani:[6,7,5,2],understand:4,togeth:[1,5],func:2,child:6,repetit:5,present:[7,1,2,5],"case":[3,1,2,5],therefor:5,look:[3,7,1],format_help:2,formatt:6,defin:[6,5,2],invok:[6,3,7,5,2],abov:[6,0,1,2,3],error:[6,7,1,2,5],argpars:[0,1,2,3,4,5,6,7],advantag:[0,7],stdout:[0,4,5],almost:[5,6],itself:5,sever:[6,1,2],disabl:6,clearli:1,perform:[5,2],make:[6,3,7,5,2],transpar:7,same:[7,5,6],handl:[7,5,2],complex:[7,5],help_:[],split:[1,2,3,5,6,7],document:[8,0,1],infer:5,dest_:[],difficult:7,dedent:6,foo_bar_baz_pars:7,effect:2,rais:[5,6],user:[6,7,1,2,5],store_act:7,typic:[3,7,5,2],recent:6,appropri:[0,2,3,5,6,7],older:6,thu:7,inherit:[7,6],likewis:6,exampl:[0,1,2,3,5,6],command:[0,1,2,3,4,5,6,7,8],thi:[0,1,2,3,4,5,6,7],conflict:6,everyth:[7,1],sibl:2,usual:[6,7,5,2],identifi:5,just:[5,2],object:[0,1,2,3,4,5,6,7,8],add_mutually_exclusive_group:2,note:[6,7,5,2],action_:[],exclus:[8,2],expos:7,had:7,except:[6,2],add:[0,2,3,5,6,7],other:[0,1,2,4,6,7,8],remaining_arg:7,rawdescriptionhelpformatt:6,save:[0,3],match:[6,7,1,2,5],applic:[6,2],format:[6,7,5,2],dest:[1,2,3,5,7,8],textwrap:6,test:7,know:[7,5,2],insert:[1,6],like:[1,2,3,5,6,7],specif:6,arbitrari:5,whitespac:6,manual:7,resolv:6,integ:[0,5,7,1,3],collect:6,necessari:[3,7,5,2],either:[1,2,3,5,6,7],argumenterror:[7,6],output:[6,4,5,2],unnecessari:6,encount:[3,1,5],old:[6,2],often:5,"0x00b1f020":[],interact:1,some:[1,2,3,5,6,7],back:2,intern:5,suppl:2,mistak:1,proper:7,librari:7,subpars:[7,2],avoid:5,normal:[1,2,5],definit:6,per:6,exit:[0,1,2,5,6,7],parent_pars:6,foo:[1,2,3,5,6,7],refer:[1,6,5],nargs_:[],print_help:[6,7,5,2],run:[0,3],inspect:[3,2],usag:[0,1,2,5,6,7,8],argument_default:[8,6],found:1,add_subpars:[7,2],"__name__":[0,3],"super":7,xyzz:1,about:[6,3,7,5,2],simplest:1,actual:7,callback_:7,optpars:[0,7],constructor:[7,6,2],commit:2,produc:[7,5,2],own:[6,7,5,2],xyz:[7,2],"float":[7,5,2],automat:[4,5,6],upgrad:[0,7],been:[3,7,5],strip:5,wrap:6,chang:[6,7,5,2],mark:5,yyi:[5,6],your:[6,3,7,5,2],manag:3,inclus:5,log:0,wai:[6,7,1,2,5],spam:[7,1,2],support:[6,7,1,2,5],textual:6,custom:[6,8,1,2,5],avail:[6,5,2],start:[3,6],interfac:[0,7,5,3],includ:[6,7,1,2,5],lot:[7,2],parse_arg:[0,1,2,3,4,5,6,7,8],treat:[6,2],"function":[1,2,5],svn:2,creation:[6,2],form:[3,7,5],tupl:[5,2],bufsiz:[4,5],parents_:[],"0x00b8fe78":[],eas:5,conflict_handl:[8,6],absent:5,made:1,input:5,temp:5,possibl:5,whether:[5,6],checkout:2,argumentdefaultshelpformatt:6,displai:[6,7,5,2],below:[7,5,6],otherwis:6,similar:7,featur:7,constant:5,creat:[0,1,2,3,4,5,6,7],"int":[0,1,2,3,5,6,7],pseudo:[4,1],parser:[0,1,2,3,4,5,6,7,8],"0x00b1f068":[],doesn:[7,5],strongli:2,exist:1,file:[0,2,3,4,5,6,7],xyzyx:2,check:[7,1,2,5],fill:[3,6],again:7,mutual:[8,2],titl:2,when:[0,1,2,3,5,6,7],detail:[1,6,5],invalid:[8,7,1,5],valid:[7,5,2],futur:2,scriptnam:0,varieti:1,writabl:[4,5],set_default:[6,2],you:[1,2,3,5,6,7],bar_pars:[7,6],repeat:6,clean:6,why:7,consid:[5,6],"0x00adf020":[],reduc:7,receiv:7,longer:[7,1,2],descript:[0,2,3,5,6,8],time:[7,5,2],backward:7},titles:["Documentation","The parse_args() method","Other methods","Introduction to argparse","Other utilities","The add_argument() method","ArgumentParser objects","argparse vs. optparse","API documentation"],modules:{},descrefs:{"":{parse_args:[1,0],parse_known_args:[2,0],add_mutually_exclusive_group:[2,0],set_defaults:[2,0],FileType:[4,1],add_argument:[5,0],ArgumentParser:[6,1],add_subparsers:[2,0],add_argument_group:[2,0]}},filenames:["index","parse_args","other-methods","overview","other-utilities","add_argument","ArgumentParser","argparse-vs-optparse","api-docs"]}) \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index 37b4763..2d1e591 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -45,9 +45,9 @@ copyright = u'2006-2009, Steven Bethard' # built documents. # # The short X.Y version. -version = '0.9.2' +version = '1.0' # The full version, including alpha/beta/rc tags. -release = '0.9.2' +release = '1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -- cgit v1.2.1