gurudesh/pytracebugs huggingface dataset:
# Buggy code
def get_scm(conanfile, src_folder):
    data = getattr(conanfile, "scm", None)
    if data is not None:
        return SCM(data, src_folder)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/conan-1.4.2-py2.7.egg/conans/client/command.py", line 1182, in run
method(args[0][1:])
File "/usr/local/lib/python2.7/dist-packages/conan-1.4.2-py2.7.egg/conans/client/command.py", line 246, in create
test_build_folder=args.test_build_folder)
File "/usr/local/lib/python2.7/dist-packages/conan-1.4.2-py2.7.egg/conans/client/conan_api.py", line 77, in wrapper
return f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/conan-1.4.2-py2.7.egg/conans/client/conan_api.py", line 310, in create
self._user_io.out, self._client_cache)
File "/usr/local/lib/python2.7/dist-packages/conan-1.4.2-py2.7.egg/conans/client/cmd/export.py", line 61, in cmd_export
_export_conanfile(conanfile_path, output, client_cache, conanfile, conan_ref, keep_source)
File "/usr/local/lib/python2.7/dist-packages/conan-1.4.2-py2.7.egg/conans/client/cmd/export.py", line 136, in _export_conanfile
output, paths, conan_ref)
File "/usr/local/lib/python2.7/dist-packages/conan-1.4.2-py2.7.egg/conans/client/cmd/export.py", line 107, in _capture_export_scm_data
scm = get_scm(conanfile, src_path)
File "/usr/local/lib/python2.7/dist-packages/conan-1.4.2-py2.7.egg/conans/client/source.py", line 18, in get_scm
return SCM(data, src_folder)
File "/usr/local/lib/python2.7/dist-packages/conan-1.4.2-py2.7.egg/conans/model/scm.py", line 13, in __init__
self.type = data.get("type")
AttributeError: 'property' object has no attribute 'get'

# Fixed code
def get_scm(conanfile, src_folder):
    data = getattr(conanfile, "scm", None)
    if data is not None and isinstance(data, dict):
        return SCM(data, src_folder)
    else:
        # not an instance of dict or None, skip SCM feature.
        pass
# Buggy code
def loads(cls, text):
    result = []
    for line in text.splitlines():
        if not line.strip():
            continue
        name, value = line.split("=")
        result.append((name.strip(), value.strip()))
    return cls.from_list(result)


# Traceback (ValueError)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): artifactory.avira.org
DEBUG:urllib3.connectionpool:<artifactory-url> "GET /artifactory/api/conan/conan-local/v1/conans/<dependency-of-the-recipe>/download_urls HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:<artifactory-url> "GET /artifactory/api/conan/conan-local/v1/files/<dependency-of-the-recipe>/conaninfo.txt HTTP/1.1" 200 1197
Traceback (most recent call last):
File "/Users/user/venv/lib/python3.6/site-packages/conans/client/remote_manager.py", line 252, in _call_remote
return getattr(self._auth_manager, method)(*argc, **argv)
File "/Users/user/venv/lib/python3.6/site-packages/conans/client/rest/auth_manager.py", line 32, in wrapper
ret = func(self, *args, **kwargs)
File "/Users/user/venv/lib/python3.6/site-packages/conans/client/rest/auth_manager.py", line 157, in get_package_info
return self._rest_client.get_package_info(package_reference)
File "/Users/user/venv/lib/python3.6/site-packages/conans/client/rest/rest_client.py", line 132, in get_package_info
return ConanInfo.loads(contents[CONANINFO])
File "/Users/user/venv/lib/python3.6/site-packages/conans/model/info.py", line 264, in loads
result.settings = Values.loads(parser.settings)
File "/Users/user/venv/lib/python3.6/site-packages/conans/model/values.py", line 66, in loads
name, value = line.split("=")
ValueError: too many values to unpack (expected 2)

# Fixed code
def loads(cls, text):
    result = []
    for line in text.splitlines():
        if not line.strip():
            continue
        name, value = line.split("=", 1)
        result.append((name.strip(), value.strip()))
    return cls.from_list(result)
# Buggy code
def _parse_manifests_arguments(verify, manifests, manifests_interactive, cwd):
    if manifests and manifests_interactive:
        raise ConanException(
            "Do not specify both manifests and manifests-interactive arguments"
        )
    if verify and (manifests or manifests_interactive):
        raise ConanException(
            "Do not specify both 'verify' and "
            "'manifests' or 'manifests-interactive' arguments"
        )
    manifest_folder = verify or manifests or manifests_interactive
    if manifest_folder:
        if not os.path.isabs(manifest_folder):
            manifest_folder = os.path.join(cwd, manifest_folder)
        manifest_verify = verify is not None
        manifest_interactive = manifests_interactive is not None
    else:
        manifest_verify = manifest_interactive = False

    return manifest_folder, manifest_interactive, manifest_verify


