gurudesh/pytracebugs huggingface dataset:
# Buggy code
def has_objects(objects, additional_objects, generated_objects):
    # Ignore generated objects, those are automatically used by MSBuild for VS2010, because they are part of
    # the CustomBuildStep Outputs.
    return len(objects) + len(additional_objects) > 0


# Traceback (AttributeError)
Traceback (most recent call last):
File "C:\projects\meson\mesonbuild\mesonmain.py", line 279, in run
app.generate()
File "C:\projects\meson\mesonbuild\mesonmain.py", line 169, in generate
g.generate(intr)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 168, in generate
self.generate_solution(sln_filename, projlist)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 233, in generate_solution
all_deps = self.determine_deps(p)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 203, in determine_deps
all_deps[d.get_id()] = True
AttributeError: 'GeneratedList' object has no attribute 'get_id'

# Fixed code
def has_objects(objects, additional_objects, generated_objects):
    # Ignore generated objects, those are automatically used by MSBuild because they are part of
    # the CustomBuild Outputs.
    return len(objects) + len(additional_objects) > 0
# Buggy code
def add_generated_objects(node, generated_objects):
    # Do not add generated objects to project file. Those are automatically used by MSBuild for VS2010, because
    # they are part of the CustomBuildStep Outputs.
    return


# Traceback (AttributeError)
Traceback (most recent call last):
File "C:\projects\meson\mesonbuild\mesonmain.py", line 279, in run
app.generate()
File "C:\projects\meson\mesonbuild\mesonmain.py", line 169, in generate
g.generate(intr)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 168, in generate
self.generate_solution(sln_filename, projlist)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 233, in generate_solution
all_deps = self.determine_deps(p)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 203, in determine_deps
all_deps[d.get_id()] = True
AttributeError: 'GeneratedList' object has no attribute 'get_id'

# Fixed code
def add_generated_objects(node, generated_objects):
    # Do not add generated objects to project file. Those are automatically used by MSBuild, because
    # they are part of the CustomBuild Outputs.
    return
# Buggy code
def get_target_dependencies(self):
    deps = self.dependencies[:]
    deps += self.extra_depends
    for c in self.sources:
        if hasattr(c, "held_object"):
            c = c.held_object
        if isinstance(c, (BuildTarget, CustomTarget, GeneratedList)):
            deps.append(c)
    return deps


# Traceback (AttributeError)
Traceback (most recent call last):
File "C:\projects\meson\mesonbuild\mesonmain.py", line 279, in run
app.generate()
File "C:\projects\meson\mesonbuild\mesonmain.py", line 169, in generate
g.generate(intr)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 168, in generate
self.generate_solution(sln_filename, projlist)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 233, in generate_solution
all_deps = self.determine_deps(p)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 203, in determine_deps
all_deps[d.get_id()] = True
AttributeError: 'GeneratedList' object has no attribute 'get_id'

# Fixed code
def get_target_dependencies(self):
    deps = self.dependencies[:]
    deps += self.extra_depends
    for c in self.sources:
        if hasattr(c, "held_object"):
            c = c.held_object
        if isinstance(c, (BuildTarget, CustomTarget)):
            deps.append(c)
    return deps
# Buggy code
def get_generated_sources(self):
    return []


# Traceback (AttributeError)
Traceback (most recent call last):
File "C:\projects\meson\mesonbuild\mesonmain.py", line 279, in run
app.generate()
File "C:\projects\meson\mesonbuild\mesonmain.py", line 169, in generate
g.generate(intr)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 168, in generate
self.generate_solution(sln_filename, projlist)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 233, in generate_solution
all_deps = self.determine_deps(p)
File "C:\projects\meson\mesonbuild\backend\vs2010backend.py", line 203, in determine_deps
all_deps[d.get_id()] = True
AttributeError: 'GeneratedList' object has no attribute 'get_id'

# Fixed code
def get_generated_sources(self):
    return self.get_generated_lists()
# Buggy code
def unpack_env_kwarg(self, kwargs):
    envlist = kwargs.get("env", [])
    if isinstance(envlist, EnvironmentVariablesHolder):
        env = envlist.held_object
    else:
        if not isinstance(envlist, list):
            envlist = [envlist]
        env = {}
        for e in envlist:
            if "=" not in e:
                raise InterpreterException(
                    "Env var definition must be of type key=val."
                )
            (k, val) = e.split("=", 1)
            k = k.strip()
            val = val.strip()
            if " " in k:
                raise InterpreterException("Env var key must not have spaces in it.")
            env[k] = val
    return env


