gurudesh/pytracebugs huggingface dataset:
# Buggy code
def create_meta(prefix, dist, info_dir, extra_info):
    """
    Create the conda metadata, in a given prefix, for a given package.
    """
    # read info/index.json first
    with open(join(info_dir, "index.json")) as fi:
        meta = json.load(fi)
    # add extra info, add to our intenral cache
    meta.update(extra_info)
    if "url" not in meta:
        meta["url"] = read_url(dist)
    # write into <env>/conda-meta/<dist>.json
    meta_dir = join(prefix, "conda-meta")
    if not isdir(meta_dir):
        os.makedirs(meta_dir)
    with open(join(meta_dir, dist2filename(dist, ".json")), "w") as fo:
        json.dump(meta, fo, indent=2, sort_keys=True)
    if prefix in linked_data_:
        load_linked_data(prefix, dist, meta)


# Traceback (TypeError)
% conda create -p ~/anaclone --clone root
Source:      /Users/ijstokes/anaconda
Destination: /Users/ijstokes/anaclone
The following packages cannot be cloned out of the root environment:
- conda-4.1.1-py27_0
- conda-build-1.20.3-py27_0
Packages: 332
Files: 16134
An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

https://github.com/conda/conda/issues

clude the output of the command 'conda info' in your report.


Traceback (most recent call last):
File "/Users/ijstokes/anaconda/envs/ana40py35/bin/conda", line 6, in <module>
sys.exit(main())
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 57, in execute
install(args, parser, 'create')
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 218, in install
'unknown': args.unknown})
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 87, in clone
fetch_args=fetch_args)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/misc.py", line 353, in clone_env
force_extract=False, fetch_args=fetch_args)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/misc.py", line 56, in explicit
m = url_pat.match(spec)
TypeError: expected string or buffer

# Fixed code
def create_meta(prefix, dist, info_dir, extra_info):
    """
    Create the conda metadata, in a given prefix, for a given package.
    """
    # read info/index.json first
    with open(join(info_dir, "index.json")) as fi:
        meta = json.load(fi)
    # add extra info, add to our intenral cache
    meta.update(extra_info)
    if not meta.get("url"):
        meta["url"] = read_url(dist)
    # write into <env>/conda-meta/<dist>.json
    meta_dir = join(prefix, "conda-meta")
    if not isdir(meta_dir):
        os.makedirs(meta_dir)
    with open(join(meta_dir, dist2filename(dist, ".json")), "w") as fo:
        json.dump(meta, fo, indent=2, sort_keys=True)
    if prefix in linked_data_:
        load_linked_data(prefix, dist, meta)
# Buggy code
def make_icon_url(info):
    if "channel" in info and "icon" in info:
        base_url = dirname(info["channel"])
        icon_fn = info["icon"]
        # icon_cache_path = join(pkgs_dir, 'cache', icon_fn)
        # if isfile(icon_cache_path):
        #    return url_path(icon_cache_path)
        return "%s/icons/%s" % (base_url, icon_fn)
    return ""


# Traceback (TypeError)
% conda create -p ~/anaclone --clone root
Source:      /Users/ijstokes/anaconda
Destination: /Users/ijstokes/anaclone
The following packages cannot be cloned out of the root environment:
- conda-4.1.1-py27_0
- conda-build-1.20.3-py27_0
Packages: 332
Files: 16134
An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

https://github.com/conda/conda/issues

clude the output of the command 'conda info' in your report.


Traceback (most recent call last):
File "/Users/ijstokes/anaconda/envs/ana40py35/bin/conda", line 6, in <module>
sys.exit(main())
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 57, in execute
install(args, parser, 'create')
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 218, in install
'unknown': args.unknown})
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 87, in clone
fetch_args=fetch_args)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/misc.py", line 353, in clone_env
force_extract=False, fetch_args=fetch_args)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/misc.py", line 56, in explicit
m = url_pat.match(spec)
TypeError: expected string or buffer

# Fixed code
def make_icon_url(info):
    if info.get("channel") and info.get("icon"):
        base_url = dirname(info["channel"])
        icon_fn = info["icon"]
        # icon_cache_path = join(pkgs_dir, 'cache', icon_fn)
        # if isfile(icon_cache_path):
        #    return url_path(icon_cache_path)
        return "%s/icons/%s" % (base_url, icon_fn)
    return ""
# Buggy code
def channel_str(rec):
    if "schannel" in rec:
        return rec["schannel"]
    if "url" in rec:
        return url_channel(rec["url"])[1]
    if "channel" in rec:
        return canonical_channel_name(rec["channel"])
    return "<unknown>"


# Traceback (TypeError)
% conda create -p ~/anaclone --clone root
Source:      /Users/ijstokes/anaconda
Destination: /Users/ijstokes/anaclone
The following packages cannot be cloned out of the root environment:
- conda-4.1.1-py27_0
- conda-build-1.20.3-py27_0
Packages: 332
Files: 16134
An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

https://github.com/conda/conda/issues

clude the output of the command 'conda info' in your report.


Traceback (most recent call last):
File "/Users/ijstokes/anaconda/envs/ana40py35/bin/conda", line 6, in <module>
sys.exit(main())
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 57, in execute
install(args, parser, 'create')
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 218, in install
'unknown': args.unknown})
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 87, in clone
fetch_args=fetch_args)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/misc.py", line 353, in clone_env
force_extract=False, fetch_args=fetch_args)
File "/Users/ijstokes/anaconda/lib/python2.7/site-packages/conda/misc.py", line 56, in explicit
m = url_pat.match(spec)
TypeError: expected string or buffer

# Fixed code
def channel_str(rec):
    if rec.get("schannel"):
        return rec["schannel"]
    if rec.get("url"):
        return url_channel(rec["url"])[1]
    if rec.get("channel"):
        return canonical_channel_name(rec["channel"])
    return "<unknown>"
# Buggy code
def is_url(url):
    return url and urlparse.urlparse(url).scheme != ""


# Traceback (RuntimeError)
________________________ IntegrationTests.test_python3 ________________________
Traceback (most recent call last):
File "C:\projects\conda\tests\test_create.py", line 146, in test_python3
run_command(Commands.INSTALL, prefix, flask_tar_file)
File "C:\projects\conda\tests\test_create.py", line 104, in run_command
args.func(args, p)
File "C:\projects\conda\conda\cli\main_install.py", line 62, in execute
install(args, parser, 'install')
File "C:\projects\conda\conda\cli\install.py", line 195, in install
explicit(args.packages, prefix, verbose=not args.quiet)
File "C:\projects\conda\conda\misc.py", line 111, in explicit
index.update(fetch_index(channels, **fetch_args))
File "C:\projects\conda\conda\fetch.py", line 266, in fetch_index
for url in iterkeys(channel_urls)]
File "C:\projects\conda\conda\fetch.py", line 67, in func
res = f(*args, **kwargs)
File "C:\projects\conda\conda\fetch.py", line 149, in fetch_repodata
raise RuntimeError(msg)
RuntimeError: Could not find URL: file:///C|/projects/conda/
---------------------------- Captured stdout call -----------------------------

# Fixed code
def is_url(url):
    if url:
        p = urlparse.urlparse(url)
        return p.netloc != "" or p.scheme == "file"
# Buggy code
def load_linked_data(prefix, dist, rec=None):
    schannel, dname = dist2pair(dist)
    if rec is None:
        meta_file = join(prefix, "conda-meta", dname + ".json")
        try:
            with open(meta_file) as fi:
                rec = json.load(fi)
        except IOError:
            return None
    else:
        linked_data(prefix)
    url = rec.get("url")
    if "fn" not in rec:
        rec["fn"] = url.rsplit("/", 1)[-1] if url else dname + ".tar.bz2"
    if not url and "channel" in rec:
        url = rec["url"] = rec["channel"] + rec["fn"]
    channel, schannel = url_channel(url)
    rec["channel"] = channel
    rec["schannel"] = schannel
    cprefix = "" if schannel == "defaults" else schannel + "::"
    linked_data_[prefix][str(cprefix + dname)] = rec
    return rec


# Traceback (KeyError)
$ CIO_TEST=3 conda update pycrypto
...
Traceback (most recent call last):
File "/Users/ilan/python/bin/conda", line 6, in <module>
sys.exit(conda.cli.main.main())
File "/Users/ilan/conda/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/Users/ilan/conda/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/Users/ilan/conda/conda/cli/main_update.py", line 64, in execute
install.install(args, parser, 'update')
File "/Users/ilan/conda/conda/cli/install.py", line 232, in install
plan.add_defaults_to_specs(r, linked, specs, update=isupdate)
File "/Users/ilan/conda/conda/plan.py", line 344, in add_defaults_to_specs
names_linked = {r.index[fn]['name']: fn for fn in linked}
File "/Users/ilan/conda/conda/plan.py", line 344, in <dictcomp>
names_linked = {r.index[fn]['name']: fn for fn in linked}
KeyError: 'xar.tar.bz2'

# Fixed code
def load_linked_data(prefix, dist, rec=None):
    schannel, dname = dist2pair(dist)
    meta_file = join(prefix, "conda-meta", dname + ".json")
    if rec is None:
        try:
            with open(meta_file) as fi:
                rec = json.load(fi)
        except IOError:
            return None
    else:
        linked_data(prefix)
    url = rec.get("url")
    if "fn" not in rec:
        rec["fn"] = url.rsplit("/", 1)[-1] if url else dname + ".tar.bz2"
    if not url and "channel" in rec:
        url = rec["url"] = rec["channel"] + rec["fn"]
    if rec["fn"][:-8] != dname:
        log.debug("Ignoring invalid package metadata file: %s" % meta_file)
        return None
    channel, schannel = url_channel(url)
    rec["channel"] = channel
    rec["schannel"] = schannel
    cprefix = "" if schannel == "defaults" else schannel + "::"
    linked_data_[prefix][str(cprefix + dname)] = rec
    return rec
# Buggy code
def pretty_diff(diff):
    added = {}
    removed = {}
    for s in diff:
        fn = s[1:]
        name, version, unused_build = dist2quad(fn, channel=False)
        if s.startswith("-"):
            removed[name.lower()] = version
        elif s.startswith("+"):
            added[name.lower()] = version
    changed = set(added) & set(removed)
    for name in sorted(changed):
        yield " %s  {%s -> %s}" % (name, removed[name], added[name])
    for name in sorted(set(removed) - changed):
        yield "-%s-%s" % (name, removed[name])
    for name in sorted(set(added) - changed):
        yield "+%s-%s" % (name, added[name])


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/ilan/minonda/bin/conda", line 6, in <module>
sys.exit(main())
File "/home/ilan/conda/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/home/ilan/conda/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/home/ilan/conda/conda/cli/main_install.py", line 62, in execute
install.install(args, parser, 'install')
File "/home/ilan/conda/conda/cli/install.py", line 394, in install
plan.execute_actions(actions, index, verbose=not args.quiet)
File "/home/ilan/conda/conda/plan.py", line 555, in execute_actions
inst.execute_instructions(plan, index, verbose)
File "/home/ilan/conda/conda/instructions.py", line 133, in execute_instructions
cmd(state, arg)
File "/home/ilan/conda/conda/instructions.py", line 80, in UNLINK_CMD
install.unlink(state['prefix'], arg)
File "/home/ilan/conda/conda/install.py", line 1075, in unlink
mk_menus(prefix, meta['files'], remove=True)
TypeError: 'NoneType' object has no attribute '__getitem__'