# Traceback (conans.errors.ConanException)
Traceback (most recent call last):
File "./uploadRecipe.py", line 93, in <module>
conan.create(profile_name=args.profile, user=args.user, channel=args.channel, build='missing', cwd=args.recipe)
File "/opt/venv-conan3/lib/python3.5/site-packages/conans/client/conan_api.py", line 56, in wrapper
return f(*args, **kwargs)
File "/opt/venv-conan3/lib/python3.5/site-packages/conans/client/conan_api.py", line 288, in create
manifests = _parse_manifests_arguments(verify, manifests, manifests_interactive, cwd)
File "/opt/venv-conan3/lib/python3.5/site-packages/conans/client/conan_api.py", line 656, in _parse_manifests_arguments
raise ConanException("Do not specify both manifests and "
conans.errors.ConanException: Do not specify both manifests and manifests-interactive arguments

# Fixed code
def _parse_manifests_arguments(verify, manifests, manifests_interactive, cwd):
    if manifests and manifests_interactive:
        raise ConanException(
            "Do not specify both manifests and manifests-interactive arguments"
        )
    if verify and (manifests or manifests_interactive):
        raise ConanException(
            "Do not specify both 'verify' and "
            "'manifests' or 'manifests-interactive' arguments"
        )
    manifest_folder = verify or manifests or manifests_interactive
    if manifest_folder:
        if not os.path.isabs(manifest_folder):
            if not cwd:
                raise ConanException(
                    "'cwd' should be defined if the manifest folder is relative."
                )
            manifest_folder = os.path.join(cwd, manifest_folder)
        manifest_verify = verify is not None
        manifest_interactive = manifests_interactive is not None
    else:
        manifest_verify = manifest_interactive = False

    return manifest_folder, manifest_interactive, manifest_verify
# Buggy code
def loads(text):
    """parses a multiline text in the form
    Package:option=value
    other_option=3
    OtherPack:opt3=12.1
    """
    result = []
    for line in text.splitlines():
        line = line.strip()
        if not line:
            continue
        name, value = line.split("=")
        result.append((name.strip(), value.strip()))
    return OptionsValues(result)


# Traceback (ValueError)
Traceback (most recent call last):
File "/usr/local/bin/conan", line 9, in <module>
load_entry_point('conan==0.22.3', 'console_scripts', 'conan')()
File "/usr/local/lib/python3.5/dist-packages/conans/conan.py", line 6, in run
main(sys.argv[1:])
File "/usr/local/lib/python3.5/dist-packages/conans/client/command.py", line 1047, in main
error = command.run(args)
File "/usr/local/lib/python3.5/dist-packages/conans/client/command.py", line 862, in run
raise exc
File "/usr/local/lib/python3.5/dist-packages/conans/client/command.py", line 840, in run
method(args[0][1:])
File "/usr/local/lib/python3.5/dist-packages/conans/client/command.py", line 310, in install
no_imports=args.no_imports)
File "/usr/local/lib/python3.5/dist-packages/conans/client/manager.py", line 258, in install
conanfile = self._get_conanfile_object(loader, reference, filename, current_path)
File "/usr/local/lib/python3.5/dist-packages/conans/client/manager.py", line 147, in _get_conanfile_object
conanfile = loader.load_conan_txt(conan_path, output)
File "/usr/local/lib/python3.5/dist-packages/conans/client/loader.py", line 109, in load_conan_txt
conanfile = self._parse_conan_txt(contents, path, output)
File "/usr/local/lib/python3.5/dist-packages/conans/client/loader.py", line 129, in _parse_conan_txt
options = OptionsValues.loads(parser.options)
File "/usr/local/lib/python3.5/dist-packages/conans/model/options.py", line 242, in loads
name, value = line.split("=")
ValueError: too many values to unpack (expected 2)

# Fixed code
def loads(text):
    """parses a multiline text in the form
    Package:option=value
    other_option=3
    OtherPack:opt3=12.1
    """
    result = []
    for line in text.splitlines():
        line = line.strip()
        if not line:
            continue
        name, value = line.split("=", 1)
        result.append((name.strip(), value.strip()))
    return OptionsValues(result)
# Buggy code
def _match_manifests(self, read_manifest, expected_manifest, reference):
    if read_manifest is None or read_manifest.file_sums != expected_manifest.file_sums:
        raise ConanException(
            "%s local cache package is corrupted: "
            "some file hash doesn't match manifest" % (str(reference))
        )


# Traceback (KeyError)
D:\slave\ws\cab\extern\boost\1.63.0@0\ws>conan.exe upload "Boost/1.63.0@cab/extern" --all --confirm -r bop --retry 3
Uploading Boost/1.63.0@cab/extern

Compressing recipe...
Uploading conanmanifest.txt


Uploading conan_export.tgz

Uploaded conan recipe 'Boost/1.63.0@cab/extern' to 'bop': http://conan.bop
Uploading package 1/5: 4f0fd3886115d238859ac2a3d41664e4236efc61

Checking package integrity...
Package integrity OK!

Compressing package...
Requesting upload permissions...
Requesting upload permissions...Done!

Uploading conan_package.tgz

Uploading package 2/5: 5d34366328ff5fe8b9f93b912e5855ffb5fda596

Checking package integrity...
Traceback (most recent call last):
File "C:\Python34\Scripts\conan-script.py", line 9, in <module>
load_entry_point('conan==0.19.2', 'console_scripts', 'conan')()
File "C:\Python34\lib\site-packages\conans\conan.py", line 6, in run
main(sys.argv[1:])
File "C:\Python34\lib\site-packages\conans\client\command.py", line 1065, in main
error = command.run(args)
File "C:\Python34\lib\site-packages\conans\client\command.py", line 979, in run
raise exc
File "C:\Python34\lib\site-packages\conans\client\command.py", line 959, in run
method(args[0][1:])
File "C:\Python34\lib\site-packages\conans\client\command.py", line 826, in upload
retry_wait=args.retry_wait)
File "C:\Python34\lib\site-packages\conans\client\manager.py", line 540, in upload
retry=retry, retry_wait=retry_wait)
File "C:\Python34\lib\site-packages\conans\client\uploader.py", line 41, in upload_conan
self._upload_conan(conan_ref, force, all_packages, retry, retry_wait)
File "C:\Python34\lib\site-packages\conans\client\uploader.py", line 56, in _upload_conan
retry, retry_wait)
File "C:\Python34\lib\site-packages\conans\client\uploader.py", line 76, in upload_package
self._remote_proxy.upload_package(package_ref, retry, retry_wait)
File "C:\Python34\lib\site-packages\conans\client\proxy.py", line 295, in upload_package
result = self._remote_manager.upload_package(package_ref, remote, retry, retry_wait)
File "C:\Python34\lib\site-packages\conans\client\remote_manager.py", line 77, in upload_package
if read_manifest.file_sums[fname] != expected_manifest.file_sums[fname]:
KeyError: 'include/boost/asio/ip/unicast.hpp'

# Fixed code
def _match_manifests(self, read_manifest, expected_manifest, reference):
    if read_manifest is None or read_manifest != expected_manifest:
        raise ConanException(
            "%s local cache package is corrupted: "
            "some file hash doesn't match manifest" % (str(reference))
        )
# Buggy code
def __eq__(self, other):
    return self.time == other.time and self.file_sums == other.file_sums


# Traceback (KeyError)
D:\slave\ws\cab\extern\boost\1.63.0@0\ws>conan.exe upload "Boost/1.63.0@cab/extern" --all --confirm -r bop --retry 3
Uploading Boost/1.63.0@cab/extern

Compressing recipe...
Uploading conanmanifest.txt


Uploading conan_export.tgz

Uploaded conan recipe 'Boost/1.63.0@cab/extern' to 'bop': http://conan.bop
Uploading package 1/5: 4f0fd3886115d238859ac2a3d41664e4236efc61

Checking package integrity...
Package integrity OK!

Compressing package...
Requesting upload permissions...
Requesting upload permissions...Done!

Uploading conan_package.tgz

Uploading package 2/5: 5d34366328ff5fe8b9f93b912e5855ffb5fda596

Checking package integrity...
Traceback (most recent call last):
File "C:\Python34\Scripts\conan-script.py", line 9, in <module>
load_entry_point('conan==0.19.2', 'console_scripts', 'conan')()
File "C:\Python34\lib\site-packages\conans\conan.py", line 6, in run
main(sys.argv[1:])
File "C:\Python34\lib\site-packages\conans\client\command.py", line 1065, in main
error = command.run(args)
File "C:\Python34\lib\site-packages\conans\client\command.py", line 979, in run
raise exc
File "C:\Python34\lib\site-packages\conans\client\command.py", line 959, in run
method(args[0][1:])
File "C:\Python34\lib\site-packages\conans\client\command.py", line 826, in upload
retry_wait=args.retry_wait)
File "C:\Python34\lib\site-packages\conans\client\manager.py", line 540, in upload
retry=retry, retry_wait=retry_wait)
File "C:\Python34\lib\site-packages\conans\client\uploader.py", line 41, in upload_conan
self._upload_conan(conan_ref, force, all_packages, retry, retry_wait)
File "C:\Python34\lib\site-packages\conans\client\uploader.py", line 56, in _upload_conan
retry, retry_wait)
File "C:\Python34\lib\site-packages\conans\client\uploader.py", line 76, in upload_package
self._remote_proxy.upload_package(package_ref, retry, retry_wait)
File "C:\Python34\lib\site-packages\conans\client\proxy.py", line 295, in upload_package
result = self._remote_manager.upload_package(package_ref, remote, retry, retry_wait)
File "C:\Python34\lib\site-packages\conans\client\remote_manager.py", line 77, in upload_package
if read_manifest.file_sums[fname] != expected_manifest.file_sums[fname]:
KeyError: 'include/boost/asio/ip/unicast.hpp'

# Fixed code
def __eq__(self, other):
    """Two manifests are equal if file_sums"""
    return self.file_sums == other.file_sums
# Buggy code
def migrate_and_get_client_cache(base_folder, out, manager, storage_folder=None):
    # Init paths
    client_cache = ClientCache(base_folder, storage_folder, out)

    # Migration system
    migrator = ClientMigrator(client_cache, Version(CLIENT_VERSION), out, manager)
    migrator.migrate()

    # Init again paths, migration could change config
    client_cache = ClientCache(base_folder, storage_folder, out)
    return client_cache


# Traceback (sqlite3.OperationalError)
Traceback (most recent call last):
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\sqlite.py", line 20, in init
statement.execute("PRAGMA auto_vacuum = INCREMENTAL;")
sqlite3.OperationalError: database is locked

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\Scripts\conan-script.py", line 11, in <module>
load_entry_point('conan==0.17.2', 'console_scripts', 'conan')()
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\conan.py", line 6, in run
main(sys.argv[1:])
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\command.py", line 963, in main
command = get_command()
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\command.py", line 950, in get_command
remote_manager = instance_remote_manager(client_cache)
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\command.py", line 914, in instance_remote_manager
localdb = LocalDB(client_cache.localdb)
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\localdb.py", line 14, in __init__
self.init()
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\localdb.py", line 17, in init
SQLiteDB.init(self)
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\sqlite.py", line 22, in init
raise ConanException("Could not initialize local cache", e)
conans.errors.ConanException: ('Could not initialize local cache', OperationalError('database is locked',))

