# Buggy code
def _main():
    log.debug("conda.cli.main called with %s", sys.argv)
    if len(sys.argv) > 1:
        argv1 = sys.argv[1]
        if argv1 in ("..activate", "..deactivate", "..checkenv", "..changeps1"):
            import conda.cli.activate as activate

            activate.main()
            return
        if argv1 in ("activate", "deactivate"):
            message = "'%s' is not a conda command.\n" % argv1
            if not on_win:
                message += ' Did you mean "source %s" ?\n' % " ".join(sys.argv[1:])

            raise CommandNotFoundError(argv1, message)

    if len(sys.argv) == 1:
        sys.argv.append("-h")

    p, sub_parsers = generate_parser()

    main_modules = [
        "info",
        "help",
        "list",
        "search",
        "create",
        "install",
        "update",
        "remove",
        "config",
        "clean",
        "package",
    ]
    modules = ["conda.cli.main_" + suffix for suffix in main_modules]
    for module in modules:
        imported = importlib.import_module(module)
        imported.configure_parser(sub_parsers)
        if "update" in module:
            imported.configure_parser(sub_parsers, name="upgrade")
        if "remove" in module:
            imported.configure_parser(sub_parsers, name="uninstall")

    from conda.cli.find_commands import find_commands

    def completer(prefix, **kwargs):
        return [
            i
            for i in list(sub_parsers.choices) + find_commands()
            if i.startswith(prefix)
        ]

    sub_parsers.completer = completer
    args = p.parse_args()

    context._add_argparse_args(args)

    if getattr(args, "json", False):
        # # Silence logging info to avoid interfering with JSON output
        # for logger in Logger.manager.loggerDict:
        #     if logger not in ('fetch', 'progress'):
        #         getLogger(logger).setLevel(CRITICAL + 1)
        for logger in ("print", "dotupdate", "stdoutlog", "stderrlog"):
            getLogger(logger).setLevel(CRITICAL + 1)

    if context.debug:
        set_all_logger_level(DEBUG)
    elif context.verbosity:
        set_verbosity(context.verbosity)
        log.debug("verbosity set to %s", context.verbosity)

    exit_code = args.func(args, p)
    if isinstance(exit_code, int):
        return exit_code


# Traceback (ruamel_yaml.scanner.ScannerError)
Traceback (most recent call last):
File "/opt/anaconda/bin/conda", line 4, in <module>
import conda.cli
File "/opt/anaconda/lib/python2.7/site-packages/conda/cli/__init__.py", line 8, in <module>
from .main import main  # NOQA
File "/opt/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 46, in <module>
from ..base.context import context
File "/opt/anaconda/lib/python2.7/site-packages/conda/base/context.py", line 252, in <module>
context = Context(SEARCH_PATH, conda, None)
File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 692, in __init__
self._add_search_path(search_path)
File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 699, in _add_search_path
return self._add_raw_data(load_file_configs(search_path))
File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 371, in load_file_configs
raw_data = odict(kv for kv in chain.from_iterable(load_paths))
File "/opt/anaconda/lib/python2.7/collections.py", line 69, in __init__
self.__update(*args, **kwds)
File "/opt/anaconda/lib/python2.7/_abcoll.py", line 571, in update
for key, value in other:
File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 371, in <genexpr>
raw_data = odict(kv for kv in chain.from_iterable(load_paths))
File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 347, in _file_yaml_loader
yield fullpath, YamlRawParameter.make_raw_parameters_from_file(fullpath)
File "/opt/anaconda/lib/python2.7/site-packages/conda/common/configuration.py", line 338, in make_raw_parameters_from_file
ruamel_yaml = yaml_load(fh)
File "/opt/anaconda/lib/python2.7/site-packages/conda/common/yaml.py", line 26, in yaml_load
return yaml.load(string, Loader=yaml.RoundTripLoader, version="1.2")
File "/opt/anaconda/lib/python2.7/site-packages/ruamel_yaml/main.py", line 75, in load
return loader.get_single_data()
File "/opt/anaconda/lib/python2.7/site-packages/ruamel_yaml/constructor.py", line 60, in get_single_data
node = self.get_single_node()
File "/opt/anaconda/lib/python2.7/site-packages/ruamel_yaml/composer.py", line 48, in get_single_node
self.get_event()
File "/opt/anaconda/lib/python2.7/site-packages/ruamel_yaml/parser.py", line 136, in get_event
self.current_event = self.state()
File "/opt/anaconda/lib/python2.7/site-packages/ruamel_yaml/parser.py", line 150, in parse_stream_start
token.move_comment(self.peek_token())
File "/opt/anaconda/lib/python2.7/site-packages/ruamel_yaml/scanner.py", line 1543, in peek_token
self._gather_comments()
File "/opt/anaconda/lib/python2.7/site-packages/ruamel_yaml/scanner.py", line 1573, in _gather_comments
self.fetch_more_tokens()
File "/opt/anaconda/lib/python2.7/site-packages/ruamel_yaml/scanner.py", line 239, in fetch_more_tokens
return self.fetch_value()
File "/opt/anaconda/lib/python2.7/site-packages/ruamel_yaml/scanner.py", line 598, in fetch_value
self.get_mark())
ruamel_yaml.scanner.ScannerError: mapping values are not allowed here
in "/opt/anaconda/.condarc", line 4, column 8

