All Samples(11801) | Call(7142) | Derive(298) | Import(4361)
Class attributes:
standard_option_list : [Option]
list of standard options that will be accepted by all instances
of this parser class (intended to be overridden by subclasses).
Instance attributes:
usage : string
a usage string for your program. Before it is displayed
to the user, "%prog" will be expanded to the name of
your program (self.prog or os.path.basename(sys.argv[0])).
prog : string
the name of the current program (to override
os.path.basename(sys.argv[0])).
epilog : string
paragraph of help text to print after option help
option_groups : [OptionGroup]
list of option groups in this parser (option groups are
irrelevant for parsing the command-line, but very useful
for generating help)
allow_interspersed_args : bool = true
if true, positional arguments may be interspersed with options.
Assuming -a and -b each take a single argument, the command-line
-ablah foo bar -bboo baz
will be interpreted the same as
-ablah -bboo -- foo bar baz
If this flag were false, that command line would be interpreted as
-ablah -- foo bar -bboo baz
-- ie. we stop processing options as soon as we see the first
non-option argument. (This is the tradition followed by
Python's getopt module, Perl's Getopt::Std, and other argument-
parsing libraries, but it is generally annoying to users.)
process_default_values : bool = true
if true, option default values are processed similarly to option
values from the command line: that is, they are passed to the
type-checking function for the option's type (as long as the
default value is a string). (This really only matters if you
have defined custom types; see SF bug #955889.) Set it to false
to restore the behaviour of Optik 1.4.1 and earlier.
rargs : [string]
the argument list currently being parsed. Only set when
parse_args() is active, and continually trimmed down as
we consume arguments. Mainly there for the benefit of
callback options.
largs : [string]
the list of leftover arguments that we have skipped while
parsing options. If allow_interspersed_args is false, this
list is always empty.
values : Values
the set of option values currently being accumulated. Only
set when parse_args() is active. Also mainly for callbacks.
Because of the 'rargs', 'largs', and 'values' attributes,
OptionParser is not thread-safe. If, for some perverse reason, you
need to parse command-line arguments simultaneously in different
threads, use different OptionParser instances.src/p/e/pexpect-HEAD/pexpect/examples/hive.py pexpect(Download)
if __name__ == '__main__':
try:
start_time = time.time()
parser = optparse.OptionParser(formatter=optparse.TitledHelpFormatter(), usage=globals()['__doc__'], version='$Id: hive.py 509 2008-01-05 21:27:47Z noah $',conflict_handler="resolve")
parser.add_option ('-v', '--verbose', action='store_true', default=False, help='verbose output')
parser.add_option ('--samepass', action='store_true', default=False, help='Use same password for each login.')
parser.add_option ('--sameuser', action='store_true', default=False, help='Use same username for each login.')
src/p/e/pexpect-2.4/examples/hive.py pexpect(Download)
if __name__ == '__main__':
try:
start_time = time.time()
parser = optparse.OptionParser(formatter=optparse.TitledHelpFormatter(), usage=globals()['__doc__'], version='$Id: hive.py 509 2008-01-05 21:27:47Z noah $',conflict_handler="resolve")
parser.add_option ('-v', '--verbose', action='store_true', default=False, help='verbose output')
parser.add_option ('--samepass', action='store_true', default=False, help='Use same password for each login.')
parser.add_option ('--sameuser', action='store_true', default=False, help='Use same username for each login.')
src/v/o/volity-HEAD/trunk/server-python/zymb-examples/wget.py volity(Download)
usage = "usage: %prog [ options ] url"
popt = optparse.OptionParser(prog=sys.argv[0],
usage=usage,
formatter=optparse.IndentedHelpFormatter(short_first=False))
src/v/o/volity-HEAD/trunk/server-python/zymb-examples/rpcserver.py volity(Download)
usage = "usage: %prog [ options ]"
popt = optparse.OptionParser(prog=sys.argv[0],
usage=usage,
formatter=optparse.IndentedHelpFormatter(short_first=False))
src/v/o/volity-HEAD/trunk/server-python/zymb-examples/relay.py volity(Download)
usage = "usage: %prog [ options ] host port"
popt = optparse.OptionParser(prog=sys.argv[0],
usage=usage,
formatter=optparse.IndentedHelpFormatter(short_first=False))
src/v/o/volity-HEAD/trunk/server-python/zymb-examples/cat.py volity(Download)
usage = "usage: %prog [ options ] [ filename ]"
popt = optparse.OptionParser(prog=sys.argv[0],
usage=usage,
formatter=optparse.IndentedHelpFormatter(short_first=False))
src/v/o/volity-HEAD/server-python/zymb-examples/wget.py volity(Download)
usage = "usage: %prog [ options ] url"
popt = optparse.OptionParser(prog=sys.argv[0],
usage=usage,
formatter=optparse.IndentedHelpFormatter(short_first=False))
src/v/o/volity-HEAD/server-python/zymb-examples/rpcserver.py volity(Download)
usage = "usage: %prog [ options ]"
popt = optparse.OptionParser(prog=sys.argv[0],
usage=usage,
formatter=optparse.IndentedHelpFormatter(short_first=False))
src/v/o/volity-HEAD/server-python/zymb-examples/relay.py volity(Download)
usage = "usage: %prog [ options ] host port"
popt = optparse.OptionParser(prog=sys.argv[0],
usage=usage,
formatter=optparse.IndentedHelpFormatter(short_first=False))
src/v/o/volity-HEAD/server-python/zymb-examples/cat.py volity(Download)
usage = "usage: %prog [ options ] [ filename ]"
popt = optparse.OptionParser(prog=sys.argv[0],
usage=usage,
formatter=optparse.IndentedHelpFormatter(short_first=False))
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next