def main():
    parser = argparse.ArgumentParser(description='Choose subcommand to run.')
    subparsers = parser.add_subparsers(title='subcommands')

    from pkg_resources import iter_entry_points

    loaded = {}
    for ep in iter_entry_points(group=ENTRY_POINT):
        if loaded in ep.name:
            continue
        loaded[ep.name] = True
        command = ep.load()
        if (not in_armstrong_project() and
                getattr(command, "requires_armstrong", False)):
            continue
        armstrong_parser = subparsers.add_parser(ep.name,
                description=command.__doc__,
                help=command.__doc__)
        if hasattr(command, 'build_parser'):
            command.build_parser(armstrong_parser)
        armstrong_parser.set_defaults(func=command)

    if in_armstrong_project():
        # Make sure the current working dir is always in the path as the first
        # element.  Initial tests on a Homebrew Python installation result in
        # this not being the case.
        if CWD not in sys.path:
            sys.path.insert(0, CWD)

        try:
            settings_module = get_current_configuration()
            __import__(settings_module, globals(), locals())
            from django.core.management import setup_environ
            setup_environ(sys.modules[settings_module])
        except ImportError, e:
            sys.stderr.write("Unable to import %s: %s\n" %
                             (settings_module, e))
            sys.exit(1)
        from django.core.management import get_commands
        django_commands = get_commands().keys()
        django_commands.sort()
        for command in django_commands:
            dj_parser = subparsers.add_parser(command, help='')
            dj_parser.add_argument("--production", action='store_true',
                help='use %s.production setting' % CONFIGURATION_MODULE)
            dj_parser.set_defaults(func=call_django)

    args, argv = parser.parse_known_args()
    kwargs = vars(args)
    func = kwargs.pop('func', None)
    if argv:
        func(argv=argv, **kwargs)
    else:
        func(**kwargs)
dataset/ETHPy150Open armstrong/armstrong.cli/armstrong/cli/main.py/main/swapped operands of `in`