MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / OptionParser

Class OptionParser

tools/python-3.11.9-amd64/Lib/optparse.py:1106–1647  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

1104
1105
1106class OptionParser (OptionContainer):
1107
1108 """
1109 Class attributes:
1110 standard_option_list : [Option]
1111 list of standard options that will be accepted by all instances
1112 of this parser class (intended to be overridden by subclasses).
1113
1114 Instance attributes:
1115 usage : string
1116 a usage string for your program. Before it is displayed
1117 to the user, "%prog" will be expanded to the name of
1118 your program (self.prog or os.path.basename(sys.argv[0])).
1119 prog : string
1120 the name of the current program (to override
1121 os.path.basename(sys.argv[0])).
1122 description : string
1123 A paragraph of text giving a brief overview of your program.
1124 optparse reformats this paragraph to fit the current terminal
1125 width and prints it when the user requests help (after usage,
1126 but before the list of options).
1127 epilog : string
1128 paragraph of help text to print after option help
1129
1130 option_groups : [OptionGroup]
1131 list of option groups in this parser (option groups are
1132 irrelevant for parsing the command-line, but very useful
1133 for generating help)
1134
1135 allow_interspersed_args : bool = true
1136 if true, positional arguments may be interspersed with options.
1137 Assuming -a and -b each take a single argument, the command-line
1138 -ablah foo bar -bboo baz
1139 will be interpreted the same as
1140 -ablah -bboo -- foo bar baz
1141 If this flag were false, that command line would be interpreted as
1142 -ablah -- foo bar -bboo baz
1143 -- ie. we stop processing options as soon as we see the first
1144 non-option argument. (This is the tradition followed by
1145 Python's getopt module, Perl's Getopt::Std, and other argument-
1146 parsing libraries, but it is generally annoying to users.)
1147
1148 process_default_values : bool = true
1149 if true, option default values are processed similarly to option
1150 values from the command line: that is, they are passed to the
1151 type-checking function for the option's type (as long as the
1152 default value is a string). (This really only matters if you
1153 have defined custom types; see SF bug #955889.) Set it to false
1154 to restore the behaviour of Optik 1.4.1 and earlier.
1155
1156 rargs : [string]
1157 the argument list currently being parsed. Only set when
1158 parse_args() is active, and continually trimmed down as
1159 we consume arguments. Mainly there for the benefit of
1160 callback options.
1161 largs : [string]
1162 the list of leftover arguments that we have skipped while
1163 parsing options. If allow_interspersed_args is false, this

Callers 2

mainFunction · 0.90
mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected