gurudesh/pytracebugs huggingface dataset:
# Buggy code
def post(self):
    """Upload existing predictor"""
    predictor_file = request.files["file"]
    # @TODO: Figure out how to remove
    fpath = os.path.join(mindsdb.CONFIG.MINDSDB_TEMP_PATH, "new.zip")
    with open(fpath, "wb") as f:
        f.write(predictor_file.read())

    g.mindsdb_native.load_model(fpath)
    try:
        os.remove(fpath)
    except Exception:
        pass

    return "", 200


# Traceback (AttributeError)
2020-06-25 14:30:32,318 - INFO - Starting MindsDB Mysql proxy server on tcp://127.0.0.1:47335
2020-06-25 14:30:32,334 - INFO - Waiting for incoming connections...
127.0.0.1 - - [25/Jun/2020 14:31:14] "GET /util/ping HTTP/1.1" 200 -
Exception on /datasources/ [GET]
Traceback (most recent call last):
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask_restx/api.py", line 375, in wrapper
resp = resource(*args, **kwargs)
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask/views.py", line 89, in view
return self.dispatch_request(*args, **kwargs)
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask_restx/resource.py", line 44, in dispatch_request
resp = meth(*args, **kwargs)
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask_restx/marshalling.py", line 248, in wrapper
resp = f(*args, **kwargs)
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/mindsdb/api/http/namespaces/datasource.py", line 40, in get
return g.default_store.get_datasources()
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/werkzeug/local.py", line 347, in __getattr__
return getattr(self._get_current_object(), name)
AttributeError: '_AppCtxGlobals' object has no attribute 'default_store'
127.0.0.1 - - [25/Jun/2020 14:31:18] "GET /datasources/ HTTP/1.1" 500 -
Exception on /datasources/ [GET]

# Fixed code
def post(self):
    """Upload existing predictor"""
    predictor_file = request.files["file"]
    # @TODO: Figure out how to remove
    fpath = os.path.join(mindsdb.CONFIG.MINDSDB_TEMP_PATH, "new.zip")
    with open(fpath, "wb") as f:
        f.write(predictor_file.read())

    ca.mindsdb_native.load_model(fpath)
    try:
        os.remove(fpath)
    except Exception:
        pass

    return "", 200
# Buggy code
def get(self, name):
    """Export predictor to file"""
    try:
        new_name = request.args.get("new_name")
        g.mindsdb_native.rename_model(name, new_name)
    except Exception as e:
        return str(e), 400

    return f"Renamed model to {new_name}", 200


# Traceback (AttributeError)
2020-06-25 14:30:32,318 - INFO - Starting MindsDB Mysql proxy server on tcp://127.0.0.1:47335
2020-06-25 14:30:32,334 - INFO - Waiting for incoming connections...
127.0.0.1 - - [25/Jun/2020 14:31:14] "GET /util/ping HTTP/1.1" 200 -
Exception on /datasources/ [GET]
Traceback (most recent call last):
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask_restx/api.py", line 375, in wrapper
resp = resource(*args, **kwargs)
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask/views.py", line 89, in view
return self.dispatch_request(*args, **kwargs)
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask_restx/resource.py", line 44, in dispatch_request
resp = meth(*args, **kwargs)
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/flask_restx/marshalling.py", line 248, in wrapper
resp = f(*args, **kwargs)
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/mindsdb/api/http/namespaces/datasource.py", line 40, in get
return g.default_store.get_datasources()
File "/home/zoran/MyProjects/mindsdb-examples/new/lib/python3.7/site-packages/werkzeug/local.py", line 347, in __getattr__
return getattr(self._get_current_object(), name)
AttributeError: '_AppCtxGlobals' object has no attribute 'default_store'
127.0.0.1 - - [25/Jun/2020 14:31:18] "GET /datasources/ HTTP/1.1" 500 -
Exception on /datasources/ [GET]

# Fixed code
def get(self, name):
    """Export predictor to file"""
    try:
        new_name = request.args.get("new_name")
        ca.mindsdb_native.rename_model(name, new_name)
    except Exception as e:
        return str(e), 400

    return f"Renamed model to {new_name}", 200
# Buggy code
def connect(self):
    """Return a raw database connection object."""
    return sqlite3.connect(self.filename, timeout=10)


# Traceback (OperationalError)
Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 150, in set_nick_value
nick_id = self.get_nick_id(nick)
File "/home/TrollOP/willie/willie/db.py", line 114, in get_nick_id
[slug]).fetchone()
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/weather.py", line 129, in weather
woeid = bot.db.get_nick_value(trigger.nick, 'woeid')
File "/home/TrollOP/willie/willie/db.py", line 161, in get_nick_value
[nick.lower(), key]
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 152, in set_nick_value
[nick_id, key, value])
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

# Fixed code
def connect(self):
    """Return a raw database connection object."""
    return self.engine.connect()
# Buggy code
def execute(self, *args, **kwargs):
    """Execute an arbitrary SQL query against the database.

    Returns a cursor object, on which things like `.fetchall()` can be
    called per PEP 249."""
    with self.connect() as conn:
        cur = conn.cursor()
        return cur.execute(*args, **kwargs)


# Traceback (OperationalError)
Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 150, in set_nick_value
nick_id = self.get_nick_id(nick)
File "/home/TrollOP/willie/willie/db.py", line 114, in get_nick_id
[slug]).fetchone()
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/weather.py", line 129, in weather
woeid = bot.db.get_nick_value(trigger.nick, 'woeid')
File "/home/TrollOP/willie/willie/db.py", line 161, in get_nick_value
[nick.lower(), key]
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 152, in set_nick_value
[nick_id, key, value])
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

# Fixed code
def execute(self, *args, **kwargs):
    """Execute an arbitrary SQL query against the database.

    Returns a cursor object, on which things like `.fetchall()` can be
    called per PEP 249."""
    with self.connect() as conn:
        return conn.execute(*args, **kwargs)
# Buggy code
def alias_nick(self, nick, alias):
    """Create an alias for a nick.

    Raises ValueError if the alias already exists. If nick does not already
    exist, it will be added along with the alias."""
    nick = Identifier(nick)
    alias = Identifier(alias)
    nick_id = self.get_nick_id(nick)
    sql = "INSERT INTO nicknames (nick_id, slug, canonical) VALUES (?, ?, ?)"
    values = [nick_id, alias.lower(), alias]
    try:
        self.execute(sql, values)
    except sqlite3.IntegrityError:
        raise ValueError("Alias already exists.")


# Traceback (OperationalError)
Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 150, in set_nick_value
nick_id = self.get_nick_id(nick)
File "/home/TrollOP/willie/willie/db.py", line 114, in get_nick_id
[slug]).fetchone()
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/weather.py", line 129, in weather
woeid = bot.db.get_nick_value(trigger.nick, 'woeid')
File "/home/TrollOP/willie/willie/db.py", line 161, in get_nick_value
[nick.lower(), key]
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 152, in set_nick_value
[nick_id, key, value])
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

# Fixed code
def alias_nick(self, nick, alias):
    """Create an alias for a nick.

    Raises ValueError if the alias already exists. If nick does not already
    exist, it will be added along with the alias."""
    nick = Identifier(nick)
    alias = Identifier(alias)
    nick_id = self.get_nick_id(nick)
    session = self.ssession()
    try:
        result = (
            session.query(Nicknames)
            .filter(Nicknames.slug == alias.lower())
            .filter(Nicknames.canonical == alias)
            .one_or_none()
        )
        if result:
            raise ValueError("Given alias is the only entry in its group.")
        nickname = Nicknames(nick_id=nick_id, slug=alias.lower(), canonical=alias)
        session.add(nickname)
        session.commit()
    except SQLAlchemyError:
        session.rollback()
        raise
    finally:
        session.close()
# Buggy code
def set_nick_value(self, nick, key, value):
    """Sets the value for a given key to be associated with the nick."""
    nick = Identifier(nick)
    value = json.dumps(value, ensure_ascii=False)
    nick_id = self.get_nick_id(nick)
    self.execute(
        "INSERT OR REPLACE INTO nick_values VALUES (?, ?, ?)", [nick_id, key, value]
    )


# Traceback (OperationalError)
Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 150, in set_nick_value
nick_id = self.get_nick_id(nick)
File "/home/TrollOP/willie/willie/db.py", line 114, in get_nick_id
[slug]).fetchone()
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/weather.py", line 129, in weather
woeid = bot.db.get_nick_value(trigger.nick, 'woeid')
File "/home/TrollOP/willie/willie/db.py", line 161, in get_nick_value
[nick.lower(), key]
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 152, in set_nick_value
[nick_id, key, value])
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