# Fixed code
def pretty_diff(diff):
    added = {}
    removed = {}
    for s in diff:
        fn = s[1:]
        name, version, _, channel = dist2quad(fn)
        if channel != "defaults":
            version += " (%s)" % channel
        if s.startswith("-"):
            removed[name.lower()] = version
        elif s.startswith("+"):
            added[name.lower()] = version
    changed = set(added) & set(removed)
    for name in sorted(changed):
        yield " %s  {%s -> %s}" % (name, removed[name], added[name])
    for name in sorted(set(removed) - changed):
        yield "-%s-%s" % (name, removed[name])
    for name in sorted(set(added) - changed):
        yield "+%s-%s" % (name, added[name])
# Buggy code
def dist2quad(dist, channel=True):
    dist = str(dist)
    if dist.endswith(".tar.bz2"):
        dist = dist[:-8]
    parts = dist.rsplit("-", 2)
    if len(parts) < 3:
        parts = parts + [""] * (3 - len(parts))
    chan_name, version, build = parts
    if not channel:
        return chan_name, version, build
    parts = chan_name.split("::")
    return (parts[-1], version, build, "defaults" if len(parts) < 2 else parts[0])


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/ilan/minonda/bin/conda", line 6, in <module>
sys.exit(main())
File "/home/ilan/conda/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/home/ilan/conda/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/home/ilan/conda/conda/cli/main_install.py", line 62, in execute
install.install(args, parser, 'install')
File "/home/ilan/conda/conda/cli/install.py", line 394, in install
plan.execute_actions(actions, index, verbose=not args.quiet)
File "/home/ilan/conda/conda/plan.py", line 555, in execute_actions
inst.execute_instructions(plan, index, verbose)
File "/home/ilan/conda/conda/instructions.py", line 133, in execute_instructions
cmd(state, arg)
File "/home/ilan/conda/conda/instructions.py", line 80, in UNLINK_CMD
install.unlink(state['prefix'], arg)
File "/home/ilan/conda/conda/install.py", line 1075, in unlink
mk_menus(prefix, meta['files'], remove=True)
TypeError: 'NoneType' object has no attribute '__getitem__'

# Fixed code
def dist2quad(dist):
    channel, dist = dist2pair(dist)
    parts = dist.rsplit("-", 2) + ["", ""]
    return (parts[0], parts[1], parts[2], channel)
# Buggy code
def name_dist(dist):
    return dist2quad(dist)[0]


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/ilan/minonda/bin/conda", line 6, in <module>
sys.exit(main())
File "/home/ilan/conda/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/home/ilan/conda/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/home/ilan/conda/conda/cli/main_install.py", line 62, in execute
install.install(args, parser, 'install')
File "/home/ilan/conda/conda/cli/install.py", line 394, in install
plan.execute_actions(actions, index, verbose=not args.quiet)
File "/home/ilan/conda/conda/plan.py", line 555, in execute_actions
inst.execute_instructions(plan, index, verbose)
File "/home/ilan/conda/conda/instructions.py", line 133, in execute_instructions
cmd(state, arg)
File "/home/ilan/conda/conda/instructions.py", line 80, in UNLINK_CMD
install.unlink(state['prefix'], arg)
File "/home/ilan/conda/conda/install.py", line 1075, in unlink
mk_menus(prefix, meta['files'], remove=True)
TypeError: 'NoneType' object has no attribute '__getitem__'

# Fixed code
def name_dist(dist):
    return dist2name(dist)
# Buggy code
def create_meta(prefix, dist, info_dir, extra_info):
    """
    Create the conda metadata, in a given prefix, for a given package.
    """
    # read info/index.json first
    with open(join(info_dir, "index.json")) as fi:
        meta = json.load(fi)
    # add extra info, add to our intenral cache
    meta.update(extra_info)
    if "url" not in meta:
        meta["url"] = read_url(dist)
    # write into <env>/conda-meta/<dist>.json
    meta_dir = join(prefix, "conda-meta")
    if not isdir(meta_dir):
        os.makedirs(meta_dir)
    with open(join(meta_dir, _dist2filename(dist, ".json")), "w") as fo:
        json.dump(meta, fo, indent=2, sort_keys=True)
    if prefix in linked_data_:
        load_linked_data(prefix, dist, meta)


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/ilan/minonda/bin/conda", line 6, in <module>
sys.exit(main())
File "/home/ilan/conda/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/home/ilan/conda/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/home/ilan/conda/conda/cli/main_install.py", line 62, in execute
install.install(args, parser, 'install')
File "/home/ilan/conda/conda/cli/install.py", line 394, in install
plan.execute_actions(actions, index, verbose=not args.quiet)
File "/home/ilan/conda/conda/plan.py", line 555, in execute_actions
inst.execute_instructions(plan, index, verbose)
File "/home/ilan/conda/conda/instructions.py", line 133, in execute_instructions
cmd(state, arg)
File "/home/ilan/conda/conda/instructions.py", line 80, in UNLINK_CMD
install.unlink(state['prefix'], arg)
File "/home/ilan/conda/conda/install.py", line 1075, in unlink
mk_menus(prefix, meta['files'], remove=True)
TypeError: 'NoneType' object has no attribute '__getitem__'

