@classmethod
    def add_arguments(cls, parser):
        super(BaseRunner, cls).add_arguments(parser)

        # Read optparse options for nose and plugins
        cfg_files = nose.core.all_config_files()
        manager = nose.core.DefaultPluginManager()
        config = nose.core.Config(
            env=os.environ, files=cfg_files, plugins=manager)
        config.plugins.addPlugins(list(_get_plugins_from_settings()))
        options = config.getParser()._get_all_options()

        # Gather existing option strings`
        django_options = set()
        for action in parser._actions:
            for override in cls._argparse_remove_options:
                if override in action.option_strings:
                    # Emulate parser.conflict_handler='resolve'
                    parser._handle_conflict_resolve(
                        None, ((override, action),))
            django_options.update(action.option_strings)

        # Process nose optparse options
        for option in options:
            # Skip any options also in Django options
            opt_long = option.get_opt_string()
            if opt_long in django_options:
                continue
            if option._short_opts:
                opt_short = option._short_opts[0]
                if opt_short in django_options:
                    continue
            else:
                opt_short = None

            # Rename nose's --verbosity to --nose-verbosity
            if opt_long == '--verbosity':
                opt_long = '--nose-verbosity'

            # Convert optparse attributes to argparse attributes
            option_attrs = {}
            for attr in option.ATTRS:
                # Ignore callback options
                if attr in cls._argparse_callback_options:
                    continue

                value = getattr(option, attr)

                if attr == 'default' and value == NO_DEFAULT:
                    continue

                # Rename options for nose's --verbosity
                if opt_long == '--nose-verbosity':
                    if attr == 'dest':
                        value = 'nose_verbosity'
                    elif attr == 'metavar':
                        value = 'NOSE_VERBOSITY'

                # Omit arguments that are None, use default
                if attr in cls._argparse_omit_if_none and value is None:
                    continue

                # Convert type from optparse string to argparse type
                if attr == 'type':
                    value = cls._argparse_type[value]

                # Convert action='callback' to action='store'
                if attr == 'action' and value == 'callback':
                    action = 'store'

                # Keep track of nargs=1
                if attr == 'nargs':
                    assert value == 1, (
                        'argparse option nargs=%s is not supported' %
                        value)
                    cls._has_nargs.add(opt_long)
                    if opt_short:
                        cls._has_nargs.add(opt_short)

                # Pass converted attribute to optparse option
                option_attrs[attr] = value

            # Add the optparse argument
            if opt_short:
                parser.add_argument(opt_short, opt_long, **option_attrs)
            else:
                parser.add_argument(opt_long, **option_attrs)
Get the current display mode for this screen.
dataset/ETHPy150Open django-nose/django-nose/django_nose/runner.py/BaseRunner.add_arguments--crossover with--dataset/ETHPy150Open ardekantur/pyglet/pyglet/canvas/base.py/Screen.get_mode