# Fixed code
def _main():
    from ..base.context import context
    from ..gateways.logging import set_all_logger_level, set_verbosity
    from ..exceptions import CommandNotFoundError
    from ..utils import on_win

    log.debug("conda.cli.main called with %s", sys.argv)
    if len(sys.argv) > 1:
        argv1 = sys.argv[1]
        if argv1 in ("..activate", "..deactivate", "..checkenv", "..changeps1"):
            import conda.cli.activate as activate

            activate.main()
            return
        if argv1 in ("activate", "deactivate"):
            message = "'%s' is not a conda command.\n" % argv1
            if not on_win:
                message += ' Did you mean "source %s" ?\n' % " ".join(sys.argv[1:])

            raise CommandNotFoundError(argv1, message)

    if len(sys.argv) == 1:
        sys.argv.append("-h")

    p, sub_parsers = generate_parser()

    main_modules = [
        "info",
        "help",
        "list",
        "search",
        "create",
        "install",
        "update",
        "remove",
        "config",
        "clean",
        "package",
    ]
    modules = ["conda.cli.main_" + suffix for suffix in main_modules]
    for module in modules:
        imported = importlib.import_module(module)
        imported.configure_parser(sub_parsers)
        if "update" in module:
            imported.configure_parser(sub_parsers, name="upgrade")
        if "remove" in module:
            imported.configure_parser(sub_parsers, name="uninstall")

    from conda.cli.find_commands import find_commands

    def completer(prefix, **kwargs):
        return [
            i
            for i in list(sub_parsers.choices) + find_commands()
            if i.startswith(prefix)
        ]

    sub_parsers.completer = completer
    args = p.parse_args()

    context._add_argparse_args(args)

    if getattr(args, "json", False):
        # # Silence logging info to avoid interfering with JSON output
        # for logger in Logger.manager.loggerDict:
        #     if logger not in ('fetch', 'progress'):
        #         getLogger(logger).setLevel(CRITICAL + 1)
        for logger in ("print", "dotupdate", "stdoutlog", "stderrlog"):
            getLogger(logger).setLevel(CRITICAL + 1)

    if context.debug:
        set_all_logger_level(DEBUG)
    elif context.verbosity:
        set_verbosity(context.verbosity)
        log.debug("verbosity set to %s", context.verbosity)

    exit_code = args.func(args, p)
    if isinstance(exit_code, int):
        return exit_code