# Fixed code
def set_nick_value(self, nick, key, value):
    """Sets the value for a given key to be associated with the nick."""
    nick = Identifier(nick)
    value = json.dumps(value, ensure_ascii=False)
    nick_id = self.get_nick_id(nick)
    session = self.ssession()
    try:
        result = (
            session.query(NickValues)
            .filter(NickValues.nick_id == nick_id)
            .filter(NickValues.key == key)
            .one_or_none()
        )
        # NickValue exists, update
        if result:
            result.value = value
            session.commit()
        # DNE - Insert
        else:
            new_nickvalue = NickValues(nick_id=nick_id, key=key, value=value)
            session.add(new_nickvalue)
            session.commit()
    except SQLAlchemyError:
        session.rollback()
        raise
    finally:
        session.close()
# Buggy code
def get_nick_value(self, nick, key):
    """Retrieves the value for a given key associated with a nick."""
    nick = Identifier(nick)
    result = self.execute(
        "SELECT value FROM nicknames JOIN nick_values "
        "ON nicknames.nick_id = nick_values.nick_id "
        "WHERE slug = ? AND key = ?",
        [nick.lower(), key],
    ).fetchone()
    if result is not None:
        result = result[0]
    return _deserialize(result)


# Traceback (OperationalError)
Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 150, in set_nick_value
nick_id = self.get_nick_id(nick)
File "/home/TrollOP/willie/willie/db.py", line 114, in get_nick_id
[slug]).fetchone()
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/weather.py", line 129, in weather
woeid = bot.db.get_nick_value(trigger.nick, 'woeid')
File "/home/TrollOP/willie/willie/db.py", line 161, in get_nick_value
[nick.lower(), key]
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 152, in set_nick_value
[nick_id, key, value])
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

# Fixed code
def get_nick_value(self, nick, key):
    """Retrieves the value for a given key associated with a nick."""
    nick = Identifier(nick)
    session = self.ssession()
    try:
        result = (
            session.query(NickValues)
            .filter(Nicknames.nick_id == NickValues.nick_id)
            .filter(Nicknames.slug == nick.lower())
            .filter(NickValues.key == key)
            .one_or_none()
        )
        if result is not None:
            result = result.value
        return _deserialize(result)
    except SQLAlchemyError:
        session.rollback()
        raise
    finally:
        session.close()
# Buggy code
def unalias_nick(self, alias):
    """Removes an alias.

    Raises ValueError if there is not at least one other nick in the group.
    To delete an entire group, use `delete_group`.
    """
    alias = Identifier(alias)
    nick_id = self.get_nick_id(alias, False)
    count = self.execute(
        "SELECT COUNT(*) FROM nicknames WHERE nick_id = ?", [nick_id]
    ).fetchone()[0]
    if count <= 1:
        raise ValueError("Given alias is the only entry in its group.")
    self.execute("DELETE FROM nicknames WHERE slug = ?", [alias.lower()])


# Traceback (OperationalError)
Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 150, in set_nick_value
nick_id = self.get_nick_id(nick)
File "/home/TrollOP/willie/willie/db.py", line 114, in get_nick_id
[slug]).fetchone()
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/weather.py", line 129, in weather
woeid = bot.db.get_nick_value(trigger.nick, 'woeid')
File "/home/TrollOP/willie/willie/db.py", line 161, in get_nick_value
[nick.lower(), key]
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 152, in set_nick_value
[nick_id, key, value])
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

# Fixed code
def unalias_nick(self, alias):
    """Removes an alias.

    Raises ValueError if there is not at least one other nick in the group.
    To delete an entire group, use `delete_group`.
    """
    alias = Identifier(alias)
    nick_id = self.get_nick_id(alias, False)
    session = self.ssession()
    try:
        count = session.query(Nicknames).filter(Nicknames.nick_id == nick_id).count()
        if count <= 1:
            raise ValueError("Given alias is the only entry in its group.")
        session.query(Nicknames).filter(Nicknames.slug == alias.lower()).delete()
        session.commit()
    except SQLAlchemyError:
        session.rollback()
        raise
    finally:
        session.close()
# Buggy code
def delete_nick_group(self, nick):
    """Removes a nickname, and all associated aliases and settings."""
    nick = Identifier(nick)
    nick_id = self.get_nick_id(nick, False)
    self.execute("DELETE FROM nicknames WHERE nick_id = ?", [nick_id])
    self.execute("DELETE FROM nick_values WHERE nick_id = ?", [nick_id])


# Traceback (OperationalError)
Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 150, in set_nick_value
nick_id = self.get_nick_id(nick)
File "/home/TrollOP/willie/willie/db.py", line 114, in get_nick_id
[slug]).fetchone()
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/weather.py", line 129, in weather
woeid = bot.db.get_nick_value(trigger.nick, 'woeid')
File "/home/TrollOP/willie/willie/db.py", line 161, in get_nick_value
[nick.lower(), key]
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 152, in set_nick_value
[nick_id, key, value])
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

