gurudesh/pytracebugs huggingface dataset:
# Buggy code
def upload_media(self, type, media):
    """
    上传多媒体文件。
    详情请参考 http://mp.weixin.qq.com/wiki/index.php?title=上传下载多媒体文件

    :param type: 媒体文件类型，分别有图片（image）、语音（voice）、视频（video）和缩略图（thumb）
    :param media:要上传的文件，一个 File-object

    :return: 返回的 JSON 数据包
    """
    return self.post(
        url="https://api.weixin.qq.com/cgi-bin/menu/create",
        params={"access_token": self.token, "type": type},
        files={"media": media},
    )


# Traceback (UnicodeEncodeError)
In [1]: import six

In [2]: def to_text(value, encoding="utf-8"):
...:         if isinstance(value, (six.string_types, six.binary_type)):
...:                 return value.decode(encoding)
...:         if isinstance(value, int):
...:                 return six.text_type(value)
...:         assert isinstance(value, six.text_type)
...:         return value
...:

In [3]: print to_text(u'\u4e2d\u5348')
---------------------------------------------------------------------------
UnicodeEncodeError                        Traceback (most recent call last)
<ipython-input-3-9478a71004a0> in <module>()
----> 1 print to_text(u'\u4e2d\u5348')

<ipython-input-2-3b3748f845b1> in to_text(value, encoding)
1 def to_text(value, encoding="utf-8"):
2         if isinstance(value, (six.string_types, six.binary_type)):
----> 3                 return value.decode(encoding)
4         if isinstance(value, int):
5                 return six.text_type(value)

/root/.virtualenvs/wxPortal/lib/python2.7/encodings/utf_8.pyc in decode(input, errors)
14
15 def decode(input, errors='strict'):
---> 16     return codecs.utf_8_decode(input, errors, True)
17
18 class IncrementalEncoder(codecs.IncrementalEncoder):

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

# Fixed code
def upload_media(self, media_type, media_file):
    """
    上传多媒体文件。
    详情请参考 http://mp.weixin.qq.com/wiki/index.php?title=上传下载多媒体文件

    :param media_type: 媒体文件类型，分别有图片（image）、语音（voice）、视频（video）和缩略图（thumb）
    :param media_file:要上传的文件，一个 File-object

    :return: 返回的 JSON 数据包
    """
    return self.post(
        url="https://api.weixin.qq.com/cgi-bin/menu/create",
        params={"access_token": self.token, "type": media_type},
        files={"media": media_file},
    )
# Buggy code
def create_group(self, name):
    """
    创建分组
    详情请参考 http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口

    :param name: 分组名字（30个字符以内）
    :return: 返回的 JSON 数据包

    """
    name = to_unicode(name)
    return self.post(
        url="https://api.weixin.qq.com/cgi-bin/groups/create",
        data={"group": {"name": name}},
    )


# Traceback (UnicodeEncodeError)
In [1]: import six

In [2]: def to_text(value, encoding="utf-8"):
...:         if isinstance(value, (six.string_types, six.binary_type)):
...:                 return value.decode(encoding)
...:         if isinstance(value, int):
...:                 return six.text_type(value)
...:         assert isinstance(value, six.text_type)
...:         return value
...:

In [3]: print to_text(u'\u4e2d\u5348')
---------------------------------------------------------------------------
UnicodeEncodeError                        Traceback (most recent call last)
<ipython-input-3-9478a71004a0> in <module>()
----> 1 print to_text(u'\u4e2d\u5348')

<ipython-input-2-3b3748f845b1> in to_text(value, encoding)
1 def to_text(value, encoding="utf-8"):
2         if isinstance(value, (six.string_types, six.binary_type)):
----> 3                 return value.decode(encoding)
4         if isinstance(value, int):
5                 return six.text_type(value)

/root/.virtualenvs/wxPortal/lib/python2.7/encodings/utf_8.pyc in decode(input, errors)
14
15 def decode(input, errors='strict'):
---> 16     return codecs.utf_8_decode(input, errors, True)
17
18 class IncrementalEncoder(codecs.IncrementalEncoder):

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

# Fixed code
def create_group(self, name):
    """
    创建分组
    详情请参考 http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口

    :param name: 分组名字（30个字符以内）
    :return: 返回的 JSON 数据包

    """
    name = to_text(name)
    return self.post(
        url="https://api.weixin.qq.com/cgi-bin/groups/create",
        data={"group": {"name": name}},
    )
# Buggy code
def update_group(self, group_id, name):
    """
    修改分组名
    详情请参考 http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口

    :param group_id: 分组id，由微信分配
    :param name: 分组名字（30个字符以内）
    :return: 返回的 JSON 数据包
    """
    return self.post(
        url="https://api.weixin.qq.com/cgi-bin/groups/update",
        data={"group": {"id": int(group_id), "name": to_unicode(name)}},
    )


# Traceback (UnicodeEncodeError)
In [1]: import six