# Fixed code
def create_meta(prefix, dist, info_dir, extra_info):
    """
    Create the conda metadata, in a given prefix, for a given package.
    """
    # read info/index.json first
    with open(join(info_dir, "index.json")) as fi:
        meta = json.load(fi)
    # add extra info, add to our intenral cache
    meta.update(extra_info)
    if "url" not in meta:
        meta["url"] = read_url(dist)
    # write into <env>/conda-meta/<dist>.json
    meta_dir = join(prefix, "conda-meta")
    if not isdir(meta_dir):
        os.makedirs(meta_dir)
    with open(join(meta_dir, dist2filename(dist, ".json")), "w") as fo:
        json.dump(meta, fo, indent=2, sort_keys=True)
    if prefix in linked_data_:
        load_linked_data(prefix, dist, meta)
# Buggy code
def try_hard_link(pkgs_dir, prefix, dist):
    dist = _dist2filename(dist, "")
    src = join(pkgs_dir, dist, "info", "index.json")
    dst = join(prefix, ".tmp-%s" % dist)
    assert isfile(src), src
    assert not isfile(dst), dst
    try:
        if not isdir(prefix):
            os.makedirs(prefix)
        _link(src, dst, LINK_HARD)
        # Some file systems (at least BeeGFS) do not support hard-links
        # between files in different directories. Depending on the
        # file system configuration, a symbolic link may be created
        # instead. If a symbolic link is created instead of a hard link,
        # return False.
        return not os.path.islink(dst)
    except OSError:
        return False
    finally:
        rm_rf(dst)
        rm_empty_dir(prefix)


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/ilan/minonda/bin/conda", line 6, in <module>
sys.exit(main())
File "/home/ilan/conda/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/home/ilan/conda/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/home/ilan/conda/conda/cli/main_install.py", line 62, in execute
install.install(args, parser, 'install')
File "/home/ilan/conda/conda/cli/install.py", line 394, in install
plan.execute_actions(actions, index, verbose=not args.quiet)
File "/home/ilan/conda/conda/plan.py", line 555, in execute_actions
inst.execute_instructions(plan, index, verbose)
File "/home/ilan/conda/conda/instructions.py", line 133, in execute_instructions
cmd(state, arg)
File "/home/ilan/conda/conda/instructions.py", line 80, in UNLINK_CMD
install.unlink(state['prefix'], arg)
File "/home/ilan/conda/conda/install.py", line 1075, in unlink
mk_menus(prefix, meta['files'], remove=True)
TypeError: 'NoneType' object has no attribute '__getitem__'

# Fixed code
def try_hard_link(pkgs_dir, prefix, dist):
    dist = dist2filename(dist, "")
    src = join(pkgs_dir, dist, "info", "index.json")
    dst = join(prefix, ".tmp-%s" % dist)
    assert isfile(src), src
    assert not isfile(dst), dst
    try:
        if not isdir(prefix):
            os.makedirs(prefix)
        _link(src, dst, LINK_HARD)
        # Some file systems (at least BeeGFS) do not support hard-links
        # between files in different directories. Depending on the
        # file system configuration, a symbolic link may be created
        # instead. If a symbolic link is created instead of a hard link,
        # return False.
        return not os.path.islink(dst)
    except OSError:
        return False
    finally:
        rm_rf(dst)
        rm_empty_dir(prefix)
# Buggy code
def find_new_location(dist):
    """
    Determines the download location for the given package, and the name
    of a package, if any, that must be removed to make room. If the
    given package is already in the cache, it returns its current location,
    under the assumption that it will be overwritten. If the conflict
    value is None, that means there is no other package with that same
    name present in the cache (e.g., no collision).
    """
    rec = package_cache().get(dist)
    if rec:
        return dirname((rec["files"] or rec["dirs"])[0]), None
    fname = _dist2filename(dist)
    dname = fname[:-8]
    # Look for a location with no conflicts
    # On the second pass, just pick the first location
    for p in range(2):
        for pkg_dir in pkgs_dirs:
            pkg_path = join(pkg_dir, fname)
            prefix = fname_table_.get(pkg_path)
            if p or prefix is None:
                return pkg_dir, prefix + dname if p else None


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/ilan/minonda/bin/conda", line 6, in <module>
sys.exit(main())
File "/home/ilan/conda/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/home/ilan/conda/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/home/ilan/conda/conda/cli/main_install.py", line 62, in execute
install.install(args, parser, 'install')
File "/home/ilan/conda/conda/cli/install.py", line 394, in install
plan.execute_actions(actions, index, verbose=not args.quiet)
File "/home/ilan/conda/conda/plan.py", line 555, in execute_actions
inst.execute_instructions(plan, index, verbose)
File "/home/ilan/conda/conda/instructions.py", line 133, in execute_instructions
cmd(state, arg)
File "/home/ilan/conda/conda/instructions.py", line 80, in UNLINK_CMD
install.unlink(state['prefix'], arg)
File "/home/ilan/conda/conda/install.py", line 1075, in unlink
mk_menus(prefix, meta['files'], remove=True)
TypeError: 'NoneType' object has no attribute '__getitem__'