# Fixed code
def delete_nick_group(self, nick):
    """Removes a nickname, and all associated aliases and settings."""
    nick = Identifier(nick)
    nick_id = self.get_nick_id(nick, False)
    session = self.ssession()
    try:
        session.query(Nicknames).filter(Nicknames.nick_id == nick_id).delete()
        session.query(NickValues).filter(NickValues.nick_id == nick_id).delete()
        session.commit()
    except SQLAlchemyError:
        session.rollback()
        raise
    finally:
        session.close()
# Buggy code
def set_channel_value(self, channel, key, value):
    """Sets the value for a given key to be associated with the channel."""
    channel = Identifier(channel).lower()
    value = json.dumps(value, ensure_ascii=False)
    self.execute(
        "INSERT OR REPLACE INTO channel_values VALUES (?, ?, ?)", [channel, key, value]
    )


# Traceback (OperationalError)
Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 150, in set_nick_value
nick_id = self.get_nick_id(nick)
File "/home/TrollOP/willie/willie/db.py", line 114, in get_nick_id
[slug]).fetchone()
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/weather.py", line 129, in weather
woeid = bot.db.get_nick_value(trigger.nick, 'woeid')
File "/home/TrollOP/willie/willie/db.py", line 161, in get_nick_value
[nick.lower(), key]
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 152, in set_nick_value
[nick_id, key, value])
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

# Fixed code
def set_channel_value(self, channel, key, value):
    """Sets the value for a given key to be associated with the channel."""
    channel = Identifier(channel).lower()
    value = json.dumps(value, ensure_ascii=False)
    session = self.ssession()
    try:
        result = (
            session.query(ChannelValues)
            .filter(ChannelValues.channel == channel)
            .filter(ChannelValues.key == key)
            .one_or_none()
        )
        # ChannelValue exists, update
        if result:
            result.value = value
            session.commit()
        # DNE - Insert
        else:
            new_channelvalue = ChannelValues(channel=channel, key=key, value=value)
            session.add(new_channelvalue)
            session.commit()
    except SQLAlchemyError:
        session.rollback()
        raise
    finally:
        session.close()
# Buggy code
def get_channel_value(self, channel, key):
    """Retrieves the value for a given key associated with a channel."""
    channel = Identifier(channel).lower()
    result = self.execute(
        "SELECT value FROM channel_values WHERE channel = ? AND key = ?", [channel, key]
    ).fetchone()
    if result is not None:
        result = result[0]
    return _deserialize(result)


# Traceback (OperationalError)
Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 150, in set_nick_value
nick_id = self.get_nick_id(nick)
File "/home/TrollOP/willie/willie/db.py", line 114, in get_nick_id
[slug]).fetchone()
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/weather.py", line 129, in weather
woeid = bot.db.get_nick_value(trigger.nick, 'woeid')
File "/home/TrollOP/willie/willie/db.py", line 161, in get_nick_value
[nick.lower(), key]
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 152, in set_nick_value
[nick_id, key, value])
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

# Fixed code
def get_channel_value(self, channel, key):
    """Retrieves the value for a given key associated with a channel."""
    channel = Identifier(channel).lower()
    session = self.ssession()
    try:
        result = (
            session.query(ChannelValues)
            .filter(ChannelValues.channel == channel)
            .filter(ChannelValues.key == key)
            .one_or_none()
        )
        if result is not None:
            result = result.value
        return _deserialize(result)
    except SQLAlchemyError:
        session.rollback()
        raise
    finally:
        session.close()
# Buggy code
def connect(self):
    """Return a raw database connection object."""
    return sqlite3.connect(self.filename)


# Traceback (OperationalError)
Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 150, in set_nick_value
nick_id = self.get_nick_id(nick)
File "/home/TrollOP/willie/willie/db.py", line 114, in get_nick_id
[slug]).fetchone()
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/weather.py", line 129, in weather
woeid = bot.db.get_nick_value(trigger.nick, 'woeid')
File "/home/TrollOP/willie/willie/db.py", line 161, in get_nick_value
[nick.lower(), key]
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

Traceback (most recent call last):
File "/home/TrollOP/willie/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/home/TrollOP/willie/willie/modules/seen.py", line 50, in note
bot.db.set_nick_value(trigger.nick, 'seen_timestamp', time.time())
File "/home/TrollOP/willie/willie/db.py", line 152, in set_nick_value
[nick_id, key, value])
File "/home/TrollOP/willie/willie/db.py", line 64, in execute
return cur.execute(*args, **kwargs)
OperationalError: database is locked