# Traceback (IndexError)
$ /home/cassidy/dev/meson/mesontest.py -C build --setup leaks
ninja: Entering directory `/home/cassidy/dev/gst/master/gst-build/build'
ninja: no work to do.
Traceback (most recent call last):
File "/home/cassidy/dev/meson/mesontest.py", line 579, in <module>
sys.exit(run(sys.argv[1:]))
File "/home/cassidy/dev/meson/mesontest.py", line 575, in run
return th.doit()
File "/home/cassidy/dev/meson/mesontest.py", line 337, in doit
self.run_tests(tests)
File "/home/cassidy/dev/meson/mesontest.py", line 458, in run_tests
(logfile, logfilename, jsonlogfile, jsonlogfilename) = self.open_log_files()
File "/home/cassidy/dev/meson/mesontest.py", line 415, in open_log_files
namebase = os.path.split(self.get_wrapper()[0])[1]
IndexError: list index out of range

# Fixed code
def unpack_env_kwarg(self, kwargs):
    envlist = kwargs.get("env", EnvironmentVariablesHolder())
    if isinstance(envlist, EnvironmentVariablesHolder):
        env = envlist.held_object
    else:
        if not isinstance(envlist, list):
            envlist = [envlist]
        env = {}
        for e in envlist:
            if "=" not in e:
                raise InterpreterException(
                    "Env var definition must be of type key=val."
                )
            (k, val) = e.split("=", 1)
            k = k.strip()
            val = val.strip()
            if " " in k:
                raise InterpreterException("Env var key must not have spaces in it.")
            env[k] = val
    return env
# Buggy code
def get_option_link_args(self, options):
    return options["c_winlibs"].value[:]


# Traceback (KeyError)
The Meson build system
Version: 0.35.1
Source dir: F:\avian\test
Build dir: F:\avian\test\build\linux-64
Build type: cross build
Project name: avian                                                                                                 18:22Native cpp compiler: c++ (gcc 4.8.1)
Cross cpp compiler: f:/cygwin64/bin/x86_64-pc-linux-gnu-g++ (gcc 4.8.2)
Native c compiler: gcc (gcc 4.8.1)
Cross c compiler: f:/cygwin64/bin/x86_64-pc-linux-gnu-gcc (gcc 4.8.2)
Native java compiler: javac (unknown 1.8.0)
Cross java compiler: javac (unknown 1.8.0)
Host machine cpu family: x86_64
Host machine cpu: i686
Target machine cpu family: x86_64
Target machine cpu: i686
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: f:\cygwin64\bin\pkg-config.EXE (0.29.1)
Cross dependency zlib found: YES 1.2.7
Checking for size of "void*": 8
Build targets in project: 2
Traceback (most recent call last):
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\mesonmain.py", line 282, in run
app.generate()
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\mesonmain.py", line 169, in generate
g.generate(intr)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 187, in generate
self.generate_target(t, outfile)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 355, in generate_target
elem = self.generate_link(target, outfile, outname, obj_list, linker, pch_objects)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 1817, in generate_link
commands += linker.get_option_link_args(self.environment.coredata.compiler_options)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\compilers.py", line 2027, in get_option_link_args

return options['cpp_winlibs'].value
KeyError: 'cpp_winlibs'

# Fixed code
def get_option_link_args(self, options):
    # FIXME: See GnuCCompiler.get_option_link_args
    if "c_winlibs" in options:
        return options["c_winlibs"].value[:]
    else:
        return msvc_winlibs[:]
# Buggy code
def get_option_link_args(self, options):
    return options["cpp_winlibs"].value[:]


# Traceback (KeyError)
The Meson build system
Version: 0.35.1
Source dir: F:\avian\test
Build dir: F:\avian\test\build\linux-64
Build type: cross build
Project name: avian                                                                                                 18:22Native cpp compiler: c++ (gcc 4.8.1)
Cross cpp compiler: f:/cygwin64/bin/x86_64-pc-linux-gnu-g++ (gcc 4.8.2)
Native c compiler: gcc (gcc 4.8.1)
Cross c compiler: f:/cygwin64/bin/x86_64-pc-linux-gnu-gcc (gcc 4.8.2)
Native java compiler: javac (unknown 1.8.0)
Cross java compiler: javac (unknown 1.8.0)
Host machine cpu family: x86_64
Host machine cpu: i686
Target machine cpu family: x86_64
Target machine cpu: i686
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: f:\cygwin64\bin\pkg-config.EXE (0.29.1)
Cross dependency zlib found: YES 1.2.7
Checking for size of "void*": 8
Build targets in project: 2
Traceback (most recent call last):
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\mesonmain.py", line 282, in run
app.generate()
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\mesonmain.py", line 169, in generate
g.generate(intr)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 187, in generate
self.generate_target(t, outfile)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 355, in generate_target
elem = self.generate_link(target, outfile, outname, obj_list, linker, pch_objects)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 1817, in generate_link
commands += linker.get_option_link_args(self.environment.coredata.compiler_options)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\compilers.py", line 2027, in get_option_link_args

return options['cpp_winlibs'].value
KeyError: 'cpp_winlibs'

# Fixed code
def get_option_link_args(self, options):
    # FIXME: See GnuCCompiler.get_option_link_args
    if "cpp_winlibs" in options:
        return options["cpp_winlibs"].value[:]
    else:
        return msvc_winlibs[:]
# Buggy code
def get_option_link_args(self, options):
    if self.gcc_type == GCC_MINGW:
        return options["c_winlibs"].value
    return []


# Traceback (KeyError)
The Meson build system
Version: 0.35.1
Source dir: F:\avian\test
Build dir: F:\avian\test\build\linux-64
Build type: cross build
Project name: avian                                                                                                 18:22Native cpp compiler: c++ (gcc 4.8.1)
Cross cpp compiler: f:/cygwin64/bin/x86_64-pc-linux-gnu-g++ (gcc 4.8.2)
Native c compiler: gcc (gcc 4.8.1)
Cross c compiler: f:/cygwin64/bin/x86_64-pc-linux-gnu-gcc (gcc 4.8.2)
Native java compiler: javac (unknown 1.8.0)
Cross java compiler: javac (unknown 1.8.0)
Host machine cpu family: x86_64
Host machine cpu: i686
Target machine cpu family: x86_64
Target machine cpu: i686
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: f:\cygwin64\bin\pkg-config.EXE (0.29.1)
Cross dependency zlib found: YES 1.2.7
Checking for size of "void*": 8
Build targets in project: 2
Traceback (most recent call last):
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\mesonmain.py", line 282, in run
app.generate()
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\mesonmain.py", line 169, in generate
g.generate(intr)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 187, in generate
self.generate_target(t, outfile)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 355, in generate_target
elem = self.generate_link(target, outfile, outname, obj_list, linker, pch_objects)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 1817, in generate_link
commands += linker.get_option_link_args(self.environment.coredata.compiler_options)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\compilers.py", line 2027, in get_option_link_args

return options['cpp_winlibs'].value
KeyError: 'cpp_winlibs'

# Fixed code
def get_option_link_args(self, options):
    if self.gcc_type == GCC_MINGW:
        # FIXME: This check is needed because we currently pass
        # cross-compiler options to the native compiler too and when
        # cross-compiling from Windows to Linux, `options` will contain
        # Linux-specific options which doesn't include `c_winlibs`. The
        # proper fix is to allow cross-info files to specify compiler
        # options and to maintain both cross and native compiler options in
        # coredata: https://github.com/mesonbuild/meson/issues/1029
        if "c_winlibs" in options:
            return options["c_winlibs"].value[:]
        else:
            return gnu_winlibs[:]
    return []
# Buggy code
def get_option_link_args(self, options):
    if self.gcc_type == GCC_MINGW:
        return options["cpp_winlibs"].value
    return []


# Traceback (KeyError)
The Meson build system
Version: 0.35.1
Source dir: F:\avian\test
Build dir: F:\avian\test\build\linux-64
Build type: cross build
Project name: avian                                                                                                 18:22Native cpp compiler: c++ (gcc 4.8.1)
Cross cpp compiler: f:/cygwin64/bin/x86_64-pc-linux-gnu-g++ (gcc 4.8.2)
Native c compiler: gcc (gcc 4.8.1)
Cross c compiler: f:/cygwin64/bin/x86_64-pc-linux-gnu-gcc (gcc 4.8.2)
Native java compiler: javac (unknown 1.8.0)
Cross java compiler: javac (unknown 1.8.0)
Host machine cpu family: x86_64
Host machine cpu: i686
Target machine cpu family: x86_64
Target machine cpu: i686
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: f:\cygwin64\bin\pkg-config.EXE (0.29.1)
Cross dependency zlib found: YES 1.2.7
Checking for size of "void*": 8
Build targets in project: 2
Traceback (most recent call last):
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\mesonmain.py", line 282, in run
app.generate()
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\mesonmain.py", line 169, in generate
g.generate(intr)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 187, in generate
self.generate_target(t, outfile)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 355, in generate_target
elem = self.generate_link(target, outfile, outname, obj_list, linker, pch_objects)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\backend\ninjabackend.py", line 1817, in generate_link
commands += linker.get_option_link_args(self.environment.coredata.compiler_options)
File "c:\program files (x86)\python35-32\lib\site-packages\mesonbuild\compilers.py", line 2027, in get_option_link_args

return options['cpp_winlibs'].value
KeyError: 'cpp_winlibs'

# Fixed code
def get_option_link_args(self, options):
    if self.gcc_type == GCC_MINGW:
        # FIXME: See GnuCCompiler.get_option_link_args
        if "cpp_winlibs" in options:
            return options["cpp_winlibs"].value[:]
        else:
            return gnu_winlibs[:]
    return []
# Buggy code
def __init__(self, environment, kwargs):
    Dependency.__init__(self, "qt5")
    self.name = "qt5"
    self.root = "/usr"
    mods = kwargs.get("modules", [])
    self.cargs = []
    self.largs = []
    self.is_found = False
    if isinstance(mods, str):
        mods = [mods]
    if len(mods) == 0:
        raise DependencyException("No Qt5 modules specified.")
    type_text = "native"
    if environment.is_cross_build() and kwargs.get("native", False):
        type_text = "cross"
        self.pkgconfig_detect(mods, environment, kwargs)
    elif not environment.is_cross_build() and shutil.which("pkg-config") is not None:
        self.pkgconfig_detect(mods, environment, kwargs)
    elif shutil.which("qmake") is not None:
        self.qmake_detect(mods, kwargs)
    else:
        self.version = "none"
    if not self.is_found:
        mlog.log("Qt5 %s dependency found: " % type_text, mlog.red("NO"))
    else:
        mlog.log("Qt5 %s dependency found: " % type_text, mlog.green("YES"))


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/jenkins/workspace/meson/mesonbuild/mesonmain.py", line 282, in run
app.generate()
File "/home/jenkins/workspace/meson/mesonbuild/mesonmain.py", line 169, in generate
g.generate(intr)
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 184, in generate
self.generate_target(t, outfile)
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 257, in generate_target
self.generate_custom_generator_rules(target, outfile)
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 1360, in generate_custom_generator_rules
self.generate_genlist_for_target(genlist, target, outfile)
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 1406, in generate_genlist_for_target
elem.write(outfile)
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 116, in write
if quote_char == '"':
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 35, in ninja_quote
return text.replace(' ', '$ ').replace(':', '$:')
AttributeError: 'NoneType' object has no attribute 'replace'

# Fixed code
def __init__(self, env, kwargs):
    QtBaseDependency.__init__(self, "qt5", env, kwargs)
# Buggy code
def __init__(self, environment, kwargs):
    Dependency.__init__(self, "qt4")
    self.name = "qt4"
    self.root = "/usr"
    self.modules = []
    mods = kwargs.get("modules", [])
    if isinstance(mods, str):
        mods = [mods]
    for module in mods:
        self.modules.append(PkgConfigDependency("Qt" + module, environment, kwargs))
    if len(self.modules) == 0:
        raise DependencyException("No Qt4 modules specified.")


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/jenkins/workspace/meson/mesonbuild/mesonmain.py", line 282, in run
app.generate()
File "/home/jenkins/workspace/meson/mesonbuild/mesonmain.py", line 169, in generate
g.generate(intr)
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 184, in generate
self.generate_target(t, outfile)
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 257, in generate_target
self.generate_custom_generator_rules(target, outfile)
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 1360, in generate_custom_generator_rules
self.generate_genlist_for_target(genlist, target, outfile)
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 1406, in generate_genlist_for_target
elem.write(outfile)
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 116, in write
if quote_char == '"':
File "/home/jenkins/workspace/meson/mesonbuild/backend/ninjabackend.py", line 35, in ninja_quote
return text.replace(' ', '$ ').replace(':', '$:')
AttributeError: 'NoneType' object has no attribute 'replace'

# Fixed code
def __init__(self, env, kwargs):
    QtBaseDependency.__init__(self, "qt4", env, kwargs)
# Buggy code
def can_compile(self, fname):
    return fname.endswith(".vala") or fname.endswith(".vapi")


# Traceback (AttributeError)
Traceback (most recent call last):
File "/usr/share/meson/meson.py", line 188, in run
app.generate()
File "/usr/share/meson/meson.py", line 141, in generate
g.generate()
File "/usr/share/meson/ninjabackend.py", line 132, in generate
[self.generate_target(t, outfile) for t in self.build.get_targets().values()]
File "/usr/share/meson/ninjabackend.py", line 132, in <listcomp>
[self.generate_target(t, outfile) for t in self.build.get_targets().values()]
File "/usr/share/meson/ninjabackend.py", line 209, in generate_target
header_deps))
File "/usr/share/meson/ninjabackend.py", line 1100, in generate_single_compile
compiler = self.get_compiler_for_source(src)
File "/usr/share/meson/backends.py", line 54, in get_compiler_for_source
if i.can_compile(src):
File "/usr/share/meson/compilers.py", line 824, in can_compile
return fname.endswith('.vala') or fname.endswith('.vapi')
AttributeError: 'RawFilename' object has no attribute 'endswith'

# Fixed code
def can_compile(self, filename):
    suffix = filename.split(".")[-1]
    return suffix in ("vala", "vapi")
# Buggy code
def _hval(value):
    value = value if isinstance(value, unicode) else str(value)
    if "\n" in value or "\r" in value or "\0" in value:
        raise ValueError("Header value must not contain control characters: %r" % value)
    return value


# Traceback (TypeError)
Critical error while processing request: /
Error:
TypeError("WSGI response header value u'text/plain' is not of type str.",)
Traceback:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/bottle.py", line 960, in wsgi
start_response(response._status_line, response.headerlist)
File "/usr/lib/python2.7/dist-packages/cherrypy/wsgiserver/wsgiserver2.py", line 2309, in start_response
"WSGI response header value %r is not of type str." % v)
TypeError: WSGI response header value u'text/plain' is not of type str.

# Fixed code
def _hval(value):
    value = tonat(value)
    if "\n" in value or "\r" in value or "\0" in value:
        raise ValueError("Header value must not contain control characters: %r" % value)
    return value
# Buggy code
def _AddVersionResource(self, fileName):
    try:
        from win32verstamp import stamp
    except:
        print("*** WARNING *** unable to create version resource")
        print("install pywin32 extensions first")
        return
    versionInfo = VersionInfo(
        self.metadata.version,
        comments=self.metadata.long_description,
        description=self.metadata.description,
        company=self.metadata.author,
        product=self.metadata.name,
    )
    stamp(fileName, versionInfo)


# Traceback (cx_Freeze.freezer.ConfigError)
C:\Users\Belli\Desktop\failing_cx_freeze>python setup.py build
running build
running build_exe
creating directory demo
copying C:\Miniconda\lib\site-packages\cx_Freeze\bases\Win32GUI.exe -> demo\demo.exe
Stamped: demo\demo.exe
writing zip file demo\demo.zip

Name                      File
----                      ----
m __main__                  demo.py
m cx_Freeze__init__         C:\Miniconda\lib\site-packages\cx_Freeze\initscripts\Console.py

Traceback (most recent call last):
File "setup.py", line 47, in <module>
executables = [GUI2Exe_Target_1]
File "C:\Miniconda\lib\site-packages\cx_Freeze\dist.py", line 362, in setup
distutils.core.setup(**attrs)
File "C:\Miniconda\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Miniconda\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Miniconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Miniconda\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Miniconda\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Miniconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Miniconda\lib\site-packages\cx_Freeze\dist.py", line 232, in run
freezer.Freeze()
File "C:\Miniconda\lib\site-packages\cx_Freeze\freezer.py", line 610, in Freeze
self.compress, self.copyDependentFiles)
File "C:\Miniconda\lib\site-packages\cx_Freeze\freezer.py", line 510, in _WriteModules
module.Create(finder)
File "C:\Miniconda\lib\site-packages\cx_Freeze\freezer.py", line 746, in Create
module.file, module.name)
cx_Freeze.freezer.ConfigError: no file named sys (for module CoolProp.CoolProp.sys)

# Fixed code
def _AddVersionResource(self, exe):
    try:
        from win32verstamp import stamp
    except:
        print("*** WARNING *** unable to create version resource")
        print("install pywin32 extensions first")
        return
    fileName = exe.targetName
    versionInfo = VersionInfo(
        self.metadata.version,
        comments=self.metadata.long_description,
        description=self.metadata.description,
        company=self.metadata.author,
        product=self.metadata.name,
        copyright=exe.copyright,
        trademarks=exe.trademarks,
    )
    stamp(fileName, versionInfo)
# Buggy code
def __init__(
    self,
    script,
    initScript=None,
    base=None,
    targetName=None,
    icon=None,
    shortcutName=None,
    shortcutDir=None,
):
    self.script = script
    self.initScript = initScript or "Console"
    self.base = base or "Console"
    self.targetName = targetName
    self.icon = icon
    self.shortcutName = shortcutName
    self.shortcutDir = shortcutDir


# Traceback (cx_Freeze.freezer.ConfigError)
C:\Users\Belli\Desktop\failing_cx_freeze>python setup.py build
running build
running build_exe
creating directory demo
copying C:\Miniconda\lib\site-packages\cx_Freeze\bases\Win32GUI.exe -> demo\demo.exe
Stamped: demo\demo.exe
writing zip file demo\demo.zip

Name                      File
----                      ----
m __main__                  demo.py
m cx_Freeze__init__         C:\Miniconda\lib\site-packages\cx_Freeze\initscripts\Console.py

Traceback (most recent call last):
File "setup.py", line 47, in <module>
executables = [GUI2Exe_Target_1]
File "C:\Miniconda\lib\site-packages\cx_Freeze\dist.py", line 362, in setup
distutils.core.setup(**attrs)
File "C:\Miniconda\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Miniconda\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Miniconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Miniconda\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Miniconda\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Miniconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Miniconda\lib\site-packages\cx_Freeze\dist.py", line 232, in run
freezer.Freeze()
File "C:\Miniconda\lib\site-packages\cx_Freeze\freezer.py", line 610, in Freeze
self.compress, self.copyDependentFiles)
File "C:\Miniconda\lib\site-packages\cx_Freeze\freezer.py", line 510, in _WriteModules
module.Create(finder)
File "C:\Miniconda\lib\site-packages\cx_Freeze\freezer.py", line 746, in Create
module.file, module.name)
cx_Freeze.freezer.ConfigError: no file named sys (for module CoolProp.CoolProp.sys)

# Fixed code
def __init__(
    self,
    script,
    initScript=None,
    base=None,
    targetName=None,
    icon=None,
    shortcutName=None,
    shortcutDir=None,
    copyright=None,
    trademarks=None,
):
    self.script = script
    self.initScript = initScript or "Console"
    self.base = base or "Console"
    self.targetName = targetName
    self.icon = icon
    self.shortcutName = shortcutName
    self.shortcutDir = shortcutDir
    self.copyright = copyright
    self.trademarks = trademarks
# Buggy code
def notifier(self, trait_dict, removed, added, changed):
    """Fire the TraitDictEvent with the provided parameters.

    Parameters
    ----------
    trait_dict : dict
        The complete dictionary.
    removed : dict
        Dict of removed items.
    added : dict
        Dict of added items.
    changed : dict
        Dict of changed items.
    """

    if self.name_items is None:
        return

    object = self.object()

    if object is None:
        return

    event = TraitDictEvent(removed=removed, added=added, changed=changed)
    items_event = self.trait.items_event()
    object.trait_items_event(self.name_items, event, items_event)


# Traceback (traits.trait_errors.TraitError)
Traceback (most recent call last):
File "/home/punchagan/tmp/foo.py", line 12, in <module>
a.foo[0]['x'] = 20
File "/home/punchagan/work/traits/traits/trait_handlers.py", line 3159, in __setitem__
raise excp
traits.trait_errors.TraitError: Each value of the 'foo_items' trait of an A instance must be an implementor of, or can be adapted to implement, TraitListEvent or None, but a value of <traits.trait_handlers.TraitDictEvent object at 0x13046d0> <class 'traits.trait_handlers.TraitDictEvent'> was specified.

# Fixed code
def notifier(self, trait_dict, removed, added, changed):
    """Fire the TraitDictEvent with the provided parameters.

    Parameters
    ----------
    trait_dict : dict
        The complete dictionary.
    removed : dict
        Dict of removed items.
    added : dict
        Dict of added items.
    changed : dict
        Dict of changed items.
    """

    if self.name_items is None:
        return

    object = self.object()

    if object is None:
        return

    if getattr(object, self.name) is not self:
        # Workaround having this dict inside another container which
        # also uses the name_items trait for notification.
        # See enthought/traits#25
        return

    event = TraitDictEvent(removed=removed, added=added, changed=changed)
    items_event = self.trait.items_event()
    object.trait_items_event(self.name_items, event, items_event)
# Buggy code
def notifier(self, trait_list, index, removed, added):
    """Converts and consolidates the parameters to a TraitListEvent and
    then fires the event.

    Parameters
    ----------
    trait_list : list
        The list
    index : int or slice
        Index or slice that was modified
    removed : list
        Values that were removed
    added : list
        Values that were added

    """
    is_trait_none = self.trait is None
    is_name_items_none = self.name_items is None
    if not hasattr(self, "trait") or is_trait_none or is_name_items_none:
        return

    object = self.object()
    if object is None:
        return

    event = TraitListEvent(index, removed, added)
    items_event = self.trait.items_event()
    object.trait_items_event(self.name_items, event, items_event)


# Traceback (traits.trait_errors.TraitError)
Traceback (most recent call last):
File "/home/punchagan/tmp/foo.py", line 12, in <module>
a.foo[0]['x'] = 20
File "/home/punchagan/work/traits/traits/trait_handlers.py", line 3159, in __setitem__
raise excp
traits.trait_errors.TraitError: Each value of the 'foo_items' trait of an A instance must be an implementor of, or can be adapted to implement, TraitListEvent or None, but a value of <traits.trait_handlers.TraitDictEvent object at 0x13046d0> <class 'traits.trait_handlers.TraitDictEvent'> was specified.

# Fixed code
def notifier(self, trait_list, index, removed, added):
    """Converts and consolidates the parameters to a TraitListEvent and
    then fires the event.

    Parameters
    ----------
    trait_list : list
        The list
    index : int or slice
        Index or slice that was modified
    removed : list
        Values that were removed
    added : list
        Values that were added

    """
    is_trait_none = self.trait is None
    is_name_items_none = self.name_items is None
    if not hasattr(self, "trait") or is_trait_none or is_name_items_none:
        return

    object = self.object()
    if object is None:
        return

    if getattr(object, self.name) is not self:
        # Workaround having this list inside another container which
        # also uses the name_items trait for notification.
        # See enthought/traits#25, enthought/traits#281
        return

    event = TraitListEvent(index, removed, added)
    items_event = self.trait.items_event()
    object.trait_items_event(self.name_items, event, items_event)
# Buggy code
def notifier(self, trait_set, removed, added):
    """Converts and consolidates the parameters to a TraitSetEvent and
    then fires the event.

    Parameters
    ----------
    trait_set : set
        The complete set
    removed : set
        Set of values that were removed.
    added : set
        Set of values that were added.
    """

    if self.name_items is None:
        return

    object = self.object()
    if object is None:
        return

    event = TraitSetEvent(removed=removed, added=added)
    items_event = self.trait.items_event()
    object.trait_items_event(self.name_items, event, items_event)


# Traceback (traits.trait_errors.TraitError)
Traceback (most recent call last):
File "/home/punchagan/tmp/foo.py", line 12, in <module>
a.foo[0]['x'] = 20
File "/home/punchagan/work/traits/traits/trait_handlers.py", line 3159, in __setitem__
raise excp
traits.trait_errors.TraitError: Each value of the 'foo_items' trait of an A instance must be an implementor of, or can be adapted to implement, TraitListEvent or None, but a value of <traits.trait_handlers.TraitDictEvent object at 0x13046d0> <class 'traits.trait_handlers.TraitDictEvent'> was specified.

# Fixed code
def notifier(self, trait_set, removed, added):
    """Converts and consolidates the parameters to a TraitSetEvent and
    then fires the event.

    Parameters
    ----------
    trait_set : set
        The complete set
    removed : set
        Set of values that were removed.
    added : set
        Set of values that were added.
    """

    if self.name_items is None:
        return

    object = self.object()
    if object is None:
        return

    if getattr(object, self.name) is not self:
        # Workaround having this set inside another container which
        # also uses the name_items trait for notification.
        # Similar to enthought/traits#25
        return

    event = TraitSetEvent(removed=removed, added=added)
    items_event = self.trait.items_event()
    object.trait_items_event(self.name_items, event, items_event)
# Buggy code
def validate(self, object, name, value):
    if isinstance(value, object.__class__):
        return value

    self.validate_failed(object, name, value)


# Traceback (traits.trait_errors.TraitError)
from traits.api import *
class A(HasTraits):
...     foo = List(This(allow_none=False))
...
a = A()
a.foo = [None]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_types.py", line 2452, in validate
return TraitListObject(self, object, name, value)
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_handlers.py", line 2258, in __init__
raise excp
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_handlers.py", line 2250, in __init__
value = [validate(object, name, val) for val in value]
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_handlers.py", line 2250, in <listcomp>
value = [validate(object, name, val) for val in value]
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_types.py", line 1075, in validate
self.validate_failed(object, name, value)
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_types.py", line 1096, in validate_failed
self.error(object, name, msg)
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_handlers.py", line 256, in error
object, name, self.full_info(object, name, value), value
traits.trait_errors.TraitError: Each element of the 'foo' trait of an A instance must be an instance of the same type as the receiver, but a value of "class 'NoneType' (i.e. None)" <class 'str'> was specified.

# Fixed code
def validate(self, object, name, value):
    if isinstance(value, object.__class__):
        return value

    self.error(object, name, value)
# Buggy code
def validate_none(self, object, name, value):
    if isinstance(value, object.__class__) or (value is None):
        return value

    self.validate_failed(object, name, value)


# Traceback (traits.trait_errors.TraitError)
from traits.api import *
class A(HasTraits):
...     foo = List(This(allow_none=False))
...
a = A()
a.foo = [None]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_types.py", line 2452, in validate
return TraitListObject(self, object, name, value)
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_handlers.py", line 2258, in __init__
raise excp
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_handlers.py", line 2250, in __init__
value = [validate(object, name, val) for val in value]
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_handlers.py", line 2250, in <listcomp>
value = [validate(object, name, val) for val in value]
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_types.py", line 1075, in validate
self.validate_failed(object, name, value)
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_types.py", line 1096, in validate_failed
self.error(object, name, msg)
File "/Users/mdickinson/Enthought/ETS/traits/traits/trait_handlers.py", line 256, in error
object, name, self.full_info(object, name, value), value
traits.trait_errors.TraitError: Each element of the 'foo' trait of an A instance must be an instance of the same type as the receiver, but a value of "class 'NoneType' (i.e. None)" <class 'str'> was specified.

# Fixed code
def validate_none(self, object, name, value):
    if isinstance(value, object.__class__) or (value is None):
        return value

    self.error(object, name, value)
# Buggy code
def _get_ongoing_dict_key(self, result):
    if not isinstance(result, BaseResult):
        raise ValueError(
            "Any result using _get_ongoing_dict_key must subclass from "
            "BaseResult. Provided result is of type: %s" % type(result)
        )
    return ":".join(str(el) for el in [result.transfer_type, result.src, result.dest])


# Traceback (UnicodeEncodeError)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0303' in position 11: ordinal not in range(128)
2017-07-29 00:49:40,775 - Thread-1 - awscli.customizations.s3.results - DEBUG - Error processing result QueuedResult(transfer_type='upload'

Traceback (most recent call last):
File "/Users/jasonsturges/Library/Python/2.7/lib/python/site-packages/awscli/customizations/s3/results.py", line 604, in _process_result
result_handler(result)
File "/Users/jasonsturges/Library/Python/2.7/lib/python/site-packages/awscli/customizations/s3/results.py", line 241, in __call__
result=result)
File "/Users/jasonsturges/Library/Python/2.7/lib/python/site-packages/awscli/customizations/s3/results.py", line 267, in _record_queued_result
self._get_ongoing_dict_key(result)] = total_transfer_size
File "/Users/jasonsturges/Library/Python/2.7/lib/python/site-packages/awscli/customizations/s3/results.py", line 250, in _get_ongoing_dict_key
str(el) for el in [result.transfer_type, result.src, result.dest])
File "/Users/jasonsturges/Library/Python/2.7/lib/python/site-packages/awscli/customizations/s3/results.py", line 250, in <genexpr>
str(el) for el in [result.transfer_type, result.src, result.dest])

# Fixed code
def _get_ongoing_dict_key(self, result):
    if not isinstance(result, BaseResult):
        raise ValueError(
            "Any result using _get_ongoing_dict_key must subclass from "
            "BaseResult. Provided result is of type: %s" % type(result)
        )
    key_parts = []
    for result_property in [result.transfer_type, result.src, result.dest]:
        if result_property is not None:
            key_parts.append(ensure_text_type(result_property))
    return ":".join(key_parts)
# Buggy code
def __init__(self):
    # autoreset allows us to not have to sent
    # reset sequences for every string.
    colorama.init(autoreset=True)


# Traceback (AttributeError)
root@jeff-desktop:~# pip install awscli
Collecting awscli
Downloading awscli-1.10.43-py2.py3-none-any.whl (969kB)
100% |████████████████████████████████| 972kB 1.9MB/s
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1006, in check_if_exists
self.satisfied_by = pkg_resources.get_distribution(str(no_marker))
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 535, in get_distribution
dist = get_provider(dist)
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 415, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 695, in find
raise VersionConflict(dist, req)
pkg_resources.VersionConflict: (colorama 0.3.7 (/usr/lib/python3/dist-packages), Requirement.parse('colorama<=0.3.3,>=0.2.5'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 328, in run
wb.build(autobuilding=True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 448, in _prepare_file
req_to_install, finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 387, in _check_skip_installed
req_to_install.check_if_exists()
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1011, in check_if_exists
self.req.project_name
AttributeError: 'Requirement' object has no attribute 'project_name'
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
root@jeff-desktop:~#

# Fixed code
def __init__(self):
    # `autoreset` allows us to not have to sent reset sequences for every
    # string. `strip` lets us preserve color when redirecting.
    colorama.init(autoreset=True, strip=False)
# Buggy code
def _complete_command(self):
    retval = []
    if self.current_word == self.command_name:
        retval = self.command_hc.command_table.keys()
    elif self.current_word.startswith("-"):
        retval = self._find_possible_options()
    else:
        # See if they have entered a partial command name
        retval = [
            n for n in self.command_hc.command_table if n.startswith(self.current_word)
        ]
    return retval


# Traceback (AttributeError)
$ aws emr Traceback (most recent call last):
File "/usr/local/bin/aws_completer", line 22, in <module>
awscli.completer.complete(cline, cpoint)
File "/usr/local/lib/python2.7/dist-packages/awscli/completer.py", line 153, in complete
choices = Completer().complete(cmdline, point)
File "/usr/local/lib/python2.7/dist-packages/awscli/completer.py", line 142, in complete
self._process_command_line()
File "/usr/local/lib/python2.7/dist-packages/awscli/completer.py", line 126, in _process_command_line
if self.command_hc.command_table:
AttributeError: 'NoneType' object has no attribute 'command_table'

# Fixed code
def _complete_command(self):
    retval = []
    if self.current_word == self.command_name:
        if self.command_hc:
            retval = self.command_hc.command_table.keys()
    elif self.current_word.startswith("-"):
        retval = self._find_possible_options()
    else:
        # See if they have entered a partial command name
        if self.command_hc:
            retval = [
                n
                for n in self.command_hc.command_table
                if n.startswith(self.current_word)
            ]
    return retval
# Buggy code
def run():
    pass


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 293, in resolve_thunk
return thunk() if callable(thunk) else thunk
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/strawberry/type.py", line 133, in <lambda>
lambda types_replacement_map=None: _get_fields(wrapped, types_replacement_map),
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/strawberry/type.py", line 76, in _get_fields
fields[field_name] = field(
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/strawberry/field.py", line 315, in field
return field(wrap)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/strawberry/field.py", line 171, in __call__
setattr(wrap, IS_STRAWBERRY_FIELD, True)
AttributeError: 'method' object has no attribute '_is_strawberry_field'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ignormies/.config/JetBrains/PyCharm2020.1/scratches/scratch_7.py", line 30, in <module>
schema = strawberry.Schema(query=Query)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/strawberry/schema.py", line 25, in __init__
super().__init__(
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/schema.py", line 205, in __init__
collect_referenced_types(query)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/schema.py", line 382, in collect_referenced_types
for field in named_type.fields.values():
File "/usr/lib/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 737, in fields
raise TypeError(f"{self.name} fields cannot be resolved. {error}")
TypeError: Query fields cannot be resolved. 'method' object has no attribute '_is_strawberry_field'

Process finished with exit code 1

# Fixed code
def run():  # pragma: no cover
    pass