In [2]: def to_text(value, encoding="utf-8"):
...:         if isinstance(value, (six.string_types, six.binary_type)):
...:                 return value.decode(encoding)
...:         if isinstance(value, int):
...:                 return six.text_type(value)
...:         assert isinstance(value, six.text_type)
...:         return value
...:

In [3]: print to_text(u'\u4e2d\u5348')
---------------------------------------------------------------------------
UnicodeEncodeError                        Traceback (most recent call last)
<ipython-input-3-9478a71004a0> in <module>()
----> 1 print to_text(u'\u4e2d\u5348')

<ipython-input-2-3b3748f845b1> in to_text(value, encoding)
1 def to_text(value, encoding="utf-8"):
2         if isinstance(value, (six.string_types, six.binary_type)):
----> 3                 return value.decode(encoding)
4         if isinstance(value, int):
5                 return six.text_type(value)

/root/.virtualenvs/wxPortal/lib/python2.7/encodings/utf_8.pyc in decode(input, errors)
14
15 def decode(input, errors='strict'):
---> 16     return codecs.utf_8_decode(input, errors, True)
17
18 class IncrementalEncoder(codecs.IncrementalEncoder):

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

# Fixed code
def update_group(self, group_id, name):
    """
    修改分组名
    详情请参考 http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口

    :param group_id: 分组id，由微信分配
    :param name: 分组名字（30个字符以内）
    :return: 返回的 JSON 数据包
    """
    return self.post(
        url="https://api.weixin.qq.com/cgi-bin/groups/update",
        data={"group": {"id": int(group_id), "name": to_text(name)}},
    )
# Buggy code
def to_text(value, encoding="utf-8"):
    if isinstance(value, (six.string_types, six.binary_type)):
        return value.decode(encoding)
    if isinstance(value, int):
        return six.text_type(value)
    assert isinstance(value, six.text_type)
    return value


# Traceback (UnicodeEncodeError)
In [1]: import six

In [2]: def to_text(value, encoding="utf-8"):
...:         if isinstance(value, (six.string_types, six.binary_type)):
...:                 return value.decode(encoding)
...:         if isinstance(value, int):
...:                 return six.text_type(value)
...:         assert isinstance(value, six.text_type)
...:         return value
...:

In [3]: print to_text(u'\u4e2d\u5348')
---------------------------------------------------------------------------
UnicodeEncodeError                        Traceback (most recent call last)
<ipython-input-3-9478a71004a0> in <module>()
----> 1 print to_text(u'\u4e2d\u5348')

<ipython-input-2-3b3748f845b1> in to_text(value, encoding)
1 def to_text(value, encoding="utf-8"):
2         if isinstance(value, (six.string_types, six.binary_type)):
----> 3                 return value.decode(encoding)
4         if isinstance(value, int):
5                 return six.text_type(value)

/root/.virtualenvs/wxPortal/lib/python2.7/encodings/utf_8.pyc in decode(input, errors)
14
15 def decode(input, errors='strict'):
---> 16     return codecs.utf_8_decode(input, errors, True)
17
18 class IncrementalEncoder(codecs.IncrementalEncoder):

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

# Fixed code
def to_text(value, encoding="utf-8"):
    if isinstance(value, six.binary_type):
        return value.decode(encoding)
    if isinstance(value, six.integer_types):
        return six.text_type(value)
    assert isinstance(value, six.text_type)
    return value
# Buggy code
def to_binary(value, encoding="utf-8"):
    if isinstance(value, six.text_type):
        return value.encode(encoding)
    if isinstance(value, int):
        return six.binary_type(value)
    assert isinstance(value, six.binary_type)
    return value


# Traceback (UnicodeEncodeError)
In [1]: import six

In [2]: def to_text(value, encoding="utf-8"):
...:         if isinstance(value, (six.string_types, six.binary_type)):
...:                 return value.decode(encoding)
...:         if isinstance(value, int):
...:                 return six.text_type(value)
...:         assert isinstance(value, six.text_type)
...:         return value
...:

In [3]: print to_text(u'\u4e2d\u5348')
---------------------------------------------------------------------------
UnicodeEncodeError                        Traceback (most recent call last)
<ipython-input-3-9478a71004a0> in <module>()
----> 1 print to_text(u'\u4e2d\u5348')

<ipython-input-2-3b3748f845b1> in to_text(value, encoding)
1 def to_text(value, encoding="utf-8"):
2         if isinstance(value, (six.string_types, six.binary_type)):
----> 3                 return value.decode(encoding)
4         if isinstance(value, int):
5                 return six.text_type(value)

/root/.virtualenvs/wxPortal/lib/python2.7/encodings/utf_8.pyc in decode(input, errors)
14
15 def decode(input, errors='strict'):
---> 16     return codecs.utf_8_decode(input, errors, True)
17
18 class IncrementalEncoder(codecs.IncrementalEncoder):

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

# Fixed code
def to_binary(value, encoding="utf-8"):
    if isinstance(value, six.text_type):
        return value.encode(encoding)
    if isinstance(value, six.integer_types):
        return six.binary_type(value)
    assert isinstance(value, six.binary_type)
    return value