# Fixed code
def connect(self):
    """Return a raw database connection object."""
    return sqlite3.connect(self.filename, timeout=10)
# Buggy code
def unregister(self, obj):
    if hasattr(obj, "rule"):  # commands and intents have it added
        for rule in obj.rule:
            self._callables[obj.priority][rule].remove(obj)
    if hasattr(obj, "interval"):
        # TODO this should somehow find the right job to remove, rather than
        # clearing the entire queue. Issue #831
        self.scheduler.clear_jobs()
    if getattr(obj, "__name__", None) == "shutdown":
        self.shutdown_methods.remove(obj)


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/embo/prog/env/local/lib/python2.7/site-packages/sopel/bot.py", line 257, in call
exit_code = func(sopel, trigger)
File "/home/embo/prog/env/local/lib/python2.7/site-packages/sopel/modules/reload.py", line 49, in f_reload
bot.unregister(obj)
File "/home/embo/prog/env/local/lib/python2.7/site-packages/sopel/bot.py", line 169, in unregister
for rule in obj.rule:
TypeError: 'function' object is not iterable

# Fixed code
def unregister(self, obj):
    if not callable(obj):
        return
    if hasattr(obj, "rule"):  # commands and intents have it added
        for rule in obj.rule:
            callb_list = self._callables[obj.priority][rule]
            if obj in callb_list:
                callb_list.remove(obj)
    if hasattr(obj, "interval"):
        # TODO this should somehow find the right job to remove, rather than
        # clearing the entire queue. Issue #831
        self.scheduler.clear_jobs()
    if getattr(obj, "__name__", None) == "shutdown" and obj in self.shutdown_methods:
        self.shutdown_methods.remove(obj)
# Buggy code
def compile_rule(nick, pattern):
    pattern = pattern.replace("$nickname", nick)
    pattern = pattern.replace("$nick", r"{}[,:]\s+".format(nick))
    flags = re.IGNORECASE
    if "\n" in pattern:
        flags |= re.VERBOSE
    return re.compile(pattern, flags)


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/embo/prog/env/local/lib/python2.7/site-packages/sopel/bot.py", line 257, in call
exit_code = func(sopel, trigger)
File "/home/embo/prog/env/local/lib/python2.7/site-packages/sopel/modules/reload.py", line 49, in f_reload
bot.unregister(obj)
File "/home/embo/prog/env/local/lib/python2.7/site-packages/sopel/bot.py", line 169, in unregister
for rule in obj.rule:
TypeError: 'function' object is not iterable

# Fixed code
def compile_rule(nick, pattern):
    # Not sure why this happens on reloads, but it shouldn't cause problems…
    if isinstance(pattern, _regex_type):
        return pattern

    pattern = pattern.replace("$nickname", nick)
    pattern = pattern.replace("$nick", r"{}[,:]\s+".format(nick))
    flags = re.IGNORECASE
    if "\n" in pattern:
        flags |= re.VERBOSE
    return re.compile(pattern, flags)
# Buggy code
def setup(bot):
    return
    bot.config.define_section("admin", AdminSection)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/embo/prog/willie/sopel/bot.py", line 257, in call
exit_code = func(sopel, trigger)
File "/home/embo/prog/willie/sopel/modules/admin.py", line 149, in hold_ground
if bot.config.admin.hold_ground:
File "/home/embo/prog/willie/sopel/config/__init__.py", line 168, in __getattr__
% (type(self).__name__, name))
AttributeError: 'Config' object has no attribute 'admin'

# Fixed code
def setup(bot):
    bot.config.define_section("admin", AdminSection)
# Buggy code
def configure(config):
    config.define_section("meetbot", MeetbotSection)
    config.meetbot.configure_setting("meeting_log_path")
    config.meetbot.configure_setting("meeting_log_baseurl")


# Traceback (TypeError)
Configure safety module (y/n)? [n]y
Encountered an error while writing the config file. This shouldn't happen. Check permissions.
Traceback (most recent call last):
File "/usr/local/bin/sopel", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.4/dist-packages/sopel/run_script.py", line 133, in main
_create_config(configpath)
File "/usr/local/lib/python3.4/dist-packages/sopel/config/__init__.py", line 254, in _create_config
config._modules()
File "/usr/local/lib/python3.4/dist-packages/sopel/config/__init__.py", line 207, in _modules
module.configure(self)
File "/usr/local/lib/python3.4/dist-packages/sopel/modules/safety.py", line 49, in configure
config.safety.configure_setting('enabled_by_default')
File "/usr/local/lib/python3.4/dist-packages/sopel/config/types.py", line 96, in configure_setting
value = clazz.configure(prompt, default)
File "/usr/local/lib/python3.4/dist-packages/sopel/config/types.py", line 205, in configure
prompt += ' (y/n)'
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'