# Fixed code
def find_new_location(dist):
    """
    Determines the download location for the given package, and the name
    of a package, if any, that must be removed to make room. If the
    given package is already in the cache, it returns its current location,
    under the assumption that it will be overwritten. If the conflict
    value is None, that means there is no other package with that same
    name present in the cache (e.g., no collision).
    """
    rec = package_cache().get(dist)
    if rec:
        return dirname((rec["files"] or rec["dirs"])[0]), None
    fname = dist2filename(dist)
    dname = fname[:-8]
    # Look for a location with no conflicts
    # On the second pass, just pick the first location
    for p in range(2):
        for pkg_dir in pkgs_dirs:
            pkg_path = join(pkg_dir, fname)
            prefix = fname_table_.get(pkg_path)
            if p or prefix is None:
                return pkg_dir, prefix + dname if p else None
# Buggy code
def load_linked_data(prefix, dist, rec=None):
    schannel, dname = _dist2pair(dist)
    if rec is None:
        meta_file = join(prefix, "conda-meta", dname + ".json")
        try:
            with open(meta_file) as fi:
                rec = json.load(fi)
        except IOError:
            return None
    else:
        linked_data(prefix)
    url = rec.get("url")
    if "fn" not in rec:
        rec["fn"] = url.rsplit("/", 1)[-1] if url else dname + ".tar.bz2"
    if not url and "channel" in rec:
        url = rec["url"] = rec["channel"] + rec["fn"]
    channel, schannel = url_channel(url)
    rec["channel"] = channel
    rec["schannel"] = schannel
    cprefix = "" if schannel == "defaults" else schannel + "::"
    linked_data_[prefix][str(cprefix + dname)] = rec
    return rec


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/ilan/minonda/bin/conda", line 6, in <module>
sys.exit(main())
File "/home/ilan/conda/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/home/ilan/conda/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/home/ilan/conda/conda/cli/main_install.py", line 62, in execute
install.install(args, parser, 'install')
File "/home/ilan/conda/conda/cli/install.py", line 394, in install
plan.execute_actions(actions, index, verbose=not args.quiet)
File "/home/ilan/conda/conda/plan.py", line 555, in execute_actions
inst.execute_instructions(plan, index, verbose)
File "/home/ilan/conda/conda/instructions.py", line 133, in execute_instructions
cmd(state, arg)
File "/home/ilan/conda/conda/instructions.py", line 80, in UNLINK_CMD
install.unlink(state['prefix'], arg)
File "/home/ilan/conda/conda/install.py", line 1075, in unlink
mk_menus(prefix, meta['files'], remove=True)
TypeError: 'NoneType' object has no attribute '__getitem__'

# Fixed code
def load_linked_data(prefix, dist, rec=None):
    schannel, dname = dist2pair(dist)
    if rec is None:
        meta_file = join(prefix, "conda-meta", dname + ".json")
        try:
            with open(meta_file) as fi:
                rec = json.load(fi)
        except IOError:
            return None
    else:
        linked_data(prefix)
    url = rec.get("url")
    if "fn" not in rec:
        rec["fn"] = url.rsplit("/", 1)[-1] if url else dname + ".tar.bz2"
    if not url and "channel" in rec:
        url = rec["url"] = rec["channel"] + rec["fn"]
    channel, schannel = url_channel(url)
    rec["channel"] = channel
    rec["schannel"] = schannel
    cprefix = "" if schannel == "defaults" else schannel + "::"
    linked_data_[prefix][str(cprefix + dname)] = rec
    return rec
# Buggy code
def delete_linked_data(prefix, dist, delete=True):
    recs = linked_data_.get(prefix)
    if recs and dist in recs:
        del recs[dist]
    if delete:
        meta_path = join(prefix, "conda-meta", _dist2filename(dist, ".json"))
        if isfile(meta_path):
            os.unlink(meta_path)


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/ilan/minonda/bin/conda", line 6, in <module>
sys.exit(main())
File "/home/ilan/conda/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/home/ilan/conda/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/home/ilan/conda/conda/cli/main_install.py", line 62, in execute
install.install(args, parser, 'install')
File "/home/ilan/conda/conda/cli/install.py", line 394, in install
plan.execute_actions(actions, index, verbose=not args.quiet)
File "/home/ilan/conda/conda/plan.py", line 555, in execute_actions
inst.execute_instructions(plan, index, verbose)
File "/home/ilan/conda/conda/instructions.py", line 133, in execute_instructions
cmd(state, arg)
File "/home/ilan/conda/conda/instructions.py", line 80, in UNLINK_CMD
install.unlink(state['prefix'], arg)
File "/home/ilan/conda/conda/install.py", line 1075, in unlink
mk_menus(prefix, meta['files'], remove=True)
TypeError: 'NoneType' object has no attribute '__getitem__'

# Fixed code
def delete_linked_data(prefix, dist, delete=True):
    recs = linked_data_.get(prefix)
    if recs and dist in recs:
        del recs[dist]
    if delete:
        meta_path = join(prefix, "conda-meta", dist2filename(dist, ".json"))
        if isfile(meta_path):
            os.unlink(meta_path)
# Buggy code
def normalize_urls(urls, platform=None, offline_only=False):
    platform = platform or subdir
    defaults = tuple(x.rstrip("/") + "/" for x in get_default_urls())
    alias = binstar_channel_alias(channel_alias)

    def normalize_(url):
        url = url.rstrip("/")
        if is_url(url):
            url_s = canonical_channel_name(url, True)
        else:
            url_s = url
            url = alias + url
        return url_s, url

    newurls = OrderedDict()
    priority = 0
    while urls:
        url = urls[0]
        urls = urls[1:]
        if url == "system" and rc_path:
            urls = get_rc_urls() + urls
            continue
        elif url in ("defaults", "system"):
            t_urls = defaults
        elif url == "local":
            t_urls = get_local_urls()
        else:
            t_urls = [url]
        priority += 1
        for url0 in t_urls:
            url_s, url0 = normalize_(url0)
            if offline_only and not url0.startswith("file:"):
                continue
            for plat in (platform, "noarch"):
                newurls.setdefault("%s/%s/" % (url0, plat), (url_s, priority))
    return newurls


