2a437760c9344a20a5785f5b4706950c911534b6,conceptnet5/formats/sql.py,EdgeIndexReader,random,#EdgeIndexReader#,270

Before Change


                unpacker = Unpacker(fileobj, encoding=encoding)
                result = unpacker.unpack()
                if len(result) == 13 and "uri" in result:
                    return result
                else:
                    byte_offset -= 2
            except (ValueError, TypeError):
                byte_offset -= 2

After Change


    def random(self):
        hashval = random.randrange(-2**31, 2**31)
        shard = hashval % self.nshards
        c = self.dbs[shard].cursor()
        offset = random.randrange(0, 100)
        rows = []
        while not rows:
            c.execute(
                "SELECT filenum, offset from text_index "
                "WHERE queryhash >= ? "
                "ORDER BY queryhash LIMIT 1 OFFSET ?",
                (hashval, offset)
            )
            rows = c.fetchall()

        filenum, offset = rows[0]
        return self.get_edge(filenum, offset)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: commonsense/conceptnet5
Commit Name: 2a437760c9344a20a5785f5b4706950c911534b6
Time: 2015-04-08
Author: rob@luminoso.com
File Name: conceptnet5/formats/sql.py
Class Name: EdgeIndexReader
Method Name: random


Project Name: numerai/submission-criteria
Commit Name: 3bf5f2de89807642dcd1e030e45226ff3944779b
Time: 2017-11-10
Author: xander@numer.ai
File Name: common.py
Class Name:
Method Name: get_filename


Project Name: numerai/submission-criteria
Commit Name: 3bf5f2de89807642dcd1e030e45226ff3944779b
Time: 2017-11-10
Author: xander@numer.ai
File Name: database_manager.py
Class Name: DatabaseManager
Method Name: get_date_created