Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../lib64/python2....
File: optparse.py
"""A powerful, extensible, and easy-to-use option parser.
[0] Fix | Delete
[1] Fix | Delete
By Greg Ward <gward@python.net>
[2] Fix | Delete
[3] Fix | Delete
Originally distributed as Optik.
[4] Fix | Delete
[5] Fix | Delete
For support, use the optik-users@lists.sourceforge.net mailing list
[6] Fix | Delete
(http://lists.sourceforge.net/lists/listinfo/optik-users).
[7] Fix | Delete
[8] Fix | Delete
Simple usage example:
[9] Fix | Delete
[10] Fix | Delete
from optparse import OptionParser
[11] Fix | Delete
[12] Fix | Delete
parser = OptionParser()
[13] Fix | Delete
parser.add_option("-f", "--file", dest="filename",
[14] Fix | Delete
help="write report to FILE", metavar="FILE")
[15] Fix | Delete
parser.add_option("-q", "--quiet",
[16] Fix | Delete
action="store_false", dest="verbose", default=True,
[17] Fix | Delete
help="don't print status messages to stdout")
[18] Fix | Delete
[19] Fix | Delete
(options, args) = parser.parse_args()
[20] Fix | Delete
"""
[21] Fix | Delete
[22] Fix | Delete
__version__ = "1.5.3"
[23] Fix | Delete
[24] Fix | Delete
__all__ = ['Option',
[25] Fix | Delete
'make_option',
[26] Fix | Delete
'SUPPRESS_HELP',
[27] Fix | Delete
'SUPPRESS_USAGE',
[28] Fix | Delete
'Values',
[29] Fix | Delete
'OptionContainer',
[30] Fix | Delete
'OptionGroup',
[31] Fix | Delete
'OptionParser',
[32] Fix | Delete
'HelpFormatter',
[33] Fix | Delete
'IndentedHelpFormatter',
[34] Fix | Delete
'TitledHelpFormatter',
[35] Fix | Delete
'OptParseError',
[36] Fix | Delete
'OptionError',
[37] Fix | Delete
'OptionConflictError',
[38] Fix | Delete
'OptionValueError',
[39] Fix | Delete
'BadOptionError']
[40] Fix | Delete
[41] Fix | Delete
__copyright__ = """
[42] Fix | Delete
Copyright (c) 2001-2006 Gregory P. Ward. All rights reserved.
[43] Fix | Delete
Copyright (c) 2002-2006 Python Software Foundation. All rights reserved.
[44] Fix | Delete
[45] Fix | Delete
Redistribution and use in source and binary forms, with or without
[46] Fix | Delete
modification, are permitted provided that the following conditions are
[47] Fix | Delete
met:
[48] Fix | Delete
[49] Fix | Delete
* Redistributions of source code must retain the above copyright
[50] Fix | Delete
notice, this list of conditions and the following disclaimer.
[51] Fix | Delete
[52] Fix | Delete
* Redistributions in binary form must reproduce the above copyright
[53] Fix | Delete
notice, this list of conditions and the following disclaimer in the
[54] Fix | Delete
documentation and/or other materials provided with the distribution.
[55] Fix | Delete
[56] Fix | Delete
* Neither the name of the author nor the names of its
[57] Fix | Delete
contributors may be used to endorse or promote products derived from
[58] Fix | Delete
this software without specific prior written permission.
[59] Fix | Delete
[60] Fix | Delete
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
[61] Fix | Delete
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
[62] Fix | Delete
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
[63] Fix | Delete
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
[64] Fix | Delete
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
[65] Fix | Delete
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
[66] Fix | Delete
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
[67] Fix | Delete
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
[68] Fix | Delete
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
[69] Fix | Delete
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
[70] Fix | Delete
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[71] Fix | Delete
"""
[72] Fix | Delete
[73] Fix | Delete
import sys, os
[74] Fix | Delete
import types
[75] Fix | Delete
import textwrap
[76] Fix | Delete
[77] Fix | Delete
def _repr(self):
[78] Fix | Delete
return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self)
[79] Fix | Delete
[80] Fix | Delete
[81] Fix | Delete
# This file was generated from:
[82] Fix | Delete
# Id: option_parser.py 527 2006-07-23 15:21:30Z greg
[83] Fix | Delete
# Id: option.py 522 2006-06-11 16:22:03Z gward
[84] Fix | Delete
# Id: help.py 527 2006-07-23 15:21:30Z greg
[85] Fix | Delete
# Id: errors.py 509 2006-04-20 00:58:24Z gward
[86] Fix | Delete
[87] Fix | Delete
try:
[88] Fix | Delete
from gettext import gettext
[89] Fix | Delete
except ImportError:
[90] Fix | Delete
def gettext(message):
[91] Fix | Delete
return message
[92] Fix | Delete
_ = gettext
[93] Fix | Delete
[94] Fix | Delete
[95] Fix | Delete
class OptParseError (Exception):
[96] Fix | Delete
def __init__(self, msg):
[97] Fix | Delete
self.msg = msg
[98] Fix | Delete
[99] Fix | Delete
def __str__(self):
[100] Fix | Delete
return self.msg
[101] Fix | Delete
[102] Fix | Delete
[103] Fix | Delete
class OptionError (OptParseError):
[104] Fix | Delete
"""
[105] Fix | Delete
Raised if an Option instance is created with invalid or
[106] Fix | Delete
inconsistent arguments.
[107] Fix | Delete
"""
[108] Fix | Delete
[109] Fix | Delete
def __init__(self, msg, option):
[110] Fix | Delete
self.msg = msg
[111] Fix | Delete
self.option_id = str(option)
[112] Fix | Delete
[113] Fix | Delete
def __str__(self):
[114] Fix | Delete
if self.option_id:
[115] Fix | Delete
return "option %s: %s" % (self.option_id, self.msg)
[116] Fix | Delete
else:
[117] Fix | Delete
return self.msg
[118] Fix | Delete
[119] Fix | Delete
class OptionConflictError (OptionError):
[120] Fix | Delete
"""
[121] Fix | Delete
Raised if conflicting options are added to an OptionParser.
[122] Fix | Delete
"""
[123] Fix | Delete
[124] Fix | Delete
class OptionValueError (OptParseError):
[125] Fix | Delete
"""
[126] Fix | Delete
Raised if an invalid option value is encountered on the command
[127] Fix | Delete
line.
[128] Fix | Delete
"""
[129] Fix | Delete
[130] Fix | Delete
class BadOptionError (OptParseError):
[131] Fix | Delete
"""
[132] Fix | Delete
Raised if an invalid option is seen on the command line.
[133] Fix | Delete
"""
[134] Fix | Delete
def __init__(self, opt_str):
[135] Fix | Delete
self.opt_str = opt_str
[136] Fix | Delete
[137] Fix | Delete
def __str__(self):
[138] Fix | Delete
return _("no such option: %s") % self.opt_str
[139] Fix | Delete
[140] Fix | Delete
class AmbiguousOptionError (BadOptionError):
[141] Fix | Delete
"""
[142] Fix | Delete
Raised if an ambiguous option is seen on the command line.
[143] Fix | Delete
"""
[144] Fix | Delete
def __init__(self, opt_str, possibilities):
[145] Fix | Delete
BadOptionError.__init__(self, opt_str)
[146] Fix | Delete
self.possibilities = possibilities
[147] Fix | Delete
[148] Fix | Delete
def __str__(self):
[149] Fix | Delete
return (_("ambiguous option: %s (%s?)")
[150] Fix | Delete
% (self.opt_str, ", ".join(self.possibilities)))
[151] Fix | Delete
[152] Fix | Delete
[153] Fix | Delete
class HelpFormatter:
[154] Fix | Delete
[155] Fix | Delete
"""
[156] Fix | Delete
Abstract base class for formatting option help. OptionParser
[157] Fix | Delete
instances should use one of the HelpFormatter subclasses for
[158] Fix | Delete
formatting help; by default IndentedHelpFormatter is used.
[159] Fix | Delete
[160] Fix | Delete
Instance attributes:
[161] Fix | Delete
parser : OptionParser
[162] Fix | Delete
the controlling OptionParser instance
[163] Fix | Delete
indent_increment : int
[164] Fix | Delete
the number of columns to indent per nesting level
[165] Fix | Delete
max_help_position : int
[166] Fix | Delete
the maximum starting column for option help text
[167] Fix | Delete
help_position : int
[168] Fix | Delete
the calculated starting column for option help text;
[169] Fix | Delete
initially the same as the maximum
[170] Fix | Delete
width : int
[171] Fix | Delete
total number of columns for output (pass None to constructor for
[172] Fix | Delete
this value to be taken from the $COLUMNS environment variable)
[173] Fix | Delete
level : int
[174] Fix | Delete
current indentation level
[175] Fix | Delete
current_indent : int
[176] Fix | Delete
current indentation level (in columns)
[177] Fix | Delete
help_width : int
[178] Fix | Delete
number of columns available for option help text (calculated)
[179] Fix | Delete
default_tag : str
[180] Fix | Delete
text to replace with each option's default value, "%default"
[181] Fix | Delete
by default. Set to false value to disable default value expansion.
[182] Fix | Delete
option_strings : { Option : str }
[183] Fix | Delete
maps Option instances to the snippet of help text explaining
[184] Fix | Delete
the syntax of that option, e.g. "-h, --help" or
[185] Fix | Delete
"-fFILE, --file=FILE"
[186] Fix | Delete
_short_opt_fmt : str
[187] Fix | Delete
format string controlling how short options with values are
[188] Fix | Delete
printed in help text. Must be either "%s%s" ("-fFILE") or
[189] Fix | Delete
"%s %s" ("-f FILE"), because those are the two syntaxes that
[190] Fix | Delete
Optik supports.
[191] Fix | Delete
_long_opt_fmt : str
[192] Fix | Delete
similar but for long options; must be either "%s %s" ("--file FILE")
[193] Fix | Delete
or "%s=%s" ("--file=FILE").
[194] Fix | Delete
"""
[195] Fix | Delete
[196] Fix | Delete
NO_DEFAULT_VALUE = "none"
[197] Fix | Delete
[198] Fix | Delete
def __init__(self,
[199] Fix | Delete
indent_increment,
[200] Fix | Delete
max_help_position,
[201] Fix | Delete
width,
[202] Fix | Delete
short_first):
[203] Fix | Delete
self.parser = None
[204] Fix | Delete
self.indent_increment = indent_increment
[205] Fix | Delete
if width is None:
[206] Fix | Delete
try:
[207] Fix | Delete
width = int(os.environ['COLUMNS'])
[208] Fix | Delete
except (KeyError, ValueError):
[209] Fix | Delete
width = 80
[210] Fix | Delete
width -= 2
[211] Fix | Delete
self.width = width
[212] Fix | Delete
self.help_position = self.max_help_position = \
[213] Fix | Delete
min(max_help_position, max(width - 20, indent_increment * 2))
[214] Fix | Delete
self.current_indent = 0
[215] Fix | Delete
self.level = 0
[216] Fix | Delete
self.help_width = None # computed later
[217] Fix | Delete
self.short_first = short_first
[218] Fix | Delete
self.default_tag = "%default"
[219] Fix | Delete
self.option_strings = {}
[220] Fix | Delete
self._short_opt_fmt = "%s %s"
[221] Fix | Delete
self._long_opt_fmt = "%s=%s"
[222] Fix | Delete
[223] Fix | Delete
def set_parser(self, parser):
[224] Fix | Delete
self.parser = parser
[225] Fix | Delete
[226] Fix | Delete
def set_short_opt_delimiter(self, delim):
[227] Fix | Delete
if delim not in ("", " "):
[228] Fix | Delete
raise ValueError(
[229] Fix | Delete
"invalid metavar delimiter for short options: %r" % delim)
[230] Fix | Delete
self._short_opt_fmt = "%s" + delim + "%s"
[231] Fix | Delete
[232] Fix | Delete
def set_long_opt_delimiter(self, delim):
[233] Fix | Delete
if delim not in ("=", " "):
[234] Fix | Delete
raise ValueError(
[235] Fix | Delete
"invalid metavar delimiter for long options: %r" % delim)
[236] Fix | Delete
self._long_opt_fmt = "%s" + delim + "%s"
[237] Fix | Delete
[238] Fix | Delete
def indent(self):
[239] Fix | Delete
self.current_indent += self.indent_increment
[240] Fix | Delete
self.level += 1
[241] Fix | Delete
[242] Fix | Delete
def dedent(self):
[243] Fix | Delete
self.current_indent -= self.indent_increment
[244] Fix | Delete
assert self.current_indent >= 0, "Indent decreased below 0."
[245] Fix | Delete
self.level -= 1
[246] Fix | Delete
[247] Fix | Delete
def format_usage(self, usage):
[248] Fix | Delete
raise NotImplementedError, "subclasses must implement"
[249] Fix | Delete
[250] Fix | Delete
def format_heading(self, heading):
[251] Fix | Delete
raise NotImplementedError, "subclasses must implement"
[252] Fix | Delete
[253] Fix | Delete
def _format_text(self, text):
[254] Fix | Delete
"""
[255] Fix | Delete
Format a paragraph of free-form text for inclusion in the
[256] Fix | Delete
help output at the current indentation level.
[257] Fix | Delete
"""
[258] Fix | Delete
text_width = max(self.width - self.current_indent, 11)
[259] Fix | Delete
indent = " "*self.current_indent
[260] Fix | Delete
return textwrap.fill(text,
[261] Fix | Delete
text_width,
[262] Fix | Delete
initial_indent=indent,
[263] Fix | Delete
subsequent_indent=indent)
[264] Fix | Delete
[265] Fix | Delete
def format_description(self, description):
[266] Fix | Delete
if description:
[267] Fix | Delete
return self._format_text(description) + "\n"
[268] Fix | Delete
else:
[269] Fix | Delete
return ""
[270] Fix | Delete
[271] Fix | Delete
def format_epilog(self, epilog):
[272] Fix | Delete
if epilog:
[273] Fix | Delete
return "\n" + self._format_text(epilog) + "\n"
[274] Fix | Delete
else:
[275] Fix | Delete
return ""
[276] Fix | Delete
[277] Fix | Delete
[278] Fix | Delete
def expand_default(self, option):
[279] Fix | Delete
if self.parser is None or not self.default_tag:
[280] Fix | Delete
return option.help
[281] Fix | Delete
[282] Fix | Delete
default_value = self.parser.defaults.get(option.dest)
[283] Fix | Delete
if default_value is NO_DEFAULT or default_value is None:
[284] Fix | Delete
default_value = self.NO_DEFAULT_VALUE
[285] Fix | Delete
[286] Fix | Delete
return option.help.replace(self.default_tag, str(default_value))
[287] Fix | Delete
[288] Fix | Delete
def format_option(self, option):
[289] Fix | Delete
# The help for each option consists of two parts:
[290] Fix | Delete
# * the opt strings and metavars
[291] Fix | Delete
# eg. ("-x", or "-fFILENAME, --file=FILENAME")
[292] Fix | Delete
# * the user-supplied help string
[293] Fix | Delete
# eg. ("turn on expert mode", "read data from FILENAME")
[294] Fix | Delete
#
[295] Fix | Delete
# If possible, we write both of these on the same line:
[296] Fix | Delete
# -x turn on expert mode
[297] Fix | Delete
#
[298] Fix | Delete
# But if the opt string list is too long, we put the help
[299] Fix | Delete
# string on a second line, indented to the same column it would
[300] Fix | Delete
# start in if it fit on the first line.
[301] Fix | Delete
# -fFILENAME, --file=FILENAME
[302] Fix | Delete
# read data from FILENAME
[303] Fix | Delete
result = []
[304] Fix | Delete
opts = self.option_strings[option]
[305] Fix | Delete
opt_width = self.help_position - self.current_indent - 2
[306] Fix | Delete
if len(opts) > opt_width:
[307] Fix | Delete
opts = "%*s%s\n" % (self.current_indent, "", opts)
[308] Fix | Delete
indent_first = self.help_position
[309] Fix | Delete
else: # start help on same line as opts
[310] Fix | Delete
opts = "%*s%-*s " % (self.current_indent, "", opt_width, opts)
[311] Fix | Delete
indent_first = 0
[312] Fix | Delete
result.append(opts)
[313] Fix | Delete
if option.help:
[314] Fix | Delete
help_text = self.expand_default(option)
[315] Fix | Delete
help_lines = textwrap.wrap(help_text, self.help_width)
[316] Fix | Delete
result.append("%*s%s\n" % (indent_first, "", help_lines[0]))
[317] Fix | Delete
result.extend(["%*s%s\n" % (self.help_position, "", line)
[318] Fix | Delete
for line in help_lines[1:]])
[319] Fix | Delete
elif opts[-1] != "\n":
[320] Fix | Delete
result.append("\n")
[321] Fix | Delete
return "".join(result)
[322] Fix | Delete
[323] Fix | Delete
def store_option_strings(self, parser):
[324] Fix | Delete
self.indent()
[325] Fix | Delete
max_len = 0
[326] Fix | Delete
for opt in parser.option_list:
[327] Fix | Delete
strings = self.format_option_strings(opt)
[328] Fix | Delete
self.option_strings[opt] = strings
[329] Fix | Delete
max_len = max(max_len, len(strings) + self.current_indent)
[330] Fix | Delete
self.indent()
[331] Fix | Delete
for group in parser.option_groups:
[332] Fix | Delete
for opt in group.option_list:
[333] Fix | Delete
strings = self.format_option_strings(opt)
[334] Fix | Delete
self.option_strings[opt] = strings
[335] Fix | Delete
max_len = max(max_len, len(strings) + self.current_indent)
[336] Fix | Delete
self.dedent()
[337] Fix | Delete
self.dedent()
[338] Fix | Delete
self.help_position = min(max_len + 2, self.max_help_position)
[339] Fix | Delete
self.help_width = max(self.width - self.help_position, 11)
[340] Fix | Delete
[341] Fix | Delete
def format_option_strings(self, option):
[342] Fix | Delete
"""Return a comma-separated list of option strings & metavariables."""
[343] Fix | Delete
if option.takes_value():
[344] Fix | Delete
metavar = option.metavar or option.dest.upper()
[345] Fix | Delete
short_opts = [self._short_opt_fmt % (sopt, metavar)
[346] Fix | Delete
for sopt in option._short_opts]
[347] Fix | Delete
long_opts = [self._long_opt_fmt % (lopt, metavar)
[348] Fix | Delete
for lopt in option._long_opts]
[349] Fix | Delete
else:
[350] Fix | Delete
short_opts = option._short_opts
[351] Fix | Delete
long_opts = option._long_opts
[352] Fix | Delete
[353] Fix | Delete
if self.short_first:
[354] Fix | Delete
opts = short_opts + long_opts
[355] Fix | Delete
else:
[356] Fix | Delete
opts = long_opts + short_opts
[357] Fix | Delete
[358] Fix | Delete
return ", ".join(opts)
[359] Fix | Delete
[360] Fix | Delete
class IndentedHelpFormatter (HelpFormatter):
[361] Fix | Delete
"""Format help with indented section bodies.
[362] Fix | Delete
"""
[363] Fix | Delete
[364] Fix | Delete
def __init__(self,
[365] Fix | Delete
indent_increment=2,
[366] Fix | Delete
max_help_position=24,
[367] Fix | Delete
width=None,
[368] Fix | Delete
short_first=1):
[369] Fix | Delete
HelpFormatter.__init__(
[370] Fix | Delete
self, indent_increment, max_help_position, width, short_first)
[371] Fix | Delete
[372] Fix | Delete
def format_usage(self, usage):
[373] Fix | Delete
return _("Usage: %s\n") % usage
[374] Fix | Delete
[375] Fix | Delete
def format_heading(self, heading):
[376] Fix | Delete
return "%*s%s:\n" % (self.current_indent, "", heading)
[377] Fix | Delete
[378] Fix | Delete
[379] Fix | Delete
class TitledHelpFormatter (HelpFormatter):
[380] Fix | Delete
"""Format help with underlined section headers.
[381] Fix | Delete
"""
[382] Fix | Delete
[383] Fix | Delete
def __init__(self,
[384] Fix | Delete
indent_increment=0,
[385] Fix | Delete
max_help_position=24,
[386] Fix | Delete
width=None,
[387] Fix | Delete
short_first=0):
[388] Fix | Delete
HelpFormatter.__init__ (
[389] Fix | Delete
self, indent_increment, max_help_position, width, short_first)
[390] Fix | Delete
[391] Fix | Delete
def format_usage(self, usage):
[392] Fix | Delete
return "%s %s\n" % (self.format_heading(_("Usage")), usage)
[393] Fix | Delete
[394] Fix | Delete
def format_heading(self, heading):
[395] Fix | Delete
return "%s\n%s\n" % (heading, "=-"[self.level] * len(heading))
[396] Fix | Delete
[397] Fix | Delete
[398] Fix | Delete
def _parse_num(val, type):
[399] Fix | Delete
if val[:2].lower() == "0x": # hexadecimal
[400] Fix | Delete
radix = 16
[401] Fix | Delete
elif val[:2].lower() == "0b": # binary
[402] Fix | Delete
radix = 2
[403] Fix | Delete
val = val[2:] or "0" # have to remove "0b" prefix
[404] Fix | Delete
elif val[:1] == "0": # octal
[405] Fix | Delete
radix = 8
[406] Fix | Delete
else: # decimal
[407] Fix | Delete
radix = 10
[408] Fix | Delete
[409] Fix | Delete
return type(val, radix)
[410] Fix | Delete
[411] Fix | Delete
def _parse_int(val):
[412] Fix | Delete
return _parse_num(val, int)
[413] Fix | Delete
[414] Fix | Delete
def _parse_long(val):
[415] Fix | Delete
return _parse_num(val, long)
[416] Fix | Delete
[417] Fix | Delete
_builtin_cvt = { "int" : (_parse_int, _("integer")),
[418] Fix | Delete
"long" : (_parse_long, _("long integer")),
[419] Fix | Delete
"float" : (float, _("floating-point")),
[420] Fix | Delete
"complex" : (complex, _("complex")) }
[421] Fix | Delete
[422] Fix | Delete
def check_builtin(option, opt, value):
[423] Fix | Delete
(cvt, what) = _builtin_cvt[option.type]
[424] Fix | Delete
try:
[425] Fix | Delete
return cvt(value)
[426] Fix | Delete
except ValueError:
[427] Fix | Delete
raise OptionValueError(
[428] Fix | Delete
_("option %s: invalid %s value: %r") % (opt, what, value))
[429] Fix | Delete
[430] Fix | Delete
def check_choice(option, opt, value):
[431] Fix | Delete
if value in option.choices:
[432] Fix | Delete
return value
[433] Fix | Delete
else:
[434] Fix | Delete
choices = ", ".join(map(repr, option.choices))
[435] Fix | Delete
raise OptionValueError(
[436] Fix | Delete
_("option %s: invalid choice: %r (choose from %s)")
[437] Fix | Delete
% (opt, value, choices))
[438] Fix | Delete
[439] Fix | Delete
# Not supplying a default is different from a default of None,
[440] Fix | Delete
# so we need an explicit "not supplied" value.
[441] Fix | Delete
NO_DEFAULT = ("NO", "DEFAULT")
[442] Fix | Delete
[443] Fix | Delete
[444] Fix | Delete
class Option:
[445] Fix | Delete
"""
[446] Fix | Delete
Instance attributes:
[447] Fix | Delete
_short_opts : [string]
[448] Fix | Delete
_long_opts : [string]
[449] Fix | Delete
[450] Fix | Delete
action : string
[451] Fix | Delete
type : string
[452] Fix | Delete
dest : string
[453] Fix | Delete
default : any
[454] Fix | Delete
nargs : int
[455] Fix | Delete
const : any
[456] Fix | Delete
choices : [string]
[457] Fix | Delete
callback : function
[458] Fix | Delete
callback_args : (any*)
[459] Fix | Delete
callback_kwargs : { string : any }
[460] Fix | Delete
help : string
[461] Fix | Delete
metavar : string
[462] Fix | Delete
"""
[463] Fix | Delete
[464] Fix | Delete
# The list of instance attributes that may be set through
[465] Fix | Delete
# keyword args to the constructor.
[466] Fix | Delete
ATTRS = ['action',
[467] Fix | Delete
'type',
[468] Fix | Delete
'dest',
[469] Fix | Delete
'default',
[470] Fix | Delete
'nargs',
[471] Fix | Delete
'const',
[472] Fix | Delete
'choices',
[473] Fix | Delete
'callback',
[474] Fix | Delete
'callback_args',
[475] Fix | Delete
'callback_kwargs',
[476] Fix | Delete
'help',
[477] Fix | Delete
'metavar']
[478] Fix | Delete
[479] Fix | Delete
# The set of actions allowed by option parsers. Explicitly listed
[480] Fix | Delete
# here so the constructor can validate its arguments.
[481] Fix | Delete
ACTIONS = ("store",
[482] Fix | Delete
"store_const",
[483] Fix | Delete
"store_true",
[484] Fix | Delete
"store_false",
[485] Fix | Delete
"append",
[486] Fix | Delete
"append_const",
[487] Fix | Delete
"count",
[488] Fix | Delete
"callback",
[489] Fix | Delete
"help",
[490] Fix | Delete
"version")
[491] Fix | Delete
[492] Fix | Delete
# The set of actions that involve storing a value somewhere;
[493] Fix | Delete
# also listed just for constructor argument validation. (If
[494] Fix | Delete
# the action is one of these, there must be a destination.)
[495] Fix | Delete
STORE_ACTIONS = ("store",
[496] Fix | Delete
"store_const",
[497] Fix | Delete
"store_true",
[498] Fix | Delete
"store_false",
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function