Add options to nosetests.
321669
def options(self, parser, env=os.environ):
        ""
        parser.add_option("--%s-record" % self.name,
                          action="store",
                          metavar="FILE",
                          dest="record_filename",
                          help="Record actions to this file.")
        parser.add_option("--%s-playback" % self.name,
                          action="store",
                          metavar="FILE",
                          dest="playback_filename",
                          help="Playback actions from this file.")
464922
def options(self, parser, env=os.environ):
        
        # pylint:disable=dangerous-default-value
        super(FlakyPlugin, self).options(parser, env=env)
        self.add_report_option(parser.add_option)
        group = OptionGroup(
            parser, "Force flaky", "Force all tests to be flaky.")
        self.add_force_flaky_options(group.add_option)
        parser.add_option_group(group)
554947
def nose_selector(test):
    
    address = test_address(test)
    if address:
        file, module, rest = address

        if module:
            if rest:
                try:
                    return '%s:%s%s' % (module, rest, test.test.arg or '')
                except AttributeError:
                    return '%s:%s' % (module, rest)
            else:
                return module
    return 'Unknown test'
788788
def _filter_options(self, aliases=True, comments=True, historical=True):
        """"""
        options = []
        if not aliases:
            options.append('noaliases')
        if not comments:
            options.append('nocomments')
        if not historical:
            options.append('nohistorical')
        return options
1035873
function (newOptions) {
        OpenLayers.Util.extend(this.options, newOptions);
        OpenLayers.Util.extend(this, newOptions);
    }
665999
def addOption(self, stim):
        
        # set the editor widgets for noise and sweep
        self.ui.calTypeCmbbx.insertItem(0,stim.name)
        editor = stim.showEditor()
        # should probably make this less coupled
        durInput = editor.durationInputWidget()
        self.durationWidgets.append(durInput)
        durInput.setEnabled(False)
        self.ui.caleditorStack.insertWidget(0, editor)
        self.ui.calTypeCmbbx.setCurrentIndex(0)
1327323
def add_option(self, *args, **kwargs):
        """"""
        if self.parseTool == 'argparse':
            if args and args[0] == '':   # no short option
                args = args[1:]
            return self.parser.add_argument(*args, **kwargs)
        else:
            return self.parser.add_option(*args, **kwargs)