# Traceback (TypeError)
Fetching package metadata ....Traceback (most recent call last):
File "/Users/ilan/python/bin/constructor", line 6, in <module>
exec(compile(open(__file__).read(), __file__, 'exec'))
File "/Users/ilan/constructor/bin/constructor", line 6, in <module>
sys.exit(main())
File "/Users/ilan/constructor/constructor/main.py", line 146, in main
verbose=opts.verbose)
File "/Users/ilan/constructor/constructor/main.py", line 81, in main_build
fcp.main(info, verbose=verbose)
File "/Users/ilan/constructor/constructor/fcp.py", line 170, in main
for url in info['channels']))
File "/Users/ilan/python/lib/python2.7/site-packages/conda/fetch.py", line 276, in fetch_index
url_s, priority = channel_urls[channel]
TypeError: 'int' object is not iterable

# Fixed code
def normalize_urls(urls, platform=None, offline_only=False):
    defaults = tuple(x.rstrip("/") + "/" for x in get_default_urls())
    alias = binstar_channel_alias(channel_alias)
    newurls = []
    while urls:
        url = urls[0]
        urls = urls[1:]
        if url == "system" and rc_path:
            urls = get_rc_urls() + urls
            continue
        elif url in ("defaults", "system"):
            t_urls = defaults
        elif url == "local":
            t_urls = get_local_urls()
        else:
            t_urls = [url]
        for url0 in t_urls:
            url0 = url0.rstrip("/")
            if not is_url(url0):
                url0 = alias + url0
            if offline_only and not url0.startswith("file:"):
                continue
            for plat in (platform or subdir, "noarch"):
                newurls.append("%s/%s/" % (url0, plat))
    return newurls
# Buggy code
def canonical_channel_name(channel, hide=True, no_unknown=False):
    if channel is None:
        return "defaults" if no_unknown else "<unknown>"
    channel = remove_binstar_tokens(channel).rstrip("/")
    if any(channel.startswith(i) for i in get_default_urls()):
        return "defaults"
    elif any(channel.startswith(i) for i in get_local_urls(clear_cache=False)):
        return "local"
    elif channel.startswith("http://filer/"):
        return "filer"
    elif channel.startswith(channel_alias):
        return channel.split(channel_alias, 1)[1]
    elif channel.startswith("http:/"):
        channel2 = "https" + channel[4:]
        channel3 = canonical_channel_name(channel2, hide, no_unknown)
        return channel3 if channel3 != channel2 else channel
    else:
        return channel


# Traceback (TypeError)
Fetching package metadata ....Traceback (most recent call last):
File "/Users/ilan/python/bin/constructor", line 6, in <module>
exec(compile(open(__file__).read(), __file__, 'exec'))
File "/Users/ilan/constructor/bin/constructor", line 6, in <module>
sys.exit(main())
File "/Users/ilan/constructor/constructor/main.py", line 146, in main
verbose=opts.verbose)
File "/Users/ilan/constructor/constructor/main.py", line 81, in main_build
fcp.main(info, verbose=verbose)
File "/Users/ilan/constructor/constructor/fcp.py", line 170, in main
for url in info['channels']))
File "/Users/ilan/python/lib/python2.7/site-packages/conda/fetch.py", line 276, in fetch_index
url_s, priority = channel_urls[channel]
TypeError: 'int' object is not iterable

# Fixed code
def canonical_channel_name(channel):
    if channel is None:
        return "<unknown>"
    channel = remove_binstar_tokens(channel).rstrip("/")
    if any(channel.startswith(i) for i in get_default_urls()):
        return "defaults"
    elif any(channel.startswith(i) for i in get_local_urls(clear_cache=False)):
        return "local"
    elif channel.startswith("http://filer/"):
        return "filer"
    elif channel.startswith(channel_alias):
        return channel.split(channel_alias, 1)[1]
    elif channel.startswith("http:/"):
        channel2 = "https" + channel[4:]
        channel3 = canonical_channel_name(channel2)
        return channel3 if channel3 != channel2 else channel
    else:
        return channel
# Buggy code
def write_head(fo):
    fo.write("==> %s <==\n" % time.strftime(TIME_FORMAT))
    fo.write("# cmd: %s\n" % (" ".join(sys.argv)))


# Traceback (UnicodeEncodeError)
Fetching package metadata: ..
Solving package specifications: .
Package plan for installation in environment C:\Users\colin.dickson\Miniconda:

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
conda-3.4.1                |           py33_0         125 KB

The following packages will be UN-linked:

package                    |            build
---------------------------|-----------------
conda-3.4.0                |           py33_0

The following packages will be linked:

package                    |            build
---------------------------|-----------------
conda-3.4.1                |           py33_0   hard-link

An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

https://github.com/conda/conda/issues

Include the output of the command 'conda info' in your report.