# Fixed code
def configure(config):
    config.define_section("meetbot", MeetbotSection)
    config.meetbot.configure_setting(
        "meeting_log_path", "Enter the directory to store logs in."
    )
    config.meetbot.configure_setting(
        "meeting_log_baseurl",
        "Enter the base URL for the meeting logs.",
    )
# Buggy code
def configure(config):
    config.define_section("safety", SafetySection)
    config.safety.configure_setting("enabled_by_default")
    config.safety.configure_setting("known_good")
    config.safety.configure_setting(
        "vt_api_key",
        "Optionaly, enter a VirusTotal API key to improve malicious URL "
        "protection. Otherwise, only the Malwarebytes DB will be used.",
    )


# Traceback (TypeError)
Configure safety module (y/n)? [n]y
Encountered an error while writing the config file. This shouldn't happen. Check permissions.
Traceback (most recent call last):
File "/usr/local/bin/sopel", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.4/dist-packages/sopel/run_script.py", line 133, in main
_create_config(configpath)
File "/usr/local/lib/python3.4/dist-packages/sopel/config/__init__.py", line 254, in _create_config
config._modules()
File "/usr/local/lib/python3.4/dist-packages/sopel/config/__init__.py", line 207, in _modules
module.configure(self)
File "/usr/local/lib/python3.4/dist-packages/sopel/modules/safety.py", line 49, in configure
config.safety.configure_setting('enabled_by_default')
File "/usr/local/lib/python3.4/dist-packages/sopel/config/types.py", line 96, in configure_setting
value = clazz.configure(prompt, default)
File "/usr/local/lib/python3.4/dist-packages/sopel/config/types.py", line 205, in configure
prompt += ' (y/n)'
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'

# Fixed code
def configure(config):
    config.define_section("safety", SafetySection)
    config.safety.configure_setting(
        "enabled_by_default",
        "Enable URL safety in channels that don't specifically disable it?",
    )
    config.safety.configure_setting(
        "known_good",
        "Enter any domains to whitelist",
    )
    config.safety.configure_setting(
        "vt_api_key",
        "Optionaly, enter a VirusTotal API key to improve malicious URL "
        "protection. Otherwise, only the Malwarebytes DB will be used.",
    )
# Buggy code
def mw_info(bot, trigger, found_match=None):
    """
    Retrives a snippet of the specified length from the given page on the given
    server.
    """
    match = found_match or trigger
    say_snippet(bot, match.group(1), match.group(2), show_url=False)


# Traceback (KeyError)
Signature: KeyError: u'extract' (file "/usr/local/lib/python2.7/dist-packages/willie/modules/wikipedia.py", line 83, in mw_snippet)
from Tomi at 2015-01-28 18:29:59.907542. Message was: http://en.wikipedia.org/wiki/Troll_%28Internet%29
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/willie/bot.py", line 634, in call
exit_code = func(willie, trigger)
File "/usr/local/lib/python2.7/dist-packages/willie/modules/wikipedia.py", line 93, in mw_info
say_snippet(bot, match.group(1), match.group(2), show_url=False)
File "/usr/local/lib/python2.7/dist-packages/willie/modules/wikipedia.py", line 60, in say_snippet
snippet = mw_snippet(server, query)
File "/usr/local/lib/python2.7/dist-packages/willie/modules/wikipedia.py", line 83, in mw_snippet
return snippet['extract']
KeyError: u'extract'

# Fixed code
def mw_info(bot, trigger, found_match=None):
    """
    Retrives a snippet of the specified length from the given page on the given
    server.
    """
    match = found_match or trigger
    say_snippet(bot, match.group(1), unquote(match.group(2)), show_url=False)
# Buggy code
def get_fpath(bot, trigger, channel=None):
    """
    Returns a string corresponding to the path to the file where the message
    currently being handled should be logged.
    """
    basedir = os.path.expanduser(bot.config.chanlogs.dir)
    channel = channel or trigger.sender
    channel = channel.lstrip("#")

    dt = datetime.utcnow()
    if not bot.config.chanlogs.microseconds:
        dt = dt.replace(microsecond=0)
    if bot.config.chanlogs.by_day:
        fname = "{channel}-{date}.log".format(
            channel=channel, date=dt.date().isoformat()
        )
    else:
        fname = "{channel}.log".format(channel=channel)
    return os.path.join(basedir, fname)