# Buggy code
def format(self, record):
    """Prettify the log output, annotate with simulation time"""

    msg = record.getMessage()

    # Need to colour each line in case coloring is applied in the message
    msg = "\n".join(
        [
            SimColourLogFormatter.loglevel2colour[record.levelno] % line
            for line in msg.split("\n")
        ]
    )
    level = SimColourLogFormatter.loglevel2colour[
        record.levelno
    ] % record.levelname.ljust(_LEVEL_CHARS)

    return self._format(level, record, msg, coloured=True)


# Traceback (KeyError)
Traceback (most recent call last):
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/logging/__init__.py", line 1081, in emit
msg = self.format(record)
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/logging/__init__.py", line 925, in format
return fmt.format(record)
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/site-packages/cocotb/log.py", line 251, in format
msg = '\n'.join([SimColourLogFormatter.loglevel2colour[record.levelno] % line for line in msg.split('\n')])
File "/Users/raysalemi/opt/anaconda3/lib/python3.8/site-packages/cocotb/log.py", line 251, in <listcomp>
msg = '\n'.join([SimColourLogFormatter.loglevel2colour[record.levelno] % line for line in msg.split('\n')])
KeyError: 5
Call stack:

# Fixed code
def format(self, record):
    """Prettify the log output, annotate with simulation time"""

    msg = record.getMessage()

    # Need to colour each line in case coloring is applied in the message
    msg = "\n".join(
        [
            SimColourLogFormatter.loglevel2colour.get(record.levelno, "%s") % line
            for line in msg.split("\n")
        ]
    )
    level = SimColourLogFormatter.loglevel2colour.get(
        record.levelno, "%s"
    ) % record.levelname.ljust(_LEVEL_CHARS)

    return self._format(level, record, msg, coloured=True)
# Buggy code
def format(self, record):
    """Prettify the log output, annotate with simulation time"""
    if record.args:
        msg = record.msg % record.args
    else:
        msg = record.msg

    msg = str(msg)
    level = record.levelname.ljust(_LEVEL_CHARS)

    return self._format(level, record, msg)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/usr/lib64/python3.7/logging/__init__.py", line 1034, in emit
msg = self.format(record)
File "/usr/lib64/python3.7/logging/__init__.py", line 880, in format
return fmt.format(record)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/log.py", line 201, in format
msg = '\n'.join([SimColourLogFormatter.loglevel2colour[record.levelno] % line for line in msg.split('\n')])
AttributeError: 'BinaryValue' object has no attribute 'split'
Call stack:
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/scheduler.py", line 355, in react
self._event_loop(trigger)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/scheduler.py", line 448, in _event_loop
self.schedule(coro, trigger=trigger)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/scheduler.py", line 758, in schedule
result = coroutine._advance(send_outcome)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/decorators.py", line 264, in _advance
return super(RunningTest, self)._advance(outcome)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/decorators.py", line 146, in _advance
return outcome.send(self._coro)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/outcomes.py", line 38, in send
return gen.send(self.value)
File "path/to/test_fifo.py", line 45, in test_fifo_manual
dut._log.info(dut.empty.value)

# Fixed code
def format(self, record):
    """Prettify the log output, annotate with simulation time"""

    msg = record.getMessage()
    level = record.levelname.ljust(_LEVEL_CHARS)

    return self._format(level, record, msg)
# Buggy code
def format(self, record):
    """Prettify the log output, annotate with simulation time"""

    if record.args:
        msg = record.msg % record.args
    else:
        msg = record.msg

    # Need to colour each line in case coloring is applied in the message
    msg = "\n".join(
        [
            SimColourLogFormatter.loglevel2colour[record.levelno] % line
            for line in msg.split("\n")
        ]
    )
    level = SimColourLogFormatter.loglevel2colour[
        record.levelno
    ] % record.levelname.ljust(_LEVEL_CHARS)

    return self._format(level, record, msg, coloured=True)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/usr/lib64/python3.7/logging/__init__.py", line 1034, in emit
msg = self.format(record)
File "/usr/lib64/python3.7/logging/__init__.py", line 880, in format
return fmt.format(record)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/log.py", line 201, in format
msg = '\n'.join([SimColourLogFormatter.loglevel2colour[record.levelno] % line for line in msg.split('\n')])
AttributeError: 'BinaryValue' object has no attribute 'split'
Call stack:
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/scheduler.py", line 355, in react
self._event_loop(trigger)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/scheduler.py", line 448, in _event_loop
self.schedule(coro, trigger=trigger)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/scheduler.py", line 758, in schedule
result = coroutine._advance(send_outcome)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/decorators.py", line 264, in _advance
return super(RunningTest, self)._advance(outcome)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/decorators.py", line 146, in _advance
return outcome.send(self._coro)
File "/home/philipp/.local/lib/python3.7/site-packages/cocotb/outcomes.py", line 38, in send
return gen.send(self.value)
File "path/to/test_fifo.py", line 45, in test_fifo_manual
dut._log.info(dut.empty.value)

