Python optparse.BadOptionError() Examples
The following are 17
code examples of optparse.BadOptionError().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
optparse
, or try the search function
.
Example #1
Source File: shell.py From stdm with GNU General Public License v2.0 | 6 votes |
def _process_args(self, largs, rargs, values): """little hack to support all --some_option=value parameters""" while rargs: arg = rargs[0] if arg == "--": del rargs[0] return elif arg[0:2] == "--": # if parser does not know about the option # pass it along (make it anonymous) try: opt = arg.split('=', 1)[0] self._match_long_opt(opt) except BadOptionError: largs.append(arg) del rargs[0] else: self._process_long_opt(rargs, values) elif arg[:1] == "-" and len(arg) > 1: self._process_short_opts(rargs, values) elif self.allow_interspersed_args: largs.append(arg) del rargs[0]
Example #2
Source File: conf.py From volatility with GNU General Public License v2.0 | 5 votes |
def _process_args(self, largs, rargs, values): try: return optparse.OptionParser._process_args(self, largs, rargs, values) except (optparse.BadOptionError, optparse.OptionValueError), err: if self.final: raise err
Example #3
Source File: main.py From ctypesgen with BSD 2-Clause "Simplified" License | 5 votes |
def option_callback_W(option, opt, value, parser): # Options preceded by a "-Wl," are simply treated as though the "-Wl," # is not there? I don't understand the purpose of this code... if len(value) < 4 or value[0:3] != "l,-": raise optparse.BadOptionError("not in '-Wl,<opt>' form: %s%s" % (opt, value)) opt = value[2:] if opt not in ["-L", "-R", "--rpath"]: raise optparse.BadOptionError("-Wl option must be -L, -R" " or --rpath, not " + value[2:]) # Push the linker option onto the list for further parsing. parser.rargs.insert(0, value)
Example #4
Source File: options.py From conary with Apache License 2.0 | 5 votes |
def _match_long_opt(self, opt): match = optparse._match_abbrev(opt, self._long_opt) if not self.matchPartialOptions and opt != match: raise optparse.BadOptionError("no such option: %s" % opt) return match
Example #5
Source File: conf.py From volatility with GNU General Public License v2.0 | 5 votes |
def _process_args(self, largs, rargs, values): try: return optparse.OptionParser._process_args(self, largs, rargs, values) except (optparse.BadOptionError, optparse.OptionValueError), err: if self.final: raise err
Example #6
Source File: conf.py From DAMM with GNU General Public License v2.0 | 5 votes |
def _process_args(self, largs, rargs, values): try: return optparse.OptionParser._process_args(self, largs, rargs, values) except (optparse.BadOptionError, optparse.OptionValueError), err: if self.final: raise err
Example #7
Source File: conf.py From vortessence with GNU General Public License v2.0 | 5 votes |
def _process_args(self, largs, rargs, values): try: return optparse.OptionParser._process_args(self, largs, rargs, values) except (optparse.BadOptionError, optparse.OptionValueError), err: if self.final: raise err
Example #8
Source File: parser.py From mamonsu with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _process_short_opts(self, rargs, values): try: OptionParser._process_short_opts(self, rargs, values) except BadOptionError as err: self.largs.append(err.opt_str)
Example #9
Source File: parser.py From mamonsu with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _process_long_opt(self, rargs, values): try: OptionParser._process_long_opt(self, rargs, values) except BadOptionError as err: self.largs.append(err.opt_str)
Example #10
Source File: update_assets.py From data-import with Apache License 2.0 | 5 votes |
def _process_args(self, largs, rargs, values): while rargs: try: OptionParser._process_args(self,largs,rargs,values) except (BadOptionError,AmbiguousOptionError) as e: largs.append(e.opt_str)
Example #11
Source File: conf.py From aumfor with GNU General Public License v3.0 | 5 votes |
def _process_args(self, largs, rargs, values): try: return optparse.OptionParser._process_args(self, largs, rargs, values) except (optparse.BadOptionError, optparse.OptionValueError), err: if self.final: raise err
Example #12
Source File: config.py From python-netsurv with MIT License | 5 votes |
def _match_long_opt(self, opt): """Disable abbreviations.""" if opt not in self._long_opt: raise optparse.BadOptionError(opt) return opt # pylint: disable=abstract-method; by design?
Example #13
Source File: config.py From python-netsurv with MIT License | 5 votes |
def _match_long_opt(self, opt): """Disable abbreviations.""" if opt not in self._long_opt: raise optparse.BadOptionError(opt) return opt # pylint: disable=abstract-method; by design?
Example #14
Source File: config.py From linter-pylama with MIT License | 5 votes |
def _match_long_opt(self, opt): """Disable abbreviations.""" if opt not in self._long_opt: raise optparse.BadOptionError(opt) return opt # pylint: disable=abstract-method; by design?
Example #15
Source File: update_assets.py From data-import with Apache License 2.0 | 5 votes |
def _process_args(self, largs, rargs, values): while rargs: try: OptionParser._process_args(self,largs,rargs,values) except (BadOptionError,AmbiguousOptionError) as e: largs.append(e.opt_str)
Example #16
Source File: stix_import.py From data-import with Apache License 2.0 | 5 votes |
def _process_args(self, largs, rargs, values): while rargs: try: OptionParser._process_args(self,largs,rargs,values) except (BadOptionError,AmbiguousOptionError) as e: largs.append(e.opt_str)
Example #17
Source File: aql-to-reference-data.py From data-import with Apache License 2.0 | 5 votes |
def _process_args(self, largs, rargs, values): while rargs: try: OptionParser._process_args(self,largs,rargs,values) except (BadOptionError,AmbiguousOptionError) as e: largs.append(e.opt_str)