# Traceback (IOError)
Traceback (most recent call last):
File "/home/amphy/willie/willie/bot.py", line 747, in call
exit_code = func(willie, trigger)
File "/home/amphy/willie/willie/modules/chanlogs.py", line 115, in log_join
with open(fpath, "a") as f:
IOError: [Errno 2] No such file or directory: u'/vp/-2014-03-21.log'

# Fixed code
def get_fpath(bot, trigger, channel=None):
    """
    Returns a string corresponding to the path to the file where the message
    currently being handled should be logged.
    """
    basedir = os.path.expanduser(bot.config.chanlogs.dir)
    channel = channel or trigger.sender
    channel = channel.lstrip("#")
    channel = BAD_CHARS.sub("__")

    dt = datetime.utcnow()
    if not bot.config.chanlogs.microseconds:
        dt = dt.replace(microsecond=0)
    if bot.config.chanlogs.by_day:
        fname = "{channel}-{date}.log".format(
            channel=channel, date=dt.date().isoformat()
        )
    else:
        fname = "{channel}.log".format(channel=channel)
    return os.path.join(basedir, fname)
# Buggy code
def auth_proceed(bot, trigger):
    if trigger.args[0] != "+":
        # How did we get here? I am not good with computer.
        return
    # Is this right?
    if bot.config.core.sasl_username:
        sasl_username = bot.config.core.sasl_username
    else:
        sasl_username = bot.nick
    sasl_token = "\0".join(
        (sasl_username, sasl_username, bot.config.core.sasl_password)
    )
    # Spec says we do a base 64 encode on the SASL stuff
    bot.write(("AUTHENTICATE", base64.b64encode(sasl_token)))


# Traceback (TypeError)
Traceback (most recent call last):
File "/opt/rh/python33/root/usr/lib/python3.3/site-packages/willie/bot.py", line 743, in call
exit_code = func(willie, trigger)
File "/opt/rh/python33/root/usr/lib/python3.3/site-packages/willie/coretasks.py", line 432, in auth_proceed
bot.write(('AUTHENTICATE', base64.b64encode(sasl_token)))
File "/opt/rh/python33/root/usr/lib64/python3.3/base64.py", line 58, in b64encode
raise TypeError("expected bytes, not %s" % s.__class__.__name__)
TypeError: expected bytes, not str

# Fixed code
def auth_proceed(bot, trigger):
    if trigger.args[0] != "+":
        # How did we get here? I am not good with computer.
        return
    # Is this right?
    if bot.config.core.sasl_username:
        sasl_username = bot.config.core.sasl_username
    else:
        sasl_username = bot.nick
    sasl_token = "\0".join(
        (sasl_username, sasl_username, bot.config.core.sasl_password)
    )
    # Spec says we do a base 64 encode on the SASL stuff
    bot.write(("AUTHENTICATE", base64.b64encode(sasl_token.encode("utf-8"))))
# Buggy code
def track_part(bot, trigger):
    if trigger.nick == bot.nick:
        bot.channels.remove(trigger.sender)
        del bot.privileges[trigger.sender]
    else:
        del bot.privileges[trigger.sender][trigger.nick]


# Traceback (KeyError)
Signature: KeyError: u'ict' (file "/home/ict/build/willie/willie/modules/adminchannel.py", line 28, in op)
from #mytestchannel at 2013-11-11 23:27:34.803790:
Message was: <ict> .op
Traceback (most recent call last):
File "/home/ict/build/willie/willie/bot.py", line 697, in call
exit_code = func(willie, trigger)
File "/home/ict/build/willie/willie/modules/adminchannel.py", line 28, in op
if (bot.privileges[trigger.sender][trigger.nick] >= OP) or trigger.admin or trigger.owner:
KeyError: u'ict'

# Fixed code
def track_part(bot, trigger):
    if trigger.nick == bot.nick:
        bot.channels.remove(trigger.sender)
        del bot.privileges[trigger.sender]
    else:
        try:
            del bot.privileges[trigger.sender][trigger.nick]
        except KeyError:
            pass
# Buggy code
def show_bug(willie, trigger):
    """Show information about a Bugzilla bug."""
    domain = trigger.group(1)
    if domain not in willie.config.bugzilla.get_list("domains"):
        return
    url = "https://%s%sctype=xml&%s" % trigger.groups()
    data = web.get(url)
    bug = etree.fromstring(data).find("bug")

    message = (
        "[BUGZILLA] %s | Product: %s | Component: %s | Version: %s | "
        + "Importance: %s |  Status: %s | Assigned to: %s | "
        + "Reported: %s | Modified: %s"
    )

    if bug.find("resolution") is not None:
        status = bug.find("bug_status").text + " " + bug.find("resolution").text
    else:
        status = bug.find("bug_status").text

    message = message % (
        bug.find("short_desc").text,
        bug.find("product").text,
        bug.find("component").text,
        bug.find("version").text,
        (bug.find("priority").text + " " + bug.find("bug_severity").text),
        status,
        bug.find("assigned_to").text,
        bug.find("creation_ts").text,
        bug.find("delta_ts").text,
    )
    willie.say(message)