# Fixed code
def format(self, record):
    """Prettify the log output, annotate with simulation time"""

    msg = record.getMessage()

    # Need to colour each line in case coloring is applied in the message
    msg = "\n".join(
        [
            SimColourLogFormatter.loglevel2colour[record.levelno] % line
            for line in msg.split("\n")
        ]
    )
    level = SimColourLogFormatter.loglevel2colour[
        record.levelno
    ] % record.levelname.ljust(_LEVEL_CHARS)

    return self._format(level, record, msg, coloured=True)
# Buggy code
def get_result_from_cursor(cls, cursor: Any) -> agate.Table:
    data: List[Any] = []
    column_names: List[str] = []

    if cursor.description is not None:
        column_names = [col[0] for col in cursor.description]
        rows = cursor.fetchall()
        data = cls.process_results(column_names, rows)

    return dbt.clients.agate_helper.table_from_data(data, column_names)


# Traceback (ValueError)
Traceback (most recent call last):
File \"/Users/drew/fishtown/dbt/core/dbt/node_runners.py\", line 227, in safe_run
result = self.compile_and_execute(manifest, ctx)
File \"/Users/drew/fishtown/dbt/core/dbt/node_runners.py\", line 170, in compile_and_execute
result = self.run(ctx.node, manifest)
File \"/Users/drew/fishtown/dbt/core/dbt/node_runners.py\", line 272, in run
return self.execute(compiled_node, manifest)
File \"/Users/drew/fishtown/dbt/core/dbt/rpc/node_runners.py\", line 86, in execute
compiled_node.injected_sql, fetch=True
File \"/Users/drew/fishtown/dbt/core/dbt/adapters/base/impl.py\", line 227, in execute
fetch=fetch
File \"/Users/drew/fishtown/dbt/core/dbt/adapters/sql/connections.py\", line 119, in execute
table = self.get_result_from_cursor(cursor)
File \"/Users/drew/fishtown/dbt/core/dbt/adapters/sql/connections.py\", line 110, in get_result_from_cursor
return dbt.clients.agate_helper.table_from_data(data, column_names)
File \"/Users/drew/fishtown/dbt/core/dbt/clients/agate_helper.py\", line 84, in table_from_data
return table.select(column_names)
File \"/Users/drew/fishtown/dbt/env/lib/python3.7/site-packages/agate/table/select.py\", line 21, in select
indexes = tuple(self._column_names.index(k) for k in key)
File \"/Users/drew/fishtown/dbt/env/lib/python3.7/site-packages/agate/table/select.py\", line 21, in <genexpr>
indexes = tuple(self._column_names.index(k) for k in key)
ValueError: tuple.index(x): x not in tuple

# Fixed code
def get_result_from_cursor(cls, cursor: Any) -> agate.Table:
    data: List[Any] = []
    column_names: List[str] = []

    if cursor.description is not None:
        column_names = [col[0] for col in cursor.description]
        rows = cursor.fetchall()
        data = cls.process_results(column_names, rows)

    return dbt.clients.agate_helper.table_from_data_flat(data, column_names)
# Buggy code
def _catalog_filter_table(cls, table: agate.Table, manifest: Manifest) -> agate.Table:
    """Filter the table as appropriate for catalog entries. Subclasses can
    override this to change filtering rules on a per-adapter basis.
    """
    return table.where(_catalog_filter_schemas(manifest))


# Traceback (AttributeError)
2020-03-02 09:10:33,888249 (MainThread): 'decimal.Decimal' object has no attribute 'lower'
2020-03-02 09:10:33,892358 (MainThread): Traceback (most recent call last):
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/main.py", line 80, in main
results, succeeded = handle_and_check(args)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/main.py", line 158, in handle_and_check
task, res = run_from_args(parsed)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/main.py", line 210, in run_from_args
results = task.run()
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/task/generate.py", line 201, in run
catalog_table = adapter.get_catalog(self.manifest)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/base/impl.py", line 1016, in get_catalog
results = self._catalog_filter_table(table, manifest)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/bigquery/impl.py", line 493, in _catalog_filter_table
return super()._catalog_filter_table(table, manifest)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/base/impl.py", line 998, in _catalog_filter_table
return table.where(_catalog_filter_schemas(manifest))
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/agate/table/where.py", line 25, in where
if test(row):
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/base/impl.py", line 82, in test
return (table_database.lower(), table_schema.lower()) in schemas
AttributeError: 'decimal.Decimal' object has no attribute 'lower'

# Fixed code
def _catalog_filter_table(cls, table: agate.Table, manifest: Manifest) -> agate.Table:
    """Filter the table as appropriate for catalog entries. Subclasses can
    override this to change filtering rules on a per-adapter basis.
    """
    # force database + schema to be strings
    table = table_from_rows(
        table.rows,
        table.column_names,
        text_only_columns=["table_database", "table_schema", "table_name"],
    )
    return table.where(_catalog_filter_schemas(manifest))