# Fixed code
def migrate_and_get_client_cache(base_folder, out, storage_folder=None):
    # Init paths
    client_cache = ClientCache(base_folder, storage_folder, out)

    # Migration system
    migrator = ClientMigrator(client_cache, Version(CLIENT_VERSION), out)
    migrator.migrate()

    return client_cache
# Buggy code
def __init__(self, client_cache, current_version, out, manager):
    self.client_cache = client_cache
    self.manager = manager
    super(ClientMigrator, self).__init__(
        client_cache.conan_folder, client_cache.store, current_version, out
    )


# Traceback (sqlite3.OperationalError)
Traceback (most recent call last):
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\sqlite.py", line 20, in init
statement.execute("PRAGMA auto_vacuum = INCREMENTAL;")
sqlite3.OperationalError: database is locked

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\Scripts\conan-script.py", line 11, in <module>
load_entry_point('conan==0.17.2', 'console_scripts', 'conan')()
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\conan.py", line 6, in run
main(sys.argv[1:])
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\command.py", line 963, in main
command = get_command()
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\command.py", line 950, in get_command
remote_manager = instance_remote_manager(client_cache)
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\command.py", line 914, in instance_remote_manager
localdb = LocalDB(client_cache.localdb)
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\localdb.py", line 14, in __init__
self.init()
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\localdb.py", line 17, in init
SQLiteDB.init(self)
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\sqlite.py", line 22, in init
raise ConanException("Could not initialize local cache", e)
conans.errors.ConanException: ('Could not initialize local cache', OperationalError('database is locked',))

# Fixed code
def __init__(self, client_cache, current_version, out):
    self.client_cache = client_cache
    super(ClientMigrator, self).__init__(
        client_cache.conan_folder, client_cache.store, current_version, out
    )
# Buggy code
def init(self, clean=False):
    SQLiteDB.init(self)
    cursor = None
    try:
        cursor = self.connection.cursor()
        # conan retrocompatibility
        cursor.execute("drop table if exists %s" % USER_TABLE)
        if clean:
            cursor.execute("drop table if exists %s" % REMOTES_USER_TABLE)
        cursor.execute(
            "create table if not exists %s "
            "(remote_url TEXT UNIQUE, user TEXT, token TEXT)" % REMOTES_USER_TABLE
        )
    except Exception as e:
        message = "Could not initialize local sqlite database"
        raise ConanException(message, e)
    finally:
        if cursor:
            cursor.close()


# Traceback (sqlite3.OperationalError)
Traceback (most recent call last):
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\sqlite.py", line 20, in init
statement.execute("PRAGMA auto_vacuum = INCREMENTAL;")
sqlite3.OperationalError: database is locked

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\Scripts\conan-script.py", line 11, in <module>
load_entry_point('conan==0.17.2', 'console_scripts', 'conan')()
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\conan.py", line 6, in run
main(sys.argv[1:])
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\command.py", line 963, in main
command = get_command()
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\command.py", line 950, in get_command
remote_manager = instance_remote_manager(client_cache)
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\command.py", line 914, in instance_remote_manager
localdb = LocalDB(client_cache.localdb)
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\localdb.py", line 14, in __init__
self.init()
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\localdb.py", line 17, in init
SQLiteDB.init(self)
File "C:\Users\sztomi\AppData\Roaming\Python\Python36\site-packages\conans\client\store\sqlite.py", line 22, in init
raise ConanException("Could not initialize local cache", e)
conans.errors.ConanException: ('Could not initialize local cache', OperationalError('database is locked',))

# Fixed code
def init(self, clean=False):
    cursor = None
    try:
        cursor = self.connection.cursor()
        if clean:
            cursor.execute("drop table if exists %s" % REMOTES_USER_TABLE)
        cursor.execute(
            "create table if not exists %s "
            "(remote_url TEXT UNIQUE, user TEXT, token TEXT)" % REMOTES_USER_TABLE
        )
    except Exception as e:
        message = "Could not initialize local sqlite database"
        raise ConanException(message, e)
    finally:
        if cursor:
            cursor.close()
# Buggy code
def add(self, reference, private=False, override=False, dev=False):
    """to define requirements by the user in text, prior to any propagation"""
    assert isinstance(reference, six.string_types)
    if dev and not self.allow_dev:
        return

    conan_reference = ConanFileReference.loads(reference)
    name = conan_reference.name

    new_requirement = Requirement(conan_reference, private, override, dev)
    old_requirement = self.get(name)
    if old_requirement and old_requirement != new_requirement:
        self.output.werror(
            "Duplicated requirement %s != %s" % (old_requirement, new_requirement)
        )
    else:
        self[name] = new_requirement


# Traceback (AttributeError)
Traceback (most recent call last):
File "<string>", line 10, in <module>
File "<string>", line 6, in run
File "conan\conans\client\command.py", line 931, in main
File "conan\conans\client\command.py", line 833, in run
File "conan\conans\client\command.py", line 441, in install
File "conan\conans\client\manager.py", line 276, in install
File "conan\conans\client\manager.py", line 176, in _get_graph
File "conan\conans\client\loader.py", line 181, in load_conan_txt
File "conan\conans\client\loader.py", line 193, in parse_conan_txt
File "conan\conans\model\requires.py", line 121, in add
AttributeError: 'NoneType' object has no attribute 'werror'
conan returned -1