conda : Traceback (most recent call last):
+ conda update conda --yes 2>&amp;1 >  conda_update.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (Traceback (most recent call last)::String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

File "C:\Users\colin.dickson\Miniconda\Scripts\conda-script.py", line 4, in <module>
sys.exit(main())
File "C:\Users\colin.dickson\Miniconda\lib\site-packages\conda\cli\main.py", line 179, in main
args.func(args, p)
File "C:\Users\colin.dickson\Miniconda\lib\site-packages\conda\cli\main_update.py", line 39, in execute
install.install(args, parser, 'update')
File "C:\Users\colin.dickson\Miniconda\lib\site-packages\conda\cli\install.py", line 275, in install
plan.execute_actions(actions, index, verbose=not args.quiet)
File "C:\Users\colin.dickson\Miniconda\lib\site-packages\conda\plan.py", line 418, in execute_actions
with History(actions[PREFIX]):
File "C:\Users\colin.dickson\Miniconda\lib\site-packages\conda\history.py", line 55, in __enter__
self.update()
File "C:\Users\colin.dickson\Miniconda\lib\site-packages\conda\history.py", line 75, in update
self.write_changes(last, curr)
File "C:\Users\colin.dickson\Miniconda\lib\site-packages\conda\history.py", line 147, in write_changes
write_head(fo)
File "C:\Users\colin.dickson\Miniconda\lib\site-packages\conda\history.py", line 16, in write_head
fo.write("==> %s <==\n" % time.strftime(TIME_FORMAT))
File "C:\Users\colin.dickson\Miniconda\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\x92' in position 36: character maps to <undefined>

# Fixed code
def write_head(fo):
    fo.write("==> %s <==\n" % time.strftime("%Y-%m-%d %H:%M:%S"))
    fo.write("# cmd: %s\n" % (" ".join(sys.argv)))
# Buggy code
def create_parser():
    p = argparse.ArgumentParser()
    sub_parsers = p.add_subparsers()

    main_create.configure_parser(sub_parsers)
    main_export.configure_parser(sub_parsers)
    main_list.configure_parser(sub_parsers)
    return p


# Traceback (IOError)
Z:\continuum\iopro>conda install iopro

The following packages will be downloaded:

iopro-1.2.3-np16py27_1.tar.bz2 [http://repo.continuum.io/pkgs/win-64/]
python-2.7.3-5.tar.bz2 [http://repo.continuum.io/pkgs/win-64/]


The following packages will be DE-activated:

package                    |  build
-------------------------  |  ---------------
iopro-1.2.2                |       np16py27_0
python-2.7.3               |                4


The following packages will be activated:

package                    |  build
-------------------------  |  ---------------
iopro-1.2.3                |       np16py27_1
python-2.7.3               |                5


Proceed (y/n)? y

Fetching packages...

iopro-1.2.3-np16py27_1.tar.bz2 100% |###############| Time: 0:00:02 148.82 kB/s
python-2.7.3-5.tar.bz2 100% |#######################| Time: 0:01:08 297.27 kB/s

Deactivating packages...

[      COMPLETE      ] |#################################################| 100%

Activating packages...

An unexpected exceptional error has occurred, please consider sending the follow
ing traceback to the conda GitHub issue tracker at https://github.com/ContinuumI
O/conda/issues

Traceback (most recent call last):
File "C:\Anaconda\Scripts\conda-script.py", line 4, in <module>
sys.exit(main())
File "C:\Anaconda\lib\site-packages\conda\cli\main.py", line 105, in main
args.func(args)
File "C:\Anaconda\lib\site-packages\conda\cli\main_install.py", line 114, in e
xecute
plan.execute(env, args.progress_bar=="yes")
File "C:\Anaconda\lib\site-packages\conda\package_plan.py", line 81, in execut
e
self._handle_activations(env, package_progress)
File "C:\Anaconda\lib\site-packages\conda\package_plan.py", line 123, in _hand
le_activations
activate(env.conda.packages_dir, pkg.canonical_name, env.prefix)
File "C:\Anaconda\lib\site-packages\conda\install.py", line 188, in activate
t.extractall(path=prefix)
File "C:\Anaconda\lib\tarfile.py", line 2048, in extractall
File "C:\Anaconda\lib\tarfile.py", line 2085, in extract
File "C:\Anaconda\lib\tarfile.py", line 2161, in _extract_member
File "C:\Anaconda\lib\tarfile.py", line 2200, in makefile
IOError: [Errno 13] Permission denied: 'C:\\Anaconda\\DLLs\\_hashlib.pyd'

Z:\continuum\iopro>conda -h
ImportError: No module named site

# Fixed code
def create_parser():
    p = argparse.ArgumentParser()
    sub_parsers = p.add_subparsers()

    main_create.configure_parser(sub_parsers)
    main_export.configure_parser(sub_parsers)
    main_list.configure_parser(sub_parsers)
    main_remove.configure_parser(sub_parsers)
    return p
# Buggy code
def __init__(self, path):
    assert isdir(path)
    self.path = path
    meta_path = join(path, "meta.yaml")
    self.meta = parse(open(meta_path).read())


# Traceback (AttributeError)
BUILD START: An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

https://github.com/ContinuumIO/conda/issues"


Traceback (most recent call last):
File "/Users/aaronmeurer/anaconda/bin/conda", line 5, in <module>
sys.exit(main())
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/cli/main.py", line 110, in main
args.func(args, p)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/cli/main_build.py", line 52, in execute
build.build(m)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/build.py", line 118, in build
print "BUILD START:", m.dist()
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/metadata.py", line 137, in dist
return '%s-%s-%s' % (self.name(), self.version(), self.build_id())
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/metadata.py", line 104, in name
return self.get_value('package/name').lower()
AttributeError: 'NoneType' object has no attribute 'lower'

# Fixed code
def __init__(self, path):
    assert isdir(path)
    self.path = path
    self.meta_path = join(path, "meta.yaml")
    self.meta = parse(open(self.meta_path).read())
# Buggy code
def name(self):
    return self.get_value("package/name").lower()


# Traceback (AttributeError)
BUILD START: An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

https://github.com/ContinuumIO/conda/issues"


Traceback (most recent call last):
File "/Users/aaronmeurer/anaconda/bin/conda", line 5, in <module>
sys.exit(main())
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/cli/main.py", line 110, in main
args.func(args, p)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/cli/main_build.py", line 52, in execute
build.build(m)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/build.py", line 118, in build
print "BUILD START:", m.dist()
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/metadata.py", line 137, in dist
return '%s-%s-%s' % (self.name(), self.version(), self.build_id())
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/metadata.py", line 104, in name
return self.get_value('package/name').lower()
AttributeError: 'NoneType' object has no attribute 'lower'

# Fixed code
def name(self):
    res = self.get_value("package/name")
    if not res:
        sys.exit("Error: package/name missing in: %r" % self.meta_path)
    res = str(res)
    if res != res.lower():
        sys.exit("Error: package/name must be lowercase, got: %r" % res)
    return res
# Buggy code
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        "update",
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )

    p.add_argument(
        "-n",
        "--name",
        action="store",
        help="name of environment (in %s)" % os.pathsep.join(config.envs_dirs),
        default=None,
    )

    p.add_argument(
        "-f",
        "--file",
        action="store",
        help="environment definition (default: environment.yml)",
        default="environment.yml",
    )
    p.add_argument(
        "-q",
        "--quiet",
        default=False,
    )
    common.add_parser_json(p)
    p.set_defaults(func=execute)


# Traceback (OSError)
Traceback (most recent call last):
File "/Users/aaronmeurer/anaconda/bin/conda", line 5, in <module>
sys.exit(main())
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/cli/main.py", line 109, in main
args.func(args, p)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/cli/main_build.py", line 52, in execute
build.build(m)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/build.py", line 135, in build
post_process()
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/post.py", line 96, in post_process
rm_egg_dirs()
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/post.py", line 66, in rm_egg_dirs
os.rename(join(egg_dir, fn), join(sp_dir, fn))
OSError: [Errno 66] Directory not empty

# Fixed code
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        "update",
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )
    p.add_argument(
        "-n",
        "--name",
        action="store",
        help="name of environment (in %s)" % os.pathsep.join(config.envs_dirs),
        default=None,
    )
    p.add_argument(
        "-f",
        "--file",
        action="store",
        help="environment definition (default: environment.yml)",
        default="environment.yml",
    )
    p.add_argument(
        "-q",
        "--quiet",
        default=False,
    )
    p.add_argument(
        "remote_definition",
        help="remote environment definition / IPython notebook",
        action="store",
        default=None,
        nargs="?",
    )
    common.add_parser_json(p)
    p.set_defaults(func=execute)
# Buggy code
def create_parser():
    p = argparse.ArgumentParser()
    sub_parsers = p.add_subparsers()

    main_attach.configure_parser(sub_parsers)
    main_create.configure_parser(sub_parsers)
    main_export.configure_parser(sub_parsers)
    main_list.configure_parser(sub_parsers)
    main_remove.configure_parser(sub_parsers)
    main_upload.configure_parser(sub_parsers)
    main_update.configure_parser(sub_parsers)

    show_help_on_empty_command()
    return p


# Traceback (Exception)
File "/Users/aaronmeurer/anaconda/bin/conda", line 5, in <module>
sys.exit(main())
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/cli/main.py", line 109, in main
args.func(args, p)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/cli/main_build.py", line 52, in execute
build.build(m)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/build.py", line 155, in build
tarcheck.check_all(path)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/tarcheck.py", line 56, in check_all
x.index_json()
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/tarcheck.py", line 49, in index_json
getattr(self, varname)))
Exception: version: 0.4 != '0.4'