# Traceback (TypeError)
Signature: TypeError: cannot concatenate 'str' and 'NoneType' objects (file "/home/elad/willie/willie/modules/bugzilla.py", line 60, in show_bug)
from #fedora-sound at 2013-05-05 15:08:37.018372:
Message was: <elad661> https://bugzilla.redhat.com/show_bug.cgi?id=951827
Traceback (most recent call last):
File "/home/elad/willie/willie/bot.py", line 420, in call
exit_code = func(willie, trigger)
File "/home/elad/willie/willie/modules/bugzilla.py", line 60, in show_bug
status = bug.find('bug_status').text + ' ' + bug.find('resolution').text
TypeError: cannot concatenate 'str' and 'NoneType' objects
----------------------------------------

# Fixed code
def show_bug(willie, trigger):
    """Show information about a Bugzilla bug."""
    domain = trigger.group(1)
    if domain not in willie.config.bugzilla.get_list("domains"):
        return
    url = "https://%s%sctype=xml&%s" % trigger.groups()
    data = web.get(url)
    bug = etree.fromstring(data).find("bug")

    message = (
        "[BUGZILLA] %s | Product: %s | Component: %s | Version: %s | "
        + "Importance: %s |  Status: %s | Assigned to: %s | "
        + "Reported: %s | Modified: %s"
    )

    resolution = bug.find("resolution")
    if resolution is not None and resolution.text:
        status = bug.find("bug_status").text + " " + resolution.text
    else:
        status = bug.find("bug_status").text

    message = message % (
        bug.find("short_desc").text,
        bug.find("product").text,
        bug.find("component").text,
        bug.find("version").text,
        (bug.find("priority").text + " " + bug.find("bug_severity").text),
        status,
        bug.find("assigned_to").text,
        bug.find("creation_ts").text,
        bug.find("delta_ts").text,
    )
    willie.say(message)
# Buggy code
def scan(self, scanned_file, entity, skipped_checks, runner_filter):
    (entity_type, entity_name, entity_configuration) = self.extract_entity_details(
        entity
    )

    results = {}
    checks = self.get_checks(entity_type)
    for check in checks:
        skip_info = {}
        if skipped_checks:
            if check.id in [x["id"] for x in skipped_checks]:
                skip_info = [x for x in skipped_checks if x["id"] == check.id][0]

        if runner_filter.should_run_check(check.id):
            result = self.run_check(
                check,
                entity_configuration,
                entity_name,
                entity_type,
                scanned_file,
                skip_info,
            )
            results[check] = result
    return results


# Traceback (AttributeError)
Traceback (most recent call last):
File "/Users/robeden/git/third-party/checkov/checkov/common/checks/base_check.py", line 62, in run
raise e
File "/Users/robeden/git/third-party/checkov/checkov/common/checks/base_check.py", line 42, in run
check_result['result'] = self.scan_entity_conf(entity_configuration, entity_type)
File "/Users/robeden/git/third-party/checkov/checkov/terraform/checks/resource/base_resource_check.py", line 16, in scan_entity_conf
self.handle_dynamic_values(conf)
File "/Users/robeden/git/third-party/checkov/checkov/terraform/checks/resource/base_resource_check.py", line 38, in handle_dynamic_values
for dynamic_element in conf.get("dynamic", []):
AttributeError: 'list' object has no attribute 'get'

# Fixed code
def scan(self, scanned_file, entity, skipped_checks, runner_filter):
    (entity_type, entity_name, entity_configuration) = self.extract_entity_details(
        entity
    )

    results = {}

    if not isinstance(entity_configuration, dict):
        return results

    checks = self.get_checks(entity_type)
    for check in checks:
        skip_info = {}
        if skipped_checks:
            if check.id in [x["id"] for x in skipped_checks]:
                skip_info = [x for x in skipped_checks if x["id"] == check.id][0]

        if runner_filter.should_run_check(check.id):
            result = self.run_check(
                check,
                entity_configuration,
                entity_name,
                entity_type,
                scanned_file,
                skip_info,
            )
            results[check] = result
    return results