1138703
def add_command_line_options_optparse(cls, optparser):
        """"""

        def set_parameter(option, opt, value, parser):
            """callback function for OptionParser"""
            cls.config[opt] = value
            if opt == "--stomp-conf":
                cls.load_configuration_file(value)

        optparser.add_option(
            "--stomp-host",
            metavar="HOST",
            default=cls.defaults.get("--stomp-host"),
            help="Stomp broker address, default '%default'",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-port",
            metavar="PORT",
            default=cls.defaults.get("--stomp-port"),
            help="Stomp broker port, default '%default'",
            type="int",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-user",
            metavar="USER",
            default=cls.defaults.get("--stomp-user"),
            help="Stomp user, default '%default'",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-pass",
            metavar="PASS",
            default=cls.defaults.get("--stomp-pass"),
            help="Stomp password",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-prfx",
            metavar="PRE",
            default=cls.defaults.get("--stomp-prfx"),
            help="Stomp namespace prefix, default '%default'",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
        optparser.add_option(
            "--stomp-conf",
            metavar="CNF",
            default=cls.defaults.get("--stomp-conf"),
            help="Stomp configuration file containing connection information, disables default values",
            type="string",
            nargs=1,
            action="callback",
            callback=set_parameter,
        )
1261883
def additional_options(self, is_pylab=False, is_sympy=False):
        
        options = dict(
            pylab=self.get_option('pylab'),
            autoload_pylab=self.get_option('pylab/autoload'),
            sympy=self.get_option('symbolic_math'),
            show_banner=self.get_option('show_banner')
        )

        if is_pylab is True:
            options['autoload_pylab'] = True
            options['sympy'] = False
        if is_sympy is True:
            options['autoload_pylab'] = False
            options['sympy'] = True

        return options
846135
def add_options(self):
        
        super(RtorrentControl, self).add_options()

        # basic options
        self.add_bool_option("--help-fields",
            help="show available fields and their description")
        self.add_bool_option("-n", "--dry-run",
            help="don't commit changes, just tell what would happen")
        self.add_bool_option("--detach",
            help="run the process in the background")
        self.prompt.add_options()

        # output control
        self.add_bool_option("-S", "--shell",
            help="escape output following shell rules")
        self.add_bool_option("-0", "--nul", "--print0",
            help="use a NUL character instead of a linebreak after items")
        self.add_bool_option("-c", "--column-headers",
            help="print column headers")
        self.add_bool_option("-+", "--stats",
            help="add sum / avg / median of numerical fields")
        self.add_bool_option("--summary",
            help="print only statistical summary, without the items")
        #self.add_bool_option("-f", "--full",
        #    help="print full torrent details")
        self.add_bool_option("--json",
            help="dump all items as JSON (use '-o f1,f2,...' to specify fields)")
        self.add_value_option("-o", "--output-format", "FORMAT",
            help="specify display format (use '-o-' to disable item display)")
        self.add_value_option("-O", "--output-template", "FILE",
            help="pass control of output formatting to the specified template")
        self.add_value_option("-s", "--sort-fields", "[-]FIELD[,...] [-s...]",
            action='append', default=[],
            help="fields used for sorting, descending if prefixed with a '-'; '-s*' uses output field list")
        self.add_bool_option("-r", "--reverse-sort",
            help="reverse the sort order")
        self.add_value_option("-A", "--anneal", "MODE [-A...]",
            type='choice', action='append', default=[],
            choices=('dupes+', 'dupes-', 'dupes=', 'invert', 'unique'),
            help="modify result set using some pre-defined methods")
        self.add_value_option("-/", "--select", "[N-]M",
            help="select result subset by item position (counting from 1)")
        self.add_bool_option("-V", "--view-only",
            help="show search result only in default ncurses view")
        self.add_value_option("--to-view", "--to", "NAME",
            help="show search result only in named ncurses view")
        self.add_bool_option("--append-view", "--append",
            help="DEPRECATED: use '--alter append' instead")
        self.add_value_option("--alter-view", "--alter", "MODE",
            type='choice', default=None, choices=self.ALTER_MODES,
            help="alter view according to mode: {} (modifies -V and --to behaviour)"
                 .format(', '.join(self.ALTER_MODES)))
        self.add_bool_option("--tee-view", "--tee",
            help="ADDITIONALLY show search results in ncurses view (modifies -V and --to behaviour)")
        self.add_value_option("--from-view", "--from", "NAME",
            help="select only items that are on view NAME (NAME can be an info hash to quickly select a single item)")
        self.add_value_option("-M", "--modify-view", "NAME",
            help="get items from given view and write result back to it (short-cut to combine --from-view and --to-view)")
        self.add_value_option("-Q", "--fast-query", "LEVEL",
            type='choice', default='=', choices=('=', '0', '1', '2'),
            help="enable query optimization (=: use config; 0: off; 1: safe; 2: danger seeker)")
        self.add_value_option("--call", "CMD",
            help="call an OS command pattern in the shell")
        self.add_value_option("--spawn", "CMD [--spawn ...]",
            action="append", default=[],
            help="execute OS command pattern(s) directly")
# TODO: implement -S
#        self.add_bool_option("-S", "--summary",
#            help="print statistics")

        # torrent state change (actions)
        for action in self.ACTION_MODES:
            action.setdefault("label", action.name.upper())
            action.setdefault("method", action.name)
            action.setdefault("interactive", False)
            action.setdefault("argshelp", "")
            action.setdefault("args", ())
            if action.argshelp:
                self.add_value_option(*action.options + (action.argshelp,),
                    **{"help": action.help + (" (implies -i)" if action.interactive else "")})
            else:
                self.add_bool_option(*action.options,
                    **{"help": action.help + (" (implies -i)" if action.interactive else "")})
        self.add_value_option("--ignore", "|".join(self.IGNORE_OPTIONS),
            type="choice", choices=self.IGNORE_OPTIONS,
            help="set 'ignore commands' status on torrent")
        self.add_value_option("--prio", "|".join(self.PRIO_OPTIONS),
            type="choice", choices=self.PRIO_OPTIONS,
            help="set priority of torrent")
        self.add_bool_option("-F", "--flush", help="flush changes immediately (save session data)")
919277
def add_options(cls, manager):
        """"""
        kw = {}
        if flake8.__version__ >= '3.0.0':
            kw['parse_from_config'] = True
        manager.add_option(
            "--known-modules",
            action='store',
            default="",
            help=(
                "User defined mapping between a project name and a list of"
                " provided modules. For example: ``--known-modules=project:"
                "[Project],extra-project:[extras,utilities]``."
            ),
            **kw
        )
1115555
def add_arguments(self, parser):
        """"""
        # Add the underlying test command arguments first
        test_command = TestCommand()
        test_command.add_arguments(parser)

        for option in OPTIONS:
            parser.add_argument(*option[0], **option[1])
1078348
def do_OPTIONS(self):
        """"""
        thread_local.clock_start = get_time()
        thread_local.status_code = 200
        thread_local.message = None
        thread_local.headers = []
        thread_local.end_headers = []
        thread_local.size = -1
        thread_local.method = 'OPTIONS'
        self.send_response(200)
        if self.is_cross_origin():
            no_caching = self.cross_origin_headers()
            # ten minutes if no custom headers requested
            self.send_header("Access-Control-Max-Age",
                             0 if no_caching else 10*60)
        self.send_header("Content-Length", 0)
        self.end_headers()
        thread_local.size = 0
1022785
def options(self, parser, env=os.environ):
        """"""
        super(TimerPlugin, self).options(parser, env)

        # timer top n
        parser.add_option(
            "--timer-top-n",
            action="store",
            default="-1",
            dest="timer_top_n",
            help=(
                "When the timer plugin is enabled, only show the N tests that "
                "consume more time. The default, -1, shows all tests."
            ),
        )

        parser.add_option(
            "--timer-json-file",
            action="store",
            default=None,
            dest="json_file",
            help=(
                "Save the results of the timing and status of each tests in "
                "said Json file."
            ),
        )

        _time_units_help = ("Default time unit is a second, but you can set "
                            "it explicitly (e.g. 1s, 500ms)")

        # timer ok
        parser.add_option(
            "--timer-ok",
            action="store",
            default=1,
            dest="timer_ok",
            help=(
                "Normal execution time. Such tests will be highlighted in "
                "green. {units_help}.".format(units_help=_time_units_help)
            ),
        )

        # time warning
        parser.add_option(
            "--timer-warning",
            action="store",
            default=3,
            dest="timer_warning",
            help=(
                "Warning about execution time to highlight slow tests in "
                "yellow. Tests which take more time will be highlighted in "
                "red. {units_help}.".format(units_help=_time_units_help)
            ),
        )

        # Windows + nosetests does not support colors (even with colorama).
        if not IS_NT:
            parser.add_option(
                "--timer-no-color",
                action="store_true",
                default=False,
                dest="timer_no_color",
                help="Don't colorize output (useful for non-tty output).",
            )

        # timer filter
        parser.add_option(
            "--timer-filter",
            action="store",
            default=None,
            dest="timer_filter",
            help="Show filtered results only (ok,warning,error).",
        )

        # timer fail
        parser.add_option(
            "--timer-fail",
            action="store",
            default=None,
            dest="timer_fail",
            choices=('warning', 'error'),
            help="Fail tests that exceed a threshold (warning,error)",
        )
631784
def add_opt(self, opt, value=None):
        
        if value is None:
            self.common_options += [opt]
        else:
            self.common_options += [opt, value]
809511
def add_options(self):
        
        # These options need to be conflict-free to the containing
        # script, i.e. avoid short options if possible.
        self.script.add_bool_option("-i", "--interactive",
            help="interactive mode (prompt before changing things)")
        self.script.add_bool_option("--yes",
            help="positively answer all prompts (e.g. --delete --yes)")
303331
private void addOption(CliOptionContainer optionContainer) {

    CliOption cliOption = optionContainer.getOption();
    addOption(cliOption.name(), optionContainer);
    for (String alias : cliOption.aliases()) {
      addOption(alias, optionContainer);
    }
    this.optionList.add(optionContainer);
    String modeId = optionContainer.getOption().mode();
    requireMode(modeId, optionContainer);
  }