# Buggy code
def table_from_data(data, column_names):
    "Convert list of dictionaries into an Agate table"

    # The agate table is generated from a list of dicts, so the column order
    # from `data` is not preserved. We can use `select` to reorder the columns
    #
    # If there is no data, create an empty table with the specified columns

    if len(data) == 0:
        return agate.Table([], column_names=column_names)
    else:
        table = agate.Table.from_object(data, column_types=DEFAULT_TYPE_TESTER)
        return table.select(column_names)


# Traceback (AttributeError)
2020-03-02 09:10:33,888249 (MainThread): 'decimal.Decimal' object has no attribute 'lower'
2020-03-02 09:10:33,892358 (MainThread): Traceback (most recent call last):
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/main.py", line 80, in main
results, succeeded = handle_and_check(args)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/main.py", line 158, in handle_and_check
task, res = run_from_args(parsed)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/main.py", line 210, in run_from_args
results = task.run()
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/task/generate.py", line 201, in run
catalog_table = adapter.get_catalog(self.manifest)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/base/impl.py", line 1016, in get_catalog
results = self._catalog_filter_table(table, manifest)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/bigquery/impl.py", line 493, in _catalog_filter_table
return super()._catalog_filter_table(table, manifest)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/base/impl.py", line 998, in _catalog_filter_table
return table.where(_catalog_filter_schemas(manifest))
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/agate/table/where.py", line 25, in where
if test(row):
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/base/impl.py", line 82, in test
return (table_database.lower(), table_schema.lower()) in schemas
AttributeError: 'decimal.Decimal' object has no attribute 'lower'

# Fixed code
def table_from_data(data, column_names: Iterable[str]) -> agate.Table:
    "Convert list of dictionaries into an Agate table"

    # The agate table is generated from a list of dicts, so the column order
    # from `data` is not preserved. We can use `select` to reorder the columns
    #
    # If there is no data, create an empty table with the specified columns

    if len(data) == 0:
        return agate.Table([], column_names=column_names)
    else:
        table = agate.Table.from_object(data, column_types=DEFAULT_TYPE_TESTER)
        return table.select(column_names)
# Buggy code
def table_from_data_flat(data, column_names):
    "Convert list of dictionaries into an Agate table"

    rows = []
    for _row in data:
        row = []
        for value in list(_row.values()):
            if isinstance(value, (dict, list, tuple)):
                row.append(json.dumps(value))
            else:
                row.append(value)
        rows.append(row)

    return agate.Table(rows, column_names, column_types=DEFAULT_TYPE_TESTER)


# Traceback (AttributeError)
2020-03-02 09:10:33,888249 (MainThread): 'decimal.Decimal' object has no attribute 'lower'
2020-03-02 09:10:33,892358 (MainThread): Traceback (most recent call last):
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/main.py", line 80, in main
results, succeeded = handle_and_check(args)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/main.py", line 158, in handle_and_check
task, res = run_from_args(parsed)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/main.py", line 210, in run_from_args
results = task.run()
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/task/generate.py", line 201, in run
catalog_table = adapter.get_catalog(self.manifest)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/base/impl.py", line 1016, in get_catalog
results = self._catalog_filter_table(table, manifest)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/bigquery/impl.py", line 493, in _catalog_filter_table
return super()._catalog_filter_table(table, manifest)
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/base/impl.py", line 998, in _catalog_filter_table
return table.where(_catalog_filter_schemas(manifest))
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/agate/table/where.py", line 25, in where
if test(row):
File "/usr/local/Cellar/dbt/0.15.2_1/libexec/lib/python3.7/site-packages/dbt/adapters/base/impl.py", line 82, in test
return (table_database.lower(), table_schema.lower()) in schemas
AttributeError: 'decimal.Decimal' object has no attribute 'lower'

# Fixed code
def table_from_data_flat(data, column_names: Iterable[str]) -> agate.Table:
    "Convert list of dictionaries into an Agate table"

    rows = []
    for _row in data:
        row = []
        for value in list(_row.values()):
            if isinstance(value, (dict, list, tuple)):
                row.append(json.dumps(value))
            else:
                row.append(value)
        rows.append(row)

    return table_from_rows(rows=rows, column_names=column_names)
# Buggy code
def interpret_results(self, results):
    if results.errors:
        return False
    compile_results = results._compile_results
    if compile_results is None:
        return True

    return super().interpret_results(compile_results)


# Traceback (dbt.exceptions.InternalException)
2020-02-04 02:04:58,798143 (MainThread): Traceback (most recent call last):
File "/Users/drew/fishtown/dbt/core/dbt/main.py", line 81, in main
results, succeeded = handle_and_check(args)
File "/Users/drew/fishtown/dbt/core/dbt/main.py", line 159, in handle_and_check
task, res = run_from_args(parsed)
File "/Users/drew/fishtown/dbt/core/dbt/main.py", line 212, in run_from_args
results = task.run()
File "/Users/drew/fishtown/dbt/core/dbt/task/generate.py", line 208, in run
'self.manifest was None in run!'
dbt.exceptions.InternalException: self.manifest was None in run!

