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