gurudesh/pytracebugs huggingface dataset:
# Buggy code
def _download_and_hash(self, urls):
    """
    Downloads the file and returns the path, hash and url it used to download.

    Parameters
    ----------
    urls: `list`
        List of urls.

    Returns
    -------
    `str`, `str`, `str`
        Path, hash and URL of the file.
    """

    def download(url):
        path = self._cache_dir / get_filename(urlopen(url), url)
        path = replacement_filename(path)
        self._downloader.download(url, path)
        shahash = hash_file(path)
        return path, shahash, url

    for url in urls:
        try:
            return download(url)
        except Exception as e:
            warn(e, SunpyUserWarning)
    else:
        raise RuntimeError("Download failed")


# Traceback (AttributeError)
AttributeError                            Traceback (most recent call last)
<ipython-input-23-1a0872c98bf5> in <module>
----> 1 maps = Map(urls)

~/anaconda3/lib/python3.7/site-packages/sunpy/map/map_factory.py in __call__(self, composite, sequence, silence_errors, *args, **kwargs)
274         """
275
--> 276         data_header_pairs, already_maps = self._parse_args(*args, **kwargs)
277
278         new_maps = list()

~/anaconda3/lib/python3.7/site-packages/sunpy/map/map_factory.py in _parse_args(self, *args, **kwargs)
215             elif isinstance(arg, str) and _is_url(arg):
216                 url = arg
--> 217                 path = str(cache.download(url).absolute())
218                 pairs = self._read_file(path, **kwargs)
219                 data_header_pairs += pairs

AttributeError: 'str' object has no attribute 'absolute'

# Fixed code
def _download_and_hash(self, urls):
    """
    Downloads the file and returns the path, hash and url it used to download.

    Parameters
    ----------
    urls: `list`
        List of urls.

    Returns
    -------
    `str`, `str`, `str`
        Path, hash and URL of the file.
    """

    def download(url):
        path = self._cache_dir / get_filename(urlopen(url), url)
        # replacement_filename returns a string and we want a Path object
        path = Path(replacement_filename(path))
        self._downloader.download(url, path)
        shahash = hash_file(path)
        return path, shahash, url

    for url in urls:
        try:
            return download(url)
        except Exception as e:
            warn(e, SunpyUserWarning)
    else:
        raise RuntimeError("Download failed")
# Buggy code
def __init__(self, table=None, client=None):
    """
    table : `astropy.table.Table`
    """
    super().__init__()
    self.table = table or astropy.table.QTable()
    self.query_args = None
    self.requests = None
    self._client = client


# Traceback (TypeError)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-488027c4a327> in <module>
----> 1 Fido.fetch(res[0,0])

~/Git/sunpy/sunpy/net/fido_factory.py in fetch(self, *query_results, **kwargs)
360         for query_result in query_results:
361             for block in query_result.responses:
--> 362                 reslist.append(block.client.fetch(block, **kwargs))
363
364         results = DownloadResponse(reslist)

~/Git/sunpy/sunpy/net/jsoc/jsoc.py in fetch(self, jsoc_response, path, overwrite, progress, max_conn, downloader, sleep)
532
533         # Make staging request to JSOC
--> 534         responses = self.request_data(jsoc_response)
535         # Make response iterable
536         if not isiterable(responses):

~/Git/sunpy/sunpy/net/jsoc/jsoc.py in request_data(self, jsoc_response, **kwargs)
428         requests = []
429         self.query_args = jsoc_response.query_args
--> 430         for block in jsoc_response.query_args:
431
432             ds = self._make_recordset(**block)

TypeError: 'NoneType' object is not iterable

# Fixed code
def __init__(self, table=None, client=None):
    """
    table : `astropy.table.Table`
    """
    super().__init__()
    self.table = table or astropy.table.QTable()
    self.query_args = getattr(table, "query_args", None)
    self.requests = getattr(table, "requests", None)
    self._client = client
# Buggy code
def __getitem__(self, item):
    return type(self)(self.table[item])


# Traceback (TypeError)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-488027c4a327> in <module>
----> 1 Fido.fetch(res[0,0])

~/Git/sunpy/sunpy/net/fido_factory.py in fetch(self, *query_results, **kwargs)
360         for query_result in query_results:
361             for block in query_result.responses:
--> 362                 reslist.append(block.client.fetch(block, **kwargs))
363
364         results = DownloadResponse(reslist)

~/Git/sunpy/sunpy/net/jsoc/jsoc.py in fetch(self, jsoc_response, path, overwrite, progress, max_conn, downloader, sleep)
532
533         # Make staging request to JSOC
--> 534         responses = self.request_data(jsoc_response)
535         # Make response iterable
536         if not isiterable(responses):

~/Git/sunpy/sunpy/net/jsoc/jsoc.py in request_data(self, jsoc_response, **kwargs)
428         requests = []
429         self.query_args = jsoc_response.query_args
--> 430         for block in jsoc_response.query_args:
431
432             ds = self._make_recordset(**block)

TypeError: 'NoneType' object is not iterable

# Fixed code
def __getitem__(self, item):
    if isinstance(item, int):
        item = slice(item, item + 1)
    ret = type(self)(self.table[item])
    ret.query_args = self.query_args
    ret.requests = self.requests
    ret.client = self._client

    warnings.warn(
        "Downloading of sliced JSOC results is not supported. "
        "All the files present in the original response will be downloaded.",
        SunpyUserWarning,
    )
    return ret
# Buggy code
def annotate_frame(i):
    axes.set_title("{s.name}".format(s=self[i]))

    # x-axis label
    if self[0].coordinate_system.x == "HG":
        xlabel = "Longitude [{lon}".format(lon=self[i].spatial_units.x)
    else:
        xlabel = "X-position [{xpos}]".format(xpos=self[i].spatial_units.x)

    # y-axis label
    if self[0].coordinate_system.y == "HG":
        ylabel = "Latitude [{lat}]".format(lat=self[i].spatial_units.y)
    else:
        ylabel = "Y-position [{ypos}]".format(ypos=self[i].spatial_units.y)

    axes.set_xlabel(xlabel)
    axes.set_ylabel(ylabel)


# Traceback (AttributeError)
Traceback (most recent call last):

File "/media/solar1/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 197, in __draw_idle_agg
FigureCanvasAgg.draw(self)

File "/media/solar1/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py", line 464, in draw
self.figure.draw(self.renderer)

File "/media/solar1/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py", line 63, in draw_wrapper
draw(artist, renderer, *args, **kwargs)

File "/media/solar1/anaconda3/lib/python3.6/site-packages/matplotlib/figure.py", line 1151, in draw
self.canvas.draw_event(renderer)

File "/media/solar1/anaconda3/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 1823, in draw_event
self.callbacks.process(s, event)

File "/media/solar1/anaconda3/lib/python3.6/site-packages/matplotlib/cbook.py", line 554, in process
proxy(*args, **kwargs)

File "/media/solar1/anaconda3/lib/python3.6/site-packages/matplotlib/cbook.py", line 416, in call
return mtd(*args, **kwargs)

File "/media/solar1/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py", line 881, in _start
self._init_draw()

File "/media/solar1/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py", line 1540, in _init_draw
self._draw_frame(next(self.new_frame_seq()))

File "/media/solar1/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py", line 1562, in _draw_frame
self._drawn_artists = self._func(framedata, *self._args)

File "/media/solar1/anaconda3/lib/python3.6/site-packages/sunpy/map/mapcube.py", line 227, in updatefig
annotate_frame(i)

File "/media/solar1/anaconda3/lib/python3.6/site-packages/sunpy/map/mapcube.py", line 181, in annotate_frame

if self[0].coordinate_system.x == 'HG':
AttributeError: 'SpatialPair' object has no attribute 'x'

# Fixed code
def annotate_frame(i):
    axes.set_title("{s.name}".format(s=self[i]))
    axes.set_xlabel(
        axis_labels_from_ctype(self[i].coordinate_system[0], self[i].spatial_units[0])
    )
    axes.set_ylabel(
        axis_labels_from_ctype(self[i].coordinate_system[1], self[i].spatial_units[1])
    )
# Buggy code
def __init__(self, lst):
    """
    Input to this constructor can be one of a few things:

    1. A list of one UnifiedResponse object
    2. A list of tuples (QueryResponse, client)
    """

    tmplst = []
    # numfile is the number of files not the number of results.
    self._numfile = 0
    if isinstance(lst, QueryResponse):
        if not hasattr(lst, "client"):
            raise ("QueryResponse is only a valid input if it has a client attribute.")
        tmplst.append(lst)
        self._numfile = len(lst)
    else:
        for block in lst:
            if isinstance(block, tuple) and len(block) == 2:
                block[0].client = block[1]
                tmplst.append(block[0])
                self._numfile += len(block[0])
            elif hasattr(block, "client"):
                tmplst.append(block)
                self._numfile += len(block)
            else:
                raise Exception(
                    "{} is not a valid input to UnifiedResponse.".format(type(lst))
                )

    self._list = tmplst


# Traceback (Exception)
from sunpy.net import Fido, attrs as a
res = Fido.search(a.Time("2016-06-07", "2016-06-08"), a.Instrument('eve') | a.Instrument('goes'))
res[0]
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 15472, in default
run_compiled_code(code, self.ctx, None, 'single')
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 3634, in run_compiled_code
func(code, glb, loc)
File "<xonsh-code>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 67, in __getitem__
return type(self)(ret)
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 57, in __init__
raise Exception("{} is not a valid input to UnifiedResponse.".format(type(lst)))
Exception: <class 'sunpy.net.vso.vso.QueryResponse'> is not a valid input to UnifiedResponse.

# Fixed code
def __init__(self, lst):
    """
    Input to this constructor can be one of a few things:

    1. A ``QueryResponse`` object
    2. A list of tuples ``(QueryResponse, client)``
    """

    tmplst = []
    # numfile is the number of files not the number of results.
    self._numfile = 0
    if isinstance(lst, (QueryResponse, vsoQueryResponse)):
        if not hasattr(lst, "client"):
            raise ValueError(
                "A {} object is only a valid input to UnifiedResponse if it has a client attribute.".format(
                    type(lst).__name__
                )
            )
        tmplst.append(lst)
        self._numfile = len(lst)
    else:
        for block in lst:
            if isinstance(block, tuple) and len(block) == 2:
                block[0].client = block[1]
                tmplst.append(block[0])
                self._numfile += len(block[0])
            elif hasattr(block, "client"):
                tmplst.append(block)
                self._numfile += len(block)
            else:
                raise ValueError(
                    "{} is not a valid input to UnifiedResponse.".format(type(lst))
                )

    self._list = tmplst
# Buggy code
def __getitem__(self, aslice):
    ret = self._list[aslice]
    if ret:
        return type(self)(ret)

    return ret


# Traceback (Exception)
from sunpy.net import Fido, attrs as a
res = Fido.search(a.Time("2016-06-07", "2016-06-08"), a.Instrument('eve') | a.Instrument('goes'))
res[0]
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 15472, in default
run_compiled_code(code, self.ctx, None, 'single')
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 3634, in run_compiled_code
func(code, glb, loc)
File "<xonsh-code>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 67, in __getitem__
return type(self)(ret)
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 57, in __init__
raise Exception("{} is not a valid input to UnifiedResponse.".format(type(lst)))
Exception: <class 'sunpy.net.vso.vso.QueryResponse'> is not a valid input to UnifiedResponse.

# Fixed code
def __getitem__(self, aslice):
    """
    Support slicing the UnifiedResponse as a 2D object.

    The first index is to the client and the second index is the records
    returned from those clients.
    """
    # Just a single int as a slice, we are just indexing client.
    if isinstance(aslice, (int, slice)):
        ret = self._list[aslice]

    # Make sure we only have a length two slice.
    elif isinstance(aslice, tuple):
        if len(aslice) > 2:
            raise IndexError(
                "UnifiedResponse objects can only be sliced with one or two indices."
            )

        # Indexing both client and records, but only for one client.
        if isinstance(aslice[0], int):
            client_resp = self._list[aslice[0]]
            ret = self._handle_record_slice(client_resp, aslice[1])

        # Indexing both client and records for multiple clients.
        else:
            intermediate = self._list[aslice[0]]
            ret = []
            for client_resp in intermediate:
                resp = self._handle_record_slice(client_resp, aslice[1])
                ret.append(resp)

    else:
        raise IndexError("UnifiedResponse objects must be sliced with integers.")

    return UnifiedResponse(ret)
# Buggy code
def _repr_html_(self):
    ret = ""
    for block in self.responses:
        ret += "Results from the {}:\n".format(block.client.__class__.__name__)
        ret += block._repr_html_()
        ret += "\n"

    return ret


# Traceback (Exception)
from sunpy.net import Fido, attrs as a
res = Fido.search(a.Time("2016-06-07", "2016-06-08"), a.Instrument('eve') | a.Instrument('goes'))
res[0]
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 15472, in default
run_compiled_code(code, self.ctx, None, 'single')
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 3634, in run_compiled_code
func(code, glb, loc)
File "<xonsh-code>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 67, in __getitem__
return type(self)(ret)
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 57, in __init__
raise Exception("{} is not a valid input to UnifiedResponse.".format(type(lst)))
Exception: <class 'sunpy.net.vso.vso.QueryResponse'> is not a valid input to UnifiedResponse.

# Fixed code
def _repr_html_(self):
    nprov = len(self)
    if nprov == 1:
        ret = "Results from {} Provider:</br></br>".format(len(self))
    else:
        ret = "Results from {} Providers:</br></br>".format(len(self))
    for block in self.responses:
        ret += "{} Results from the {}:</br>".format(
            len(block), block.client.__class__.__name__
        )
        ret += block._repr_html_()
        ret += "</br>"

    return ret
# Buggy code
def __repr__(self):
    ret = super(UnifiedResponse, self).__repr__()
    ret += "\n"
    for block in self.responses:
        ret += "Results from the {}:\n".format(block.client.__class__.__name__)
        ret += repr(block)
        ret += "\n"

    return ret


# Traceback (Exception)
from sunpy.net import Fido, attrs as a
res = Fido.search(a.Time("2016-06-07", "2016-06-08"), a.Instrument('eve') | a.Instrument('goes'))
res[0]
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 15472, in default
run_compiled_code(code, self.ctx, None, 'single')
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 3634, in run_compiled_code
func(code, glb, loc)
File "<xonsh-code>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 67, in __getitem__
return type(self)(ret)
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 57, in __init__
raise Exception("{} is not a valid input to UnifiedResponse.".format(type(lst)))
Exception: <class 'sunpy.net.vso.vso.QueryResponse'> is not a valid input to UnifiedResponse.

# Fixed code
def __repr__(self):
    ret = super(UnifiedResponse, self).__repr__()
    ret += "\n" + str(self)

    return ret
# Buggy code
def fetch(self, query_result, wait=True, progress=True, **kwargs):
    """
    Downloads the files pointed at by URLs contained within UnifiedResponse
    object.

    Parameters
    ----------
    query_result : `sunpy.net.fido_factory.UnifiedResponse`
        Container returned by query method.

    wait : `bool`
        fetch will wait until the download is complete before returning.

    progress : `bool`
        Show a progress bar while the download is running.

    Returns
    -------
    `sunpy.net.fido_factory.DownloadResponse`

    Example
    --------
    >>> from sunpy.net.vso.attrs import Time, Instrument
    >>> unifresp = Fido.search(Time('2012/3/4','2012/3/6'), Instrument('AIA'))
    >>> downresp = Fido.get(unifresp)
    >>> file_paths = downresp.wait()
    """
    reslist = []
    for block in query_result.responses:
        reslist.append(block.client.get(block, **kwargs))

    results = DownloadResponse(reslist)

    if wait:
        return results.wait(progress=progress)
    else:
        return results


# Traceback (Exception)
from sunpy.net import Fido, attrs as a
res = Fido.search(a.Time("2016-06-07", "2016-06-08"), a.Instrument('eve') | a.Instrument('goes'))
res[0]
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 15472, in default
run_compiled_code(code, self.ctx, None, 'single')
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 3634, in run_compiled_code
func(code, glb, loc)
File "<xonsh-code>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 67, in __getitem__
return type(self)(ret)
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 57, in __init__
raise Exception("{} is not a valid input to UnifiedResponse.".format(type(lst)))
Exception: <class 'sunpy.net.vso.vso.QueryResponse'> is not a valid input to UnifiedResponse.

# Fixed code
def fetch(self, *query_results, **kwargs):
    """
    Download the records represented by
    `~sunpy.net.fido_factory.UnifiedResponse` objects.

    Parameters
    ----------
    query_results : `sunpy.net.fido_factory.UnifiedResponse`
        Container returned by query method, or multiple.

    wait : `bool`
        fetch will wait until the download is complete before returning.

    progress : `bool`
        Show a progress bar while the download is running.

    Returns
    -------
    `sunpy.net.fido_factory.DownloadResponse`

    Example
    --------
    >>> from sunpy.net.vso.attrs import Time, Instrument
    >>> unifresp = Fido.search(Time('2012/3/4','2012/3/6'), Instrument('AIA'))
    >>> downresp = Fido.get(unifresp)
    >>> file_paths = downresp.wait()
    """
    wait = kwargs.pop("wait", True)
    progress = kwargs.pop("progress", True)
    reslist = []
    for query_result in query_results:
        for block in query_result.responses:
            reslist.append(block.client.get(block, **kwargs))

    results = DownloadResponse(reslist)

    if wait:
        return results.wait(progress=progress)
    else:
        return results
# Buggy code
def _make_query_to_client(self, *query):
    """
    Given a query, look up the client and perform the query.

    Parameters
    ----------
    query : collection of `~sunpy.net.vso.attr` objects

    Returns
    -------
    response : `~sunpy.net.dataretriever.client.QueryResponse`

    client : Instance of client class
    """
    candidate_widget_types = self._check_registered_widgets(*query)
    tmpclient = candidate_widget_types[0]()
    return tmpclient.query(*query), tmpclient


# Traceback (Exception)
from sunpy.net import Fido, attrs as a
res = Fido.search(a.Time("2016-06-07", "2016-06-08"), a.Instrument('eve') | a.Instrument('goes'))
res[0]
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 15472, in default
run_compiled_code(code, self.ctx, None, 'single')
File "/usr/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 3634, in run_compiled_code
func(code, glb, loc)
File "<xonsh-code>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 67, in __getitem__
return type(self)(ret)
File "/usr/lib/python3.6/site-packages/sunpy/net/fido_factory.py", line 57, in __init__
raise Exception("{} is not a valid input to UnifiedResponse.".format(type(lst)))
Exception: <class 'sunpy.net.vso.vso.QueryResponse'> is not a valid input to UnifiedResponse.

# Fixed code
def _make_query_to_client(self, *query):
    """
    Given a query, look up the client and perform the query.

    Parameters
    ----------
    query : collection of `~sunpy.net.vso.attr` objects

    Returns
    -------
    response : `~sunpy.net.dataretriever.client.QueryResponse`

    client : `object`
            Instance of client class
    """
    candidate_widget_types = self._check_registered_widgets(*query)
    tmpclient = candidate_widget_types[0]()
    return tmpclient.query(*query), tmpclient
# Buggy code
def votable_handler(xml_table):
    """
    Returns a VOtable object from a VOtable style xml string

    In order to get a VOtable object, it has to be parsed from an xml file or
    file-like object. This function creates a file-like object via the
    StringIO module, writes the xml data to it, then passes the file-like
    object to parse_single_table() from the astropy.io.votable.table module
    and thereby creates a VOtable object.

    Parameters
    ----------
    xml_table : str
        Contains the VOtable style xml data

    Returns
    -------
    votable : `astropy.io.votable.tree.Table`
        A properly formatted VOtable object

    Examples
    --------
    >>> from sunpy.net.helio import hec
    >>> temp = hec.suds_unwrapper(xml_string)
    >>> type(temp)
    unicode
    >>> temp = hec.votable_handler(temp)
    >>> type(temp)
    astropy.io.votable.tree.Table
    """
    fake_file = io.StringIO()
    fake_file.write(xml_table)
    votable = parse_single_table(fake_file)
    fake_file.close()
    return votable


# Traceback (TypeError)
from sunpy.net.helio import hec
hc = hec.HECClient()
hc.get_table_names()

...
markup_type=markup_type))
a bytes-like object is required, not 'str'
Traceback (most recent call last):
File "/.../github/sunpy/env35/lib/python3.5/site-packages/suds/plugin.py", line 255, in __call__
method(ctx)
File "/.../github/sunpy/sunpy/net/helio/hec.py", line 129, in received
self.last_payload = six.u(suds_unwrapper(context.reply))
File "/.../github/sunpy/sunpy/net/helio/hec.py", line 77, in suds_unwrapper
pos_1 = wrapped_data.find(CATCH_1)
TypeError: a bytes-like object is required, not 'str'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../github/sunpy/sunpy/net/helio/hec.py", line 235, in get_table_names
tables = votable_handler(self.votable_interceptor.last_payload)
File "/.../github/sunpy/sunpy/net/helio/hec.py", line 114, in votable_handler
fake_file.write(xml_table)
TypeError: string argument expected, got 'NoneType'

# Fixed code
def votable_handler(xml_table):
    """
    Returns a VOtable object from a VOtable style xml string

    In order to get a VOtable object, it has to be parsed from an xml file or
    file-like object. This function creates a file-like object via the
    StringIO module, writes the xml data to it, then passes the file-like
    object to parse_single_table() from the astropy.io.votable.table module
    and thereby creates a VOtable object.

    Parameters
    ----------
    xml_table : str
        Contains the VOtable style xml data

    Returns
    -------
    votable : `astropy.io.votable.tree.Table`
        A properly formatted VOtable object

    Examples
    --------
    >>> from sunpy.net.helio import hec
    >>> temp = hec.suds_unwrapper(xml_string)
    >>> type(temp)
    unicode
    >>> temp = hec.votable_handler(temp)
    >>> type(temp)
    astropy.io.votable.tree.Table
    """
    fake_file = six.BytesIO()
    fake_file.write(six.b(xml_table))
    votable = parse_single_table(fake_file)
    fake_file.close()
    return votable
# Buggy code
def from_file(cls, filename):
    filename = os.path.expanduser(filename)
    header, data = cls._parse_filepath(filename)
    return cls(data, header)


# Traceback (KeyError)
In[15]  import sunpy

In[16]  from sunpy.time import TimeRange

In[17]  times = TimeRange('2010/03/04 00:10', '2010/03/04 00:20')

In[18]  goes = sunpy.lightcurve.GOESLightCurve.create(times)

In[19]  goes.peek()
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-19-0dabb23c4f23> in <module>()
----> 1 goes.peek()

/usr/lib/python3.3/site-packages/sunpy-0.2.0-py3.3-linux-x86_64.egg/sunpy/lightcurve/sources/goes.py in peek(self, title, **kwargs)
40         dates = matplotlib.dates.date2num(self.data.index)
41
---> 42         axes.plot_date(dates, self.data['A_FLUX'], '-',
43                      label='0.5--4.0 $\AA$', color='blue', lw=2)
44         axes.plot_date(dates, self.data['B_FLUX'], '-',

/usr/lib/python3.3/site-packages/pandas/core/frame.py in __getitem__(self, key)
1926         else:
1927             # get column
-> 1928             return self._get_item_cache(key)
1929
1930     def _getitem_slice(self, key):

/usr/lib/python3.3/site-packages/pandas/core/generic.py in _get_item_cache(self, item)
568             return cache[item]
569         except Exception:
--> 570             values = self._data.get(item)
571             res = self._box_item_values(item, values)
572             cache[item] = res

/usr/lib/python3.3/site-packages/pandas/core/internals.py in get(self, item)
1382
1383     def get(self, item):
-> 1384         _, block = self._find_block(item)
1385         return block.get(item)
1386

/usr/lib/python3.3/site-packages/pandas/core/internals.py in _find_block(self, item)
1524
1525     def _find_block(self, item):
-> 1526         self._check_have(item)
1527         for i, block in enumerate(self.blocks):
1528             if item in block:

/usr/lib/python3.3/site-packages/pandas/core/internals.py in _check_have(self, item)
1531     def _check_have(self, item):
1532         if item not in self.items:
-> 1533             raise KeyError('no item named %s' % com.pprint_thing(item))
1534
1535     def reindex_axis(self, new_axis, method=None, axis=0, copy=True):

KeyError: 'no item named A_FLUX'

In[20]  goes.data
Out[20]
Empty DataFrame
Columns: []
Index: []

In[21]  goes.header
Out[21] ''

# Fixed code
def from_file(cls, filename):
    filename = os.path.expanduser(filename)
    header, data = cls._parse_filepath(filename)
    if data.empty == True:
        raise ValueError("No data found!")
    else:
        return cls(data, header)
# Buggy code
def _parse_csv(filepath):
    """Parses an GOES CSV"""
    with open(filepath, "rb") as fp:
        # @todo: check for:
        # "No-Data-Found for the time period requested..." error
        return "", read_csv(fp, sep=",", index_col=0, parse_dates=True)


# Traceback (KeyError)
In[15]  import sunpy

In[16]  from sunpy.time import TimeRange

In[17]  times = TimeRange('2010/03/04 00:10', '2010/03/04 00:20')

In[18]  goes = sunpy.lightcurve.GOESLightCurve.create(times)

In[19]  goes.peek()
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-19-0dabb23c4f23> in <module>()
----> 1 goes.peek()

/usr/lib/python3.3/site-packages/sunpy-0.2.0-py3.3-linux-x86_64.egg/sunpy/lightcurve/sources/goes.py in peek(self, title, **kwargs)
40         dates = matplotlib.dates.date2num(self.data.index)
41
---> 42         axes.plot_date(dates, self.data['A_FLUX'], '-',
43                      label='0.5--4.0 $\AA$', color='blue', lw=2)
44         axes.plot_date(dates, self.data['B_FLUX'], '-',

/usr/lib/python3.3/site-packages/pandas/core/frame.py in __getitem__(self, key)
1926         else:
1927             # get column
-> 1928             return self._get_item_cache(key)
1929
1930     def _getitem_slice(self, key):

/usr/lib/python3.3/site-packages/pandas/core/generic.py in _get_item_cache(self, item)
568             return cache[item]
569         except Exception:
--> 570             values = self._data.get(item)
571             res = self._box_item_values(item, values)
572             cache[item] = res

/usr/lib/python3.3/site-packages/pandas/core/internals.py in get(self, item)
1382
1383     def get(self, item):
-> 1384         _, block = self._find_block(item)
1385         return block.get(item)
1386

/usr/lib/python3.3/site-packages/pandas/core/internals.py in _find_block(self, item)
1524
1525     def _find_block(self, item):
-> 1526         self._check_have(item)
1527         for i, block in enumerate(self.blocks):
1528             if item in block:

/usr/lib/python3.3/site-packages/pandas/core/internals.py in _check_have(self, item)
1531     def _check_have(self, item):
1532         if item not in self.items:
-> 1533             raise KeyError('no item named %s' % com.pprint_thing(item))
1534
1535     def reindex_axis(self, new_axis, method=None, axis=0, copy=True):

KeyError: 'no item named A_FLUX'

In[20]  goes.data
Out[20]
Empty DataFrame
Columns: []
Index: []

In[21]  goes.header
Out[21] ''

# Fixed code
def _parse_csv(filepath):
    """Parses an GOES CSV"""
    with open(filepath, "rb") as fp:
        return "", read_csv(fp, sep=",", index_col=0, parse_dates=True)
# Buggy code
def to_angstrom(value, unit):
    C = 299792458.0
    ANGSTROM = units["Angstrom"][1]
    try:
        type_, n = units[unit]
    except KeyError:
        raise ValueError("Cannot convert %s to Angstrom" % unit)

    if type_ == "wavelength":
        x = n / ANGSTROM
        return value / x
    elif type_ == "frequency":
        x = 1 / ANGSTROM / n
        return x * (C / value)
    elif type_ == "energy":
        x = 1 / (ANGSTROM / 1e-2) / n
        return x * (1 / (8065.53 * value))
    else:
        raise ValueError("Unable to convert %s to Angstrom" % type_)


# Traceback (KeyError)
In[15]  import sunpy

In[16]  from sunpy.time import TimeRange

In[17]  times = TimeRange('2010/03/04 00:10', '2010/03/04 00:20')

In[18]  goes = sunpy.lightcurve.GOESLightCurve.create(times)

In[19]  goes.peek()
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-19-0dabb23c4f23> in <module>()
----> 1 goes.peek()

/usr/lib/python3.3/site-packages/sunpy-0.2.0-py3.3-linux-x86_64.egg/sunpy/lightcurve/sources/goes.py in peek(self, title, **kwargs)
40         dates = matplotlib.dates.date2num(self.data.index)
41
---> 42         axes.plot_date(dates, self.data['A_FLUX'], '-',
43                      label='0.5--4.0 $\AA$', color='blue', lw=2)
44         axes.plot_date(dates, self.data['B_FLUX'], '-',

/usr/lib/python3.3/site-packages/pandas/core/frame.py in __getitem__(self, key)
1926         else:
1927             # get column
-> 1928             return self._get_item_cache(key)
1929
1930     def _getitem_slice(self, key):

/usr/lib/python3.3/site-packages/pandas/core/generic.py in _get_item_cache(self, item)
568             return cache[item]
569         except Exception:
--> 570             values = self._data.get(item)
571             res = self._box_item_values(item, values)
572             cache[item] = res

/usr/lib/python3.3/site-packages/pandas/core/internals.py in get(self, item)
1382
1383     def get(self, item):
-> 1384         _, block = self._find_block(item)
1385         return block.get(item)
1386

/usr/lib/python3.3/site-packages/pandas/core/internals.py in _find_block(self, item)
1524
1525     def _find_block(self, item):
-> 1526         self._check_have(item)
1527         for i, block in enumerate(self.blocks):
1528             if item in block:

/usr/lib/python3.3/site-packages/pandas/core/internals.py in _check_have(self, item)
1531     def _check_have(self, item):
1532         if item not in self.items:
-> 1533             raise KeyError('no item named %s' % com.pprint_thing(item))
1534
1535     def reindex_axis(self, new_axis, method=None, axis=0, copy=True):

KeyError: 'no item named A_FLUX'

In[20]  goes.data
Out[20]
Empty DataFrame
Columns: []
Index: []

In[21]  goes.header
Out[21] ''

# Fixed code
def to_angstrom(value, unit):
    """Given a value with a unit (given in a string), convert to angstroms"""
    value_quantity = value * units.Unit(unit)
    return value_quantity.to(units.angstrom, equivalencies=units.spectral()).value
# Buggy code
def _call_metadata_identity_endpoint(self, request):
    """Request ID token from metadata identity endpoint.

    Args:
        request (google.auth.transport.Request): The object used to make
            HTTP requests.

    Raises:
        google.auth.exceptions.RefreshError: If the Compute Engine metadata
            service can't be reached or if the instance has no credentials.
        ValueError: If extracting expiry from the obtained ID token fails.
    """
    try:
        id_token = _metadata.get(
            request,
            "instance/service-accounts/default/identity?audience={}&format=full".format(
                self._target_audience
            ),
        )
    except exceptions.TransportError as caught_exc:
        new_exc = exceptions.RefreshError(caught_exc)
        six.raise_from(new_exc, caught_exc)

    _, payload, _, _ = jwt._unverified_decode(id_token)
    return id_token, payload["exp"]


# Traceback (TypeError)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/google/auth/credentials.py", line 66, in expired
skewed_expiry = self.expiry - _helpers.CLOCK_SKEW
TypeError: unsupported operand type(s) for -: 'int' and 'datetime.timedelta'

# Fixed code
def _call_metadata_identity_endpoint(self, request):
    """Request ID token from metadata identity endpoint.

    Args:
        request (google.auth.transport.Request): The object used to make
            HTTP requests.

    Returns:
        Tuple[str, datetime.datetime]: The ID token and the expiry of the ID token.

    Raises:
        google.auth.exceptions.RefreshError: If the Compute Engine metadata
            service can't be reached or if the instance has no credentials.
        ValueError: If extracting expiry from the obtained ID token fails.
    """
    try:
        id_token = _metadata.get(
            request,
            "instance/service-accounts/default/identity?audience={}&format=full".format(
                self._target_audience
            ),
        )
    except exceptions.TransportError as caught_exc:
        new_exc = exceptions.RefreshError(caught_exc)
        six.raise_from(new_exc, caught_exc)

    _, payload, _, _ = jwt._unverified_decode(id_token)
    return id_token, datetime.datetime.fromtimestamp(payload["exp"])
# Buggy code
def __init__(self, config=None):
    self._lock = threading.Lock()
    self.last_update_timestamp = 0
    self.last_checkpoint_timestamp = 0
    if config is not None:
        self.config = config
    else:
        self.config = {}


# Traceback (AttributeError)
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/ocelotl/.pyenv/versions/3.8.3/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/ocelotl/codeboten/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py", line 48, in run
self.tick()
File "/home/ocelotl/codeboten/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py", line 60, in tick
self.exporter.export(self.meter.processor.checkpoint_set())
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 248, in export
return self._export(metrics)
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/exporter.py", line 166, in _export
request=self._translate_data(data),
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 201, in _translate_data
data_points=_get_data_points(sdk_metric, data_point_class),
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 71, in _get_data_points
) in sdk_metric.instrument.bound_instruments.items():
AttributeError: 'SumObserver' object has no attribute 'bound_instruments'

# Fixed code
def __init__(self, config=None):
    self._lock = threading.Lock()
    self.last_update_timestamp = 0
    self.initial_checkpoint_timestamp = 0
    self.checkpointed = True
    if config is not None:
        self.config = config
    else:
        self.config = {}
# Buggy code
def update(self, value):
    """Updates the current with the new value."""
    self.last_update_timestamp = time_ns()


# Traceback (AttributeError)
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/ocelotl/.pyenv/versions/3.8.3/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/ocelotl/codeboten/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py", line 48, in run
self.tick()
File "/home/ocelotl/codeboten/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py", line 60, in tick
self.exporter.export(self.meter.processor.checkpoint_set())
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 248, in export
return self._export(metrics)
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/exporter.py", line 166, in _export
request=self._translate_data(data),
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 201, in _translate_data
data_points=_get_data_points(sdk_metric, data_point_class),
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 71, in _get_data_points
) in sdk_metric.instrument.bound_instruments.items():
AttributeError: 'SumObserver' object has no attribute 'bound_instruments'

# Fixed code
def update(self, value):
    """Updates the current with the new value."""
    if self.checkpointed:
        self.initial_checkpoint_timestamp = time_ns()
        self.checkpointed = False
    self.last_update_timestamp = time_ns()
# Buggy code
def take_checkpoint(self):
    """Stores a snapshot of the current value."""
    self.last_checkpoint_timestamp = time_ns()


# Traceback (AttributeError)
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/ocelotl/.pyenv/versions/3.8.3/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/ocelotl/codeboten/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py", line 48, in run
self.tick()
File "/home/ocelotl/codeboten/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py", line 60, in tick
self.exporter.export(self.meter.processor.checkpoint_set())
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 248, in export
return self._export(metrics)
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/exporter.py", line 166, in _export
request=self._translate_data(data),
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 201, in _translate_data
data_points=_get_data_points(sdk_metric, data_point_class),
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 71, in _get_data_points
) in sdk_metric.instrument.bound_instruments.items():
AttributeError: 'SumObserver' object has no attribute 'bound_instruments'

# Fixed code
def take_checkpoint(self):
    """Stores a snapshot of the current value."""
    self.checkpointed = True
# Buggy code
def merge(self, other):
    """Combines two aggregator values."""
    self.last_update_timestamp = max(
        self.last_update_timestamp, other.last_update_timestamp
    )
    self.last_checkpoint_timestamp = max(
        self.last_checkpoint_timestamp, other.last_checkpoint_timestamp
    )


# Traceback (AttributeError)
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/ocelotl/.pyenv/versions/3.8.3/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/ocelotl/codeboten/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py", line 48, in run
self.tick()
File "/home/ocelotl/codeboten/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py", line 60, in tick
self.exporter.export(self.meter.processor.checkpoint_set())
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 248, in export
return self._export(metrics)
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/exporter.py", line 166, in _export
request=self._translate_data(data),
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 201, in _translate_data
data_points=_get_data_points(sdk_metric, data_point_class),
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 71, in _get_data_points
) in sdk_metric.instrument.bound_instruments.items():
AttributeError: 'SumObserver' object has no attribute 'bound_instruments'

# Fixed code
def merge(self, other):
    """Combines two aggregator values."""
    self.last_update_timestamp = max(
        self.last_update_timestamp, other.last_update_timestamp
    )
    self.initial_checkpoint_timestamp = max(
        self.initial_checkpoint_timestamp,
        other.initial_checkpoint_timestamp,
    )
# Buggy code
def __init__(
    self,
    thrift_url="",
    auth=None,
    client=jaeger.Client,
    http_transport=THttpClient.THttpClient,
):
    self.thrift_url = thrift_url
    self.auth = auth
    self.http_transport = http_transport(uri_or_host=thrift_url)
    self.client = client(
        iprot=TBinaryProtocol.TBinaryProtocol(trans=self.http_transport)
    )

    # set basic auth header
    if auth is not None:
        auth_header = "{}:{}".format(*auth)
        decoded = base64.b64encode(auth_header.encode()).decode("ascii")
        basic_auth = dict(Authorization="Basic {}".format(decoded))
        self.http_transport.setCustomHeaders(basic_auth)


# Traceback (EOFError)
Exception while exporting Span.
Traceback (most recent call last):
File "/home/tsutsumi/workspace/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py", line 81, in on_end
self.span_exporter.export((span,))
File "/home/tsutsumi/workspace/opentelemetry-python/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/__init__.py", line 118, in export
self.collector.submit(batch)
File "/home/tsutsumi/workspace/opentelemetry-python/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/__init__.py", line 377, in submit
self.client.submitBatches([batch])
File "/home/tsutsumi/workspace/opentelemetry-python/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/gen/jaeger/Collector.py", line 46, in submitBatches
return self.recv_submitBatches()
File "/home/tsutsumi/workspace/opentelemetry-python/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/gen/jaeger/Collector.py", line 60, in recv_submitBatches
(fname, mtype, rseqid) = iprot.readMessageBegin()
File "/home/tsutsumi/.pyenv/versions/3.8.1/envs/otel/lib/python3.8/site-packages/thrift/protocol/TBinaryProtocol.py", line 148, in readMessageBegin
name = self.trans.readAll(sz)
File "/home/tsutsumi/.pyenv/versions/3.8.1/envs/otel/lib/python3.8/site-packages/thrift/transport/TTransport.py", line 68, in readAll
raise EOFError()
EOFError

# Fixed code
def __init__(self, thrift_url="", auth=None):
    self.thrift_url = thrift_url
    self.auth = auth
    self.http_transport = THttpClient.THttpClient(uri_or_host=self.thrift_url)
    self.protocol = TBinaryProtocol.TBinaryProtocol(self.http_transport)

    # set basic auth header
    if auth is not None:
        auth_header = "{}:{}".format(*auth)
        decoded = base64.b64encode(auth_header.encode()).decode("ascii")
        basic_auth = dict(Authorization="Basic {}".format(decoded))
        self.http_transport.setCustomHeaders(basic_auth)
# Buggy code
def submit(self, batch: jaeger.Batch):
    """Submits batches to Thrift HTTP Server through Binary Protocol.

    Args:
        batch: Object to emit Jaeger spans.
    """
    try:
        self.client.submitBatches([batch])
        # it will call http_transport.flush() and
        # status code and message will be updated
        code = self.http_transport.code
        msg = self.http_transport.message
        if code >= 300 or code < 200:
            logger.error(
                "Traces cannot be uploaded; HTTP status code: %s, message %s",
                code,
                msg,
            )
    finally:
        if self.http_transport.isOpen():
            self.http_transport.close()


# Traceback (EOFError)
Exception while exporting Span.
Traceback (most recent call last):
File "/home/tsutsumi/workspace/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py", line 81, in on_end
self.span_exporter.export((span,))
File "/home/tsutsumi/workspace/opentelemetry-python/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/__init__.py", line 118, in export
self.collector.submit(batch)
File "/home/tsutsumi/workspace/opentelemetry-python/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/__init__.py", line 377, in submit
self.client.submitBatches([batch])
File "/home/tsutsumi/workspace/opentelemetry-python/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/gen/jaeger/Collector.py", line 46, in submitBatches
return self.recv_submitBatches()
File "/home/tsutsumi/workspace/opentelemetry-python/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/gen/jaeger/Collector.py", line 60, in recv_submitBatches
(fname, mtype, rseqid) = iprot.readMessageBegin()
File "/home/tsutsumi/.pyenv/versions/3.8.1/envs/otel/lib/python3.8/site-packages/thrift/protocol/TBinaryProtocol.py", line 148, in readMessageBegin
name = self.trans.readAll(sz)
File "/home/tsutsumi/.pyenv/versions/3.8.1/envs/otel/lib/python3.8/site-packages/thrift/transport/TTransport.py", line 68, in readAll
raise EOFError()
EOFError

# Fixed code
def submit(self, batch: jaeger.Batch):
    """Submits batches to Thrift HTTP Server through Binary Protocol.

    Args:
        batch: Object to emit Jaeger spans.
    """
    batch.write(self.protocol)
    self.http_transport.flush()
    code = self.http_transport.code
    msg = self.http_transport.message
    if code >= 300 or code < 200:
        logger.error(
            "Traces cannot be uploaded; HTTP status code: %s, message: %s",
            code,
            msg,
        )