# Fixed code
def interpret_results(self, results: Optional[CatalogResults]) -> bool:
    if results is None:
        return False
    if results.errors:
        return False
    compile_results = results._compile_results
    if compile_results is None:
        return True

    return super().interpret_results(compile_results)
# Buggy code
def _super_init(self, log_path):
    logbook.TimedRotatingFileHandler.__init__(
        self,
        filename=log_path,
        level=self.level,
        filter=self.filter,
        bubble=self.bubble,
        format_string=DEBUG_LOG_FORMAT,
        date_format="%Y-%m-%d",
        backup_count=7,
        timed_filename_for_current=False,
    )
    FormatterMixin.__init__(self, DEBUG_LOG_FORMAT)


# Traceback (FileExistsError)
2019-10-25 03:10:31,150080 (MainThread): Running with dbt=0.15.0-b2
2019-10-25 03:10:31,478080 (MainThread): running dbt with arguments Namespace(cls=<class 'dbt.task.test.TestTask'>, data=False, debug=True, exclude=None, log_cache_events=False, log_format='default', models=['dim_agency_assert_agency_id'], partial_parse=None, profile=None, profiles_dir='C:\\Users\\dbt_fan\\.dbt', project_dir=None, record_timing_info=None, rpc_method='test', schema=False, single_threaded=False, strict=False, target=None, test_new_parser=False, threads=None, use_cache=True, vars='{}', version_check=True, warn_error=False, which='test', write_json=True)
2019-10-25 03:10:31,480087 (MainThread): Encountered an error:
2019-10-25 03:10:31,480087 (MainThread): [WinError 183] Cannot create a file when that file already exists: 'logs\\dbt.log' -> 'C:\\source\\my_dbt\\logs\\dbt-2019-10-24.log'
2019-10-25 03:10:31,482083 (MainThread): Traceback (most recent call last):
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\main.py", line 80, in main
results, succeeded = handle_and_check(args)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\main.py", line 158, in handle_and_check
task, res = run_from_args(parsed)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\main.py", line 204, in run_from_args
log_manager.set_path(log_path)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\logger.py", line 483, in set_path
self._file_handler.set_path(path)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\logger.py", line 383, in set_path
self._replay_buffered()
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\logger.py", line 402, in _replay_buffered
super().emit(record)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\logbook\handlers.py", line 980, in emit
self.perform_rollover(new_timestamp)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\logbook\handlers.py", line 962, in perform_rollover
os.rename(self._filename, filename)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'logs\\dbt.log' -> 'C:\\source\\my_dbt\\logs\\dbt-2019-10-24.log'

# Fixed code
def _super_init(self, log_path):
    logbook.RotatingFileHandler.__init__(
        self,
        filename=log_path,
        level=self.level,
        filter=self.filter,
        delay=True,
        max_size=self._max_size,
        backup_count=self._backup_count,
        bubble=self.bubble,
        format_string=DEBUG_LOG_FORMAT,
    )
    FormatterMixin.__init__(self, DEBUG_LOG_FORMAT)
# Buggy code
def _build_load_agate_table(model):
    def load_agate_table():
        path = model.original_file_path
        try:
            table = dbt.clients.agate_helper.from_csv(path)
        except ValueError as e:
            dbt.exceptions.raise_compiler_error(str(e))
        table.original_abspath = os.path.abspath(path)
        return table

    return load_agate_table