# Fixed code
def create_parser():
    p = ArgumentParser()
    sub_parsers = p.add_subparsers()

    main_attach.configure_parser(sub_parsers)
    main_create.configure_parser(sub_parsers)
    main_export.configure_parser(sub_parsers)
    main_list.configure_parser(sub_parsers)
    main_remove.configure_parser(sub_parsers)
    main_upload.configure_parser(sub_parsers)
    main_update.configure_parser(sub_parsers)

    show_help_on_empty_command()
    return p
# Buggy code
def parse(self):
    if not self.raw:
        return

    self.update({"conda": []})

    for line in self.raw:
        if type(line) is dict:
            self.update(line)
        else:
            self["conda"].append(common.arg2spec(line))


# Traceback (Exception)
File "/Users/aaronmeurer/anaconda/bin/conda", line 5, in <module>
sys.exit(main())
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/cli/main.py", line 109, in main
args.func(args, p)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/cli/main_build.py", line 52, in execute
build.build(m)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/build.py", line 155, in build
tarcheck.check_all(path)
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/tarcheck.py", line 56, in check_all
x.index_json()
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/builder/tarcheck.py", line 49, in index_json
getattr(self, varname)))
Exception: version: 0.4 != '0.4'

# Fixed code
def parse(self):
    if not self.raw:
        return

    self.update({"conda": []})

    for line in self.raw:
        if isinstance(line, dict):
            self.update(line)
        else:
            self["conda"].append(common.arg2spec(line))