<commit_before>import psycopg2

class SQLWrapper:

    def __init__(self):
        try:
            self.conn = psycopg2.connect("dbname='cc3201' user='public_www' host='localhost' password='<PASSWORD>'")
            self.cur = self.conn.cursor()
            #nombre de columnas
            self.colnames = []
            #numero de paginas
            self.numpages = 0
        except:
            print "I am unable to connect to the database"
            raise

    def query1(self,data):
        try:
            try:
                self.cur.fetchall()
            except:
                pass
            #self.cur.execute("SELECT COUNT(*) from lol.deathvalues WHERE victim LIKE (%s)",("%"+data+"%",))
            #self.numpages = (self.cur.fetchone()[0])/100 + 1
            self.cur.execute("SELECT * from lol.deathvalues WHERE victim LIKE (%s)",("%"+data+"%",))
            self.colnames = [desc[0] for desc in self.cur.description]
            try:
                assert isinstance(self.cur.rowcount, int)
            except:
                print "cago rowcount"
            self.numpages = self.cur.rowcount
            print "rows: "+ str(self.numpages)
        except Exception,e:
            print str(e)
            print "Can't execute query"

    def queryChampion(self,data):
        try:
            try:
                self.cur.fetchall()
            except:
                pass
            self.cur.execute("SELECT foo.season,foo.wins,bar.total, CAST(foo.wins AS double precision) / bar.total AS winrate FROM (SELECT season,COUNT(season) AS wins FROM lol.leagueoflegends WHERE ((%s) IN (redtopchamp,redjunglechamp,redmiddlechamp,redadcchamp,redsupportchamp) AND rresult IS true) OR ((%s) IN (bluetopchamp,bluejunglechamp,bluemiddlechamp,blueadcchamp,bluesupportchamp) ANS bresult IS true) GROUP BY season) foo, (SELECT season,COUNT(season) AS total FROM lol.leagueoflegends WHERE (%s) IN (redtopchamp,redjunglechamp,redmiddlechamp,redadcchamp,redsupportchamp,bluetopchamp,bluejunglechamp,bluemiddlechamp,blueadcchamp,bluesupportchamp) GROUP BY (season) ) bar WHERE foo.season = bar.season", (data,data,data))
        except Exception,e:
            print str(e)
            print "Can't execute query"
    #fetch los siguientes 100 resultados
    def fetch(self):
        try:
            return self.cur.fetchmany(100)
        except Exception,e:<commit_msg>fixed typo<commit_after>import psycopg2

class SQLWrapper:

    def __init__(self):
        try:
            self.conn = psycopg2.connect("dbname='cc3201' user='public_www' host='localhost' password='<PASSWORD>'")
            self.cur = self.conn.cursor()
            #nombre de columnas
            self.colnames = []
            #numero de paginas
            self.numpages = 0
        except:
            print "I am unable to connect to the database"
            raise

    def query1(self,data):
        try:
            try:
                self.cur.fetchall()
            except:
                pass
            #self.cur.execute("SELECT COUNT(*) from lol.deathvalues WHERE victim LIKE (%s)",("%"+data+"%",))
            #self.numpages = (self.cur.fetchone()[0])/100 + 1
            self.cur.execute("SELECT * from lol.deathvalues WHERE victim LIKE (%s)",("%"+data+"%",))
            self.colnames = [desc[0] for desc in self.cur.description]
            try:
                assert isinstance(self.cur.rowcount, int)
            except:
                print "cago rowcount"
            self.numpages = self.cur.rowcount
            print "rows: "+ str(self.numpages)
        except Exception,e:
            print str(e)
            print "Can't execute query"

    def queryChampion(self,data):
        try:
            try:
                self.cur.fetchall()
            except:
                pass
            self.cur.execute("SELECT foo.season,foo.wins,bar.total, CAST(foo.wins AS double precision) / bar.total AS winrate FROM (SELECT season,COUNT(season) AS wins FROM lol.leagueoflegends WHERE ((%s) IN (redtopchamp,redjunglechamp,redmiddlechamp,redadcchamp,redsupportchamp) AND rresult IS true) OR ((%s) IN (bluetopchamp,bluejunglechamp,bluemiddlechamp,blueadcchamp,bluesupportchamp) AND bresult IS true) GROUP BY season) foo, (SELECT season,COUNT(season) AS total FROM lol.leagueoflegends WHERE (%s) IN (redtopchamp,redjunglechamp,redmiddlechamp,redadcchamp,redsupportchamp,bluetopchamp,bluejunglechamp,bluemiddlechamp,blueadcchamp,bluesupportchamp) GROUP BY (season) ) bar WHERE foo.season = bar.season", (data,data,data))
        except Exception,e:
            print str(e)
            print "Can't execute query"
    #fetch los siguientes 100 resultados
    def fetch(self):
        try:
            return self.cur.fetchmany(100)
        except Exception,e:
{'fraction_non_alphanumeric': 0.1087093389296957, 'fraction_numerical': 0.008394543546694649, 'mean_word_length': 2.305131761442441, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '172870', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1417, 'n_words': 334}