# Traceback (FileNotFoundError)
2019-09-04 16:36:25,854704 (MainThread): Acquiring new postgres connection "seedtable".
2019-09-04 16:36:25,854894 (MainThread): Re-using an available connection from the pool (formerly model_2).
2019-09-04 16:36:25,963811 (MainThread): Unhandled error while executing seed.minimal.seedtable
[Errno 2] No such file or directory: 'data/seedtable.csv'
2019-09-04 16:36:25,964249 (MainThread):
Traceback (most recent call last):
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 203, in safe_run
result = self.compile_and_execute(manifest, ctx)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 146, in compile_and_execute
result = self.run(ctx.node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 245, in run
return self.execute(compiled_node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 357, in execute
materialization_macro.generator(context)()
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/jinja.py", line 127, in call
return macro(*args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 575, in __call__
return self._invoke(arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 110, in _invoke
return original_invoke(self, arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 579, in _invoke
rv = self._func(*arguments)
File "<template>", line 346, in macro
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/sandbox.py", line 438, in call
return __context.call(__obj, *args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 262, in call
return __obj(*args, **kwargs)
File "/Users/jake/src/fishtown/dbt/core/dbt/context/common.py", line 364, in load_agate_table
table = dbt.clients.agate_helper.from_csv(path)
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/agate_helper.py", line 65, in from_csv
with open(abspath, encoding='utf-8') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'data/seedtable.csv'

# Fixed code
def _build_load_agate_table(
    model: Union[ParsedSeedNode, CompiledSeedNode],
) -> Callable[[], agate.Table]:
    def load_agate_table():
        path = model.seed_file_path
        try:
            table = dbt.clients.agate_helper.from_csv(path)
        except ValueError as e:
            dbt.exceptions.raise_compiler_error(str(e))
        table.original_abspath = os.path.abspath(path)
        return table

    return load_agate_table
# Buggy code
def load_agate_table():
    path = model.original_file_path
    try:
        table = dbt.clients.agate_helper.from_csv(path)
    except ValueError as e:
        dbt.exceptions.raise_compiler_error(str(e))
    table.original_abspath = os.path.abspath(path)
    return table


# Traceback (FileNotFoundError)
2019-09-04 16:36:25,854704 (MainThread): Acquiring new postgres connection "seedtable".
2019-09-04 16:36:25,854894 (MainThread): Re-using an available connection from the pool (formerly model_2).
2019-09-04 16:36:25,963811 (MainThread): Unhandled error while executing seed.minimal.seedtable
[Errno 2] No such file or directory: 'data/seedtable.csv'
2019-09-04 16:36:25,964249 (MainThread):
Traceback (most recent call last):
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 203, in safe_run
result = self.compile_and_execute(manifest, ctx)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 146, in compile_and_execute
result = self.run(ctx.node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 245, in run
return self.execute(compiled_node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 357, in execute
materialization_macro.generator(context)()
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/jinja.py", line 127, in call
return macro(*args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 575, in __call__
return self._invoke(arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 110, in _invoke
return original_invoke(self, arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 579, in _invoke
rv = self._func(*arguments)
File "<template>", line 346, in macro
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/sandbox.py", line 438, in call
return __context.call(__obj, *args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 262, in call
return __obj(*args, **kwargs)
File "/Users/jake/src/fishtown/dbt/core/dbt/context/common.py", line 364, in load_agate_table
table = dbt.clients.agate_helper.from_csv(path)
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/agate_helper.py", line 65, in from_csv
with open(abspath, encoding='utf-8') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'data/seedtable.csv'

# Fixed code
def load_agate_table():
    path = model.seed_file_path
    try:
        table = dbt.clients.agate_helper.from_csv(path)
    except ValueError as e:
        dbt.exceptions.raise_compiler_error(str(e))
    table.original_abspath = os.path.abspath(path)
    return table
# Buggy code
def parsed_instance_for(compiled: CompiledNode) -> ParsedNode:
    cls = PARSED_TYPES.get(compiled.resource_type)
    if cls is None:
        # how???
        raise ValueError("invalid resource_type: {}".format(compiled.resource_type))

    # validate=False to allow extra keys from copmiling
    return cls.from_dict(compiled.to_dict(), validate=False)


# Traceback (FileNotFoundError)
2019-09-04 16:36:25,854704 (MainThread): Acquiring new postgres connection "seedtable".
2019-09-04 16:36:25,854894 (MainThread): Re-using an available connection from the pool (formerly model_2).
2019-09-04 16:36:25,963811 (MainThread): Unhandled error while executing seed.minimal.seedtable
[Errno 2] No such file or directory: 'data/seedtable.csv'
2019-09-04 16:36:25,964249 (MainThread):
Traceback (most recent call last):
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 203, in safe_run
result = self.compile_and_execute(manifest, ctx)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 146, in compile_and_execute
result = self.run(ctx.node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 245, in run
return self.execute(compiled_node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 357, in execute
materialization_macro.generator(context)()
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/jinja.py", line 127, in call
return macro(*args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 575, in __call__
return self._invoke(arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 110, in _invoke
return original_invoke(self, arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 579, in _invoke
rv = self._func(*arguments)
File "<template>", line 346, in macro
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/sandbox.py", line 438, in call
return __context.call(__obj, *args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 262, in call
return __obj(*args, **kwargs)
File "/Users/jake/src/fishtown/dbt/core/dbt/context/common.py", line 364, in load_agate_table
table = dbt.clients.agate_helper.from_csv(path)
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/agate_helper.py", line 65, in from_csv
with open(abspath, encoding='utf-8') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'data/seedtable.csv'

# Fixed code
def parsed_instance_for(compiled: CompiledNode) -> ParsedNode:
    cls = PARSED_TYPES.get(compiled.resource_type)
    if cls is None:
        # how???
        raise ValueError("invalid resource_type: {}".format(compiled.resource_type))

    # validate=False to allow extra keys from compiling
    return cls.from_dict(compiled.to_dict(), validate=False)
# Buggy code
def search_key(self):
    # TODO: should this be project root + original_file_path?
    return self.absolute_path


# Traceback (FileNotFoundError)
2019-09-04 16:36:25,854704 (MainThread): Acquiring new postgres connection "seedtable".
2019-09-04 16:36:25,854894 (MainThread): Re-using an available connection from the pool (formerly model_2).
2019-09-04 16:36:25,963811 (MainThread): Unhandled error while executing seed.minimal.seedtable
[Errno 2] No such file or directory: 'data/seedtable.csv'
2019-09-04 16:36:25,964249 (MainThread):
Traceback (most recent call last):
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 203, in safe_run
result = self.compile_and_execute(manifest, ctx)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 146, in compile_and_execute
result = self.run(ctx.node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 245, in run
return self.execute(compiled_node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 357, in execute
materialization_macro.generator(context)()
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/jinja.py", line 127, in call
return macro(*args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 575, in __call__
return self._invoke(arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 110, in _invoke
return original_invoke(self, arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 579, in _invoke
rv = self._func(*arguments)
File "<template>", line 346, in macro
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/sandbox.py", line 438, in call
return __context.call(__obj, *args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 262, in call
return __obj(*args, **kwargs)
File "/Users/jake/src/fishtown/dbt/core/dbt/context/common.py", line 364, in load_agate_table
table = dbt.clients.agate_helper.from_csv(path)
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/agate_helper.py", line 65, in from_csv
with open(abspath, encoding='utf-8') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'data/seedtable.csv'

# Fixed code
def search_key(self) -> str:
    # TODO: should this be project name + path relative to project root?
    return self.absolute_path
# Buggy code
def original_file_path(self):
    return os.path.join(self.searched_path, self.relative_path)


# Traceback (FileNotFoundError)
2019-09-04 16:36:25,854704 (MainThread): Acquiring new postgres connection "seedtable".
2019-09-04 16:36:25,854894 (MainThread): Re-using an available connection from the pool (formerly model_2).
2019-09-04 16:36:25,963811 (MainThread): Unhandled error while executing seed.minimal.seedtable
[Errno 2] No such file or directory: 'data/seedtable.csv'
2019-09-04 16:36:25,964249 (MainThread):
Traceback (most recent call last):
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 203, in safe_run
result = self.compile_and_execute(manifest, ctx)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 146, in compile_and_execute
result = self.run(ctx.node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 245, in run
return self.execute(compiled_node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 357, in execute
materialization_macro.generator(context)()
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/jinja.py", line 127, in call
return macro(*args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 575, in __call__
return self._invoke(arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 110, in _invoke
return original_invoke(self, arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 579, in _invoke
rv = self._func(*arguments)
File "<template>", line 346, in macro
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/sandbox.py", line 438, in call
return __context.call(__obj, *args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 262, in call
return __obj(*args, **kwargs)
File "/Users/jake/src/fishtown/dbt/core/dbt/context/common.py", line 364, in load_agate_table
table = dbt.clients.agate_helper.from_csv(path)
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/agate_helper.py", line 65, in from_csv
with open(abspath, encoding='utf-8') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'data/seedtable.csv'

# Fixed code
def original_file_path(self) -> str:
    # this is mostly used for reporting errors. It doesn't show the project
    # name, should it?
    return os.path.join(self.searched_path, self.relative_path)
# Buggy code
def get_paths(self):
    searched_path = "."
    relative_path = "dbt_project.yml"
    absolute_path = os.path.normcase(
        os.path.abspath(
            os.path.join(self.project.project_root, searched_path, relative_path)
        )
    )
    path = FilePath(
        searched_path=".",
        relative_path="relative_path",
        absolute_path=absolute_path,
    )
    return [path]


# Traceback (FileNotFoundError)
2019-09-04 16:36:25,854704 (MainThread): Acquiring new postgres connection "seedtable".
2019-09-04 16:36:25,854894 (MainThread): Re-using an available connection from the pool (formerly model_2).
2019-09-04 16:36:25,963811 (MainThread): Unhandled error while executing seed.minimal.seedtable
[Errno 2] No such file or directory: 'data/seedtable.csv'
2019-09-04 16:36:25,964249 (MainThread):
Traceback (most recent call last):
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 203, in safe_run
result = self.compile_and_execute(manifest, ctx)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 146, in compile_and_execute
result = self.run(ctx.node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 245, in run
return self.execute(compiled_node, manifest)
File "/Users/jake/src/fishtown/dbt/core/dbt/node_runners.py", line 357, in execute
materialization_macro.generator(context)()
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/jinja.py", line 127, in call
return macro(*args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 575, in __call__
return self._invoke(arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 110, in _invoke
return original_invoke(self, arguments, autoescape)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 579, in _invoke
rv = self._func(*arguments)
File "<template>", line 346, in macro
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/sandbox.py", line 438, in call
return __context.call(__obj, *args, **kwargs)
File "/Users/jake/.pyenv/versions/3.6.5/envs/dbt36/lib/python3.6/site-packages/jinja2/runtime.py", line 262, in call
return __obj(*args, **kwargs)
File "/Users/jake/src/fishtown/dbt/core/dbt/context/common.py", line 364, in load_agate_table
table = dbt.clients.agate_helper.from_csv(path)
File "/Users/jake/src/fishtown/dbt/core/dbt/clients/agate_helper.py", line 65, in from_csv
with open(abspath, encoding='utf-8') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'data/seedtable.csv'

# Fixed code
def get_paths(self) -> List[FilePath]:
    path = FilePath(
        project_root=self.project.project_root,
        searched_path=".",
        relative_path="dbt_project.yml",
    )
    return [path]