<commit_before>
import mysql.connector

class Database:

    def __init__(self):
        self.cnx = mysql.connector.connect(user='root',
                                      password='<PASSWORD>',
                                      host='127.0.0.1', database='openqua')

    def get_repeater(self, callsign):
        cursor = self.cnx.cursor()
        query = "SELECT * FROM repeater WHERE callsign = %s"
        repeater = None
        cursor.execute(query, (callsign,))
        for (callsign, rx, tx, to, mo, ml, lo, ke, lat, lon) in cursor:
            repeater =  { 'callsign': callsign,
                     'rx': rx,
                     'tx': tx,
                     'to': to,
                     'mo': mo,
                     'ml': ml,
                     'lo': lo,
                     'ke': ke,
                     'lat': lat,
                     'lon': lon }
        cursor.close()
        return repeater

    def close(self):
        self.cnx.close()

<commit_msg>Add database class for web<commit_after>
import mysql.connector

class Database:

    def __init__(self):
        self.cnx = mysql.connector.connect(user='openqua',
                                      password='<PASSWORD>',
                                      host='127.0.0.1', database='openqua')

    def get_repeater(self, callsign):
        cursor = self.cnx.cursor()
        query = "SELECT * FROM repeater WHERE callsign = %s"
        repeater = None
        cursor.execute(query, (callsign,))
        for (callsign, rx, tx, to, mo, ml, lo, ke, lat, lon) in cursor:
            repeater =  { 'callsign': callsign,
                     'rx': rx,
                     'tx': tx,
                     'to': to,
                     'mo': mo,
                     'ml': ml,
                     'lo': lo,
                     'ke': ke,
                     'lat': lat,
                     'lon': lon }
        cursor.close()
        return repeater

    def get_all_repeaters(self):
        cursor = self.cnx.cursor()
        query = "SELECT * FROM repeater"
        cursor.execute(query)
        repeaters = []
        for (callsign, rx, tx, to, mo, ml, lo, ke, lat, lon) in cursor:
            repeater =  { 'callsign': callsign,
                     'rx': rx,
                     'tx': tx,
                     'to': to,
                     'mo': mo,
                     'ml': ml,
                     'lo': lo,
                     'ke': ke,
                     'lat': lat,
                     'lon': lon }
            repeaters.append(repeater)
        return repeaters


    def close(self):
        self.cnx.close()


{'fraction_non_alphanumeric': 0.12090007627765065, 'fraction_numerical': 0.004576659038901602, 'mean_word_length': 1.1051364365971108, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7205098', 'n_tokens_mistral': 751, 'n_tokens_neox': 710, 'n_words': 187}