# Fixed code
def add(self, reference, private=False, override=False, dev=False):
    """to define requirements by the user in text, prior to any propagation"""
    assert isinstance(reference, six.string_types)
    if dev and not self.allow_dev:
        return

    conan_reference = ConanFileReference.loads(reference)
    name = conan_reference.name

    new_requirement = Requirement(conan_reference, private, override, dev)
    old_requirement = self.get(name)
    if old_requirement and old_requirement != new_requirement:
        raise ConanException(
            "Duplicated requirement %s != %s" % (old_requirement, new_requirement)
        )
    else:
        self[name] = new_requirement
# Buggy code
def _create_new_node(self, current_node, dep_graph, requirement, public_deps, name_req):
    """creates and adds a new node to the dependency graph"""
    conanfile_path = self._retriever.get_conanfile(requirement.conan_reference)
    output = ScopedOutput(str(requirement.conan_reference), self._output)
    dep_conanfile = self._loader.load_conan(conanfile_path, output)
    if dep_conanfile:
        new_node = Node(requirement.conan_reference, dep_conanfile)
        dep_graph.add_node(new_node)
        dep_graph.add_edge(current_node, new_node)
        if not requirement.private:
            public_deps[name_req] = new_node
        # RECURSION!
        return new_node
    else:
        self._output.error("Could not retrieve %s" % requirement.conan_reference)


# Traceback (exceptions.MemoryError)
DEBUG :uploader_downloader.py[74]: <type 'exceptions.MemoryError'> [2016-09-23 15:15:02,983]
DEBUG :uploader_downloader.py[75]: Traceback (most recent call last):
File "c:\python27\lib\site-packages\conans\client\rest\uploader_downloader.py", line 62, in download
ret.extend(data)
MemoryError

# Fixed code
def _create_new_node(self, current_node, dep_graph, requirement, public_deps, name_req):
    """creates and adds a new node to the dependency graph"""
    conanfile_path = self._retriever.get_recipe(requirement.conan_reference)
    output = ScopedOutput(str(requirement.conan_reference), self._output)
    dep_conanfile = self._loader.load_conan(conanfile_path, output)
    if dep_conanfile:
        new_node = Node(requirement.conan_reference, dep_conanfile)
        dep_graph.add_node(new_node)
        dep_graph.add_edge(current_node, new_node)
        if not requirement.private:
            public_deps[name_req] = new_node
        # RECURSION!
        return new_node
    else:
        self._output.error("Could not retrieve %s" % requirement.conan_reference)
# Buggy code
def download_packages(self, reference, package_ids):
    assert isinstance(package_ids, list)
    remote, _ = self._get_remote(reference)
    self._remote_manager.get_conanfile(reference, remote)
    self._registry.set_ref(reference, remote)
    output = ScopedOutput(str(reference), self._out)
    for package_id in package_ids:
        package_reference = PackageReference(reference, package_id)
        self._retrieve_remote_package(package_reference, output, remote)


# Traceback (exceptions.MemoryError)
DEBUG :uploader_downloader.py[74]: <type 'exceptions.MemoryError'> [2016-09-23 15:15:02,983]
DEBUG :uploader_downloader.py[75]: Traceback (most recent call last):
File "c:\python27\lib\site-packages\conans\client\rest\uploader_downloader.py", line 62, in download
ret.extend(data)
MemoryError

# Fixed code
def download_packages(self, reference, package_ids):
    assert isinstance(package_ids, list)
    remote, _ = self._get_remote(reference)
    export_path = self._client_cache.export(reference)
    self._remote_manager.get_recipe(reference, export_path, remote)
    self._registry.set_ref(reference, remote)
    output = ScopedOutput(str(reference), self._out)
    for package_id in package_ids:
        package_reference = PackageReference(reference, package_id)
        self._retrieve_remote_package(package_reference, output, remote)
# Buggy code
def _retrieve_remote_package(self, package_reference, output, remote=None):
    if remote is None:
        remote = self._registry.get_ref(package_reference.conan)
    if not remote:
        output.warn(
            "Package doesn't have a remote defined. "
            "Probably created locally and not uploaded"
        )
        return False
    package_id = str(package_reference.package_id)
    try:
        output.info(
            "Looking for package %s in remote '%s' " % (package_id, remote.name)
        )
        # Will raise if not found NotFoundException
        self._remote_manager.get_package(package_reference, remote)
        output.success("Package installed %s" % package_id)
        return True
    except ConanConnectionError:
        raise  # This shouldn't be skipped
    except ConanException as e:
        output.warn("Binary for %s not in remote: %s" % (package_id, str(e)))
        return False


# Traceback (exceptions.MemoryError)
DEBUG :uploader_downloader.py[74]: <type 'exceptions.MemoryError'> [2016-09-23 15:15:02,983]
DEBUG :uploader_downloader.py[75]: Traceback (most recent call last):
File "c:\python27\lib\site-packages\conans\client\rest\uploader_downloader.py", line 62, in download
ret.extend(data)
MemoryError

# Fixed code
def _retrieve_remote_package(self, package_reference, output, remote=None):
    if remote is None:
        remote = self._registry.get_ref(package_reference.conan)
    if not remote:
        output.warn(
            "Package doesn't have a remote defined. "
            "Probably created locally and not uploaded"
        )
        return False
    package_id = str(package_reference.package_id)
    try:
        output.info(
            "Looking for package %s in remote '%s' " % (package_id, remote.name)
        )
        # Will raise if not found NotFoundException
        package_path = self._client_cache.package(package_reference)
        self._remote_manager.get_package(package_reference, package_path, remote)
        output.success("Package installed %s" % package_id)
        return True
    except ConanConnectionError:
        raise  # This shouldn't be skipped
    except ConanException as e:
        output.warn("Binary for %s not in remote: %s" % (package_id, str(e)))
        return False
# Buggy code
def _refresh():
    conan_dir_path = self._client_cache.export(conan_reference)
    rmdir(conan_dir_path)
    # It might need to remove shortpath
    rmdir(self._client_cache.source(conan_reference), True)
    current_remote, _ = self._get_remote(conan_reference)
    output.info("Retrieving from remote '%s'..." % current_remote.name)
    self._remote_manager.get_conanfile(conan_reference, current_remote)
    if self._update:
        output.info("Updated!")
    else:
        output.info("Installed!")


# Traceback (exceptions.MemoryError)
DEBUG :uploader_downloader.py[74]: <type 'exceptions.MemoryError'> [2016-09-23 15:15:02,983]
DEBUG :uploader_downloader.py[75]: Traceback (most recent call last):
File "c:\python27\lib\site-packages\conans\client\rest\uploader_downloader.py", line 62, in download
ret.extend(data)
MemoryError

# Fixed code
def _refresh():
    export_path = self._client_cache.export(conan_reference)
    rmdir(export_path)
    # It might need to remove shortpath
    rmdir(self._client_cache.source(conan_reference), True)
    current_remote, _ = self._get_remote(conan_reference)
    output.info("Retrieving from remote '%s'..." % current_remote.name)
    self._remote_manager.get_recipe(conan_reference, export_path, current_remote)
    if self._update:
        output.info("Updated!")
    else:
        output.info("Installed!")
# Buggy code
def _retrieve_from_remote(remote):
    output.info("Trying with '%s'..." % remote.name)
    result = self._remote_manager.get_conanfile(conan_reference, remote)
    self._registry.set_ref(conan_reference, remote)
    return result


# Traceback (exceptions.MemoryError)
DEBUG :uploader_downloader.py[74]: <type 'exceptions.MemoryError'> [2016-09-23 15:15:02,983]
DEBUG :uploader_downloader.py[75]: Traceback (most recent call last):
File "c:\python27\lib\site-packages\conans\client\rest\uploader_downloader.py", line 62, in download
ret.extend(data)
MemoryError

# Fixed code
def _retrieve_from_remote(remote):
    output.info("Trying with '%s'..." % remote.name)
    export_path = self._client_cache.export(conan_reference)
    result = self._remote_manager.get_recipe(conan_reference, export_path, remote)
    self._registry.set_ref(conan_reference, remote)
    return result
# Buggy code
def get_package(self, package_reference, remote):
    """
    Read the conans package from remotes
    Will iterate the remotes to find the conans unless remote was specified

    returns (dict relative_filepath:content , remote_name)"""
    package_files = self._call_remote(remote, "get_package", package_reference)
    destination_dir = self._client_cache.package(package_reference)
    uncompress_files(package_files, destination_dir, PACKAGE_TGZ_NAME)

    # Issue #214 https://github.com/conan-io/conan/issues/214
    for dirname, _, files in os.walk(destination_dir):
        for fname in files:
            touch(os.path.join(dirname, fname))


# Traceback (exceptions.MemoryError)
DEBUG :uploader_downloader.py[74]: <type 'exceptions.MemoryError'> [2016-09-23 15:15:02,983]
DEBUG :uploader_downloader.py[75]: Traceback (most recent call last):
File "c:\python27\lib\site-packages\conans\client\rest\uploader_downloader.py", line 62, in download
ret.extend(data)
MemoryError

# Fixed code
def get_package(self, package_reference, dest_folder, remote):
    """
    Read the conans package from remotes
    Will iterate the remotes to find the conans unless remote was specified

    returns (dict relative_filepath:abs_path , remote_name)"""
    zipped_files = self._call_remote(
        remote, "get_package", package_reference, dest_folder
    )
    files = unzip_and_get_files(zipped_files, dest_folder, PACKAGE_TGZ_NAME)
    # Issue #214 https://github.com/conan-io/conan/issues/214
    for dirname, _, files in os.walk(dest_folder):
        for fname in files:
            touch(os.path.join(dirname, fname))

    return files
# Buggy code
def get_package(self, package_reference):
    return self._rest_client.get_package(package_reference)


# Traceback (exceptions.MemoryError)
DEBUG :uploader_downloader.py[74]: <type 'exceptions.MemoryError'> [2016-09-23 15:15:02,983]
DEBUG :uploader_downloader.py[75]: Traceback (most recent call last):
File "c:\python27\lib\site-packages\conans\client\rest\uploader_downloader.py", line 62, in download
ret.extend(data)
MemoryError

# Fixed code
def get_package(self, package_reference, dest_folder):
    return self._rest_client.get_package(package_reference, dest_folder)
# Buggy code
def get_package(self, package_reference):
    """Gets a dict of filename:contents from package"""
    url = "%s/conans/%s/packages/%s/download_urls" % (
        self._remote_api_url,
        "/".join(package_reference.conan),
        package_reference.package_id,
    )
    urls = self._get_json(url)
    if not urls:
        raise NotFoundException("Package not found!")
    # TODO: Get fist an snapshot and compare files and download only required?

    # Download the resources
    contents = self.download_files(urls, self._output)
    return contents


# Traceback (exceptions.MemoryError)
DEBUG :uploader_downloader.py[74]: <type 'exceptions.MemoryError'> [2016-09-23 15:15:02,983]
DEBUG :uploader_downloader.py[75]: Traceback (most recent call last):
File "c:\python27\lib\site-packages\conans\client\rest\uploader_downloader.py", line 62, in download
ret.extend(data)
MemoryError

# Fixed code
def get_package(self, package_reference, dest_folder):
    """Gets a dict of filename:contents from package"""
    url = "%s/conans/%s/packages/%s/download_urls" % (
        self._remote_api_url,
        "/".join(package_reference.conan),
        package_reference.package_id,
    )
    urls = self._get_json(url)
    if not urls:
        raise NotFoundException("Package not found!")
    # TODO: Get fist an snapshot and compare files and download only required?

    # Download the resources
    file_paths = self.download_files_to_folder(urls, dest_folder, self._output)
    return file_paths
# Buggy code
def run(self, *args):
    """HIDDEN: entry point for executing commands, dispatcher to class
    methods
    """
    errors = False
    try:
        try:
            command = args[0][0]
            commands = self._commands()
            method = commands[command]
        except KeyError as exc:
            if command in ["-v", "--version"]:
                self._user_io.out.success("Conan version %s" % CLIENT_VERSION)
                return False
            self._show_help()
            if command in ["-h", "--help"]:
                return False
            raise ConanException("Unknown command %s" % str(exc))
        except IndexError as exc:  # No parameters
            self._show_help()
            return False
        method(args[0][1:])
    except (KeyboardInterrupt, SystemExit) as exc:
        logger.error(exc)
        errors = True
    except ConanException as exc:
        logger.error(exc)
        #             import traceback
        #             logger.debug(traceback.format_exc())
        errors = True
        self._user_io.out.error(str(exc))

    return errors


# Traceback (UnicodeEncodeError)
conan install ..\test_package
Boost/1.60.0@lasote/stable: Not found, looking in remotes...
Boost/1.60.0@lasote/stable: Trying with 'conan.io'...
Traceback (most recent call last):
File "<string>", line 10, in <module>
File "<string>", line 6, in run
File "conan\conans\client\command.py", line 767, in main
File "conan\conans\client\command.py", line 688, in run
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 727: ordinal not in range(128)
conan returned -1

# Fixed code
def run(self, *args):
    """HIDDEN: entry point for executing commands, dispatcher to class
    methods
    """
    errors = False
    try:
        try:
            command = args[0][0]
            commands = self._commands()
            method = commands[command]
        except KeyError as exc:
            if command in ["-v", "--version"]:
                self._user_io.out.success("Conan version %s" % CLIENT_VERSION)
                return False
            self._show_help()
            if command in ["-h", "--help"]:
                return False
            raise ConanException("Unknown command %s" % str(exc))
        except IndexError as exc:  # No parameters
            self._show_help()
            return False
        method(args[0][1:])
    except (KeyboardInterrupt, SystemExit) as exc:
        logger.error(exc)
        errors = True
    except ConanException as exc:
        try:
            msg = unicode(exc)
        except:
            msg = str(exc)
        #             import traceback
        #             logger.debug(traceback.format_exc())
        errors = True
        self._user_io.out.error(msg)

    return errors
# Buggy code
def _get_json(self, url, data=None):
    if data:  # POST request
        headers = {"Content-type": "application/json", "Accept": "text/plain"}
        headers.update(self.custom_headers)
        response = self.requester.post(
            url,
            auth=self.auth,
            headers=headers,
            verify=self.VERIFY_SSL,
            stream=True,
            data=json.dumps(data),
        )
    else:
        response = self.requester.get(
            url,
            auth=self.auth,
            headers=self.custom_headers,
            verify=self.VERIFY_SSL,
            stream=True,
        )
    if response.status_code != 200:  # Error message is text
        response.charset = (
            "utf-8"  # To be able to access ret.text (ret.content are bytes)
        )
        raise get_exception_from_error(response.status_code)(response.text)

    return json.loads(decode_text(response.content))


# Traceback (UnicodeEncodeError)
conan install ..\test_package
Boost/1.60.0@lasote/stable: Not found, looking in remotes...
Boost/1.60.0@lasote/stable: Trying with 'conan.io'...
Traceback (most recent call last):
File "<string>", line 10, in <module>
File "<string>", line 6, in run
File "conan\conans\client\command.py", line 767, in main
File "conan\conans\client\command.py", line 688, in run
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 727: ordinal not in range(128)
conan returned -1

# Fixed code
def _get_json(self, url, data=None):
    if data:  # POST request
        headers = {"Content-type": "application/json", "Accept": "text/plain"}
        headers.update(self.custom_headers)
        response = self.requester.post(
            url,
            auth=self.auth,
            headers=headers,
            verify=self.VERIFY_SSL,
            stream=True,
            data=json.dumps(data),
        )
    else:
        response = self.requester.get(
            url,
            auth=self.auth,
            headers=self.custom_headers,
            verify=self.VERIFY_SSL,
            stream=True,
        )
    if response.status_code != 200:  # Error message is text
        response.charset = (
            "utf-8"  # To be able to access ret.text (ret.content are bytes)
        )
        raise get_exception_from_error(response.status_code)(response.text)

    result = json.loads(decode_text(response.content))
    if not isinstance(result, dict):
        raise ConanException("Unexpected server response %s" % result)
    return result
# Buggy code
def __init__(self, model, parent, factory, resource_defs, service_model):
    self._model = model
    operation_name = self._model.request.operation
    self._parent = parent

    search_path = model.path
    self._handler = ResourceHandler(
        search_path,
        factory,
        resource_defs,
        service_model,
        model.resource,
        operation_name,
    )


# Traceback (boto3.exceptions.ResourceLoadException)
Traceback (most recent call last):
File "./bug_report", line 10, in <module>
print o.size
File "/home/glacier/lib/lib/python2.7/site-packages/boto3/resources/factory.py", line 257, in property_loader
'{0} has no load method'.format(self.__class__.__name__))
boto3.exceptions.ResourceLoadException: s3.ObjectSummary has no load method

# Fixed code
def __init__(self, model, parent, factory, resource_defs, service_model):
    self._model = model
    operation_name = self._model.request.operation
    self._parent = parent

    search_path = model.resource.path
    self._handler = ResourceHandler(
        search_path,
        factory,
        resource_defs,
        service_model,
        model.resource,
        operation_name,
    )
# Buggy code
def _accept(self):
    """Listen for connections and pass handling to a new thread"""
    while True:
        (client, address) = self.sock.accept()
        thread = threading.Thread(target=self._handle_conn, args=(client, address))
        thread.daemon = True
        thread.start()


# Traceback (ConnectionAbortedError)
BaseAggregator       - INFO     - Received shutdown signal!
Exception in thread Thread-1-LocalListener:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/Users/awagner/mozilla/OpenWPM/automation/SocketInterface.py", line 43, in _accept
(client, address) = self.sock.accept()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 212, in accept
fd, addr = self._accept()
ConnectionAbortedError: [Errno 53] Software caused connection abort

Exception in thread Thread-1-loggingserver:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/Users/awagner/mozilla/OpenWPM/automation/SocketInterface.py", line 43, in _accept
(client, address) = self.sock.accept()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 212, in accept
fd, addr = self._accept()
ConnectionAbortedError: [Errno 53] Software caused connection abort

# Fixed code
def _accept(self):
    """Listen for connections and pass handling to a new thread"""
    while True:
        try:
            (client, address) = self.sock.accept()
            thread = threading.Thread(target=self._handle_conn, args=(client, address))
            thread.daemon = True
            thread.start()
        except ConnectionAbortedError:
            # Workaround for #278
            print("A connection establish request was performed on a closed socket")
            return
# Buggy code
def _accept(self):
    """Listen for connections and pass handling to a new thread"""
    while True:
        try:
            (client, address) = self.sock.accept()
            thread = threading.Thread(target=self._handle_conn, args=(client, address))
            thread.daemon = True
            thread.start()
        except ConnectionAbortedError:
            print("A connection establish request was performed on a closed socket")
            return


# Traceback (ConnectionAbortedError)
BaseAggregator       - INFO     - Received shutdown signal!
Exception in thread Thread-1-LocalListener:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/Users/awagner/mozilla/OpenWPM/automation/SocketInterface.py", line 43, in _accept
(client, address) = self.sock.accept()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 212, in accept
fd, addr = self._accept()
ConnectionAbortedError: [Errno 53] Software caused connection abort

Exception in thread Thread-1-loggingserver:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/Users/awagner/mozilla/OpenWPM/automation/SocketInterface.py", line 43, in _accept
(client, address) = self.sock.accept()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 212, in accept
fd, addr = self._accept()
ConnectionAbortedError: [Errno 53] Software caused connection abort

# Fixed code
def _accept(self):
    """Listen for connections and pass handling to a new thread"""
    while True:
        try:
            (client, address) = self.sock.accept()
            thread = threading.Thread(target=self._handle_conn, args=(client, address))
            thread.daemon = True
            thread.start()
        except ConnectionAbortedError:
            # Workaround for #278
            print("A connection establish request was performed on a closed socket")
            return
# Buggy code
def _find_url(self, known_keys: set, links: dict) -> str:
    intersection = known_keys.intersection(links)
    iterator = iter(intersection)
    key = next(iterator, None)
    return links.get(key, {}).get("href", None)


# Traceback (pynubank.exception.NuRequestException)
Traceback (most recent call last):
File ".\extrato-ofx2.py", line 53, in <module>
nubank_transactions = nu.get_card_statements()
File "C:\Users\danfc\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pynubank\nubank.py", line 123, in get_card_statements
feed = self.get_card_feed()
File "C:\Users\danfc\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pynubank\nubank.py", line 120, in get_card_feed
return self.client.get(self.feed_url)
File "C:\Users\danfc\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pynubank\utils\http.py", line 37, in get
return self._handle_response(get(url, headers=self._headers, **self._cert_args))
File "C:\Users\danfc\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pynubank\utils\http.py", line 32, in _handle_response
raise NuRequestException(response)
pynubank.exception.NuRequestException: The request made failed with HTTP status code 403

# Fixed code
def _find_url(self, known_keys: list, links: dict) -> str:
    links_keys = links.keys()
    common_keys = [item for item in links_keys if item in known_keys]
    key = next(iter(common_keys), None)
    return links.get(key, {}).get("href", None)