<commit_before>import collections, sqlite3, sniper_stats

class SniperStatsSqlite(sniper_stats.SniperStatsBase):
  def __init__(self, filename = 'sim.stats.sqlite3'):
    self.db = sqlite3.connect(filename)
    self.names = self.read_metricnames()

  def get_snapshots(self):
    snapshots = []
    c = self.db.cursor()
    c.execute('select prefixid, prefixname from `prefixes` order by prefixid asc')
    for prefixid, prefixname in c:<commit_msg>[stats] Don't try to convert database contents to UTF-8<commit_after>import collections, sqlite3, sniper_stats

class SniperStatsSqlite(sniper_stats.SniperStatsBase):
  def __init__(self, filename = 'sim.stats.sqlite3'):
    self.db = sqlite3.connect(filename)
    self.db.text_factory = str # Don't try to convert database contents to UTF-8
    self.names = self.read_metricnames()

  def get_snapshots(self):
    snapshots = []
    c = self.db.cursor()
    c.execute('select prefixid, prefixname from `prefixes` order by prefixid asc')
    for prefixid, prefixname in c:
{'fraction_non_alphanumeric': 0.10577864838393732, 'fraction_numerical': 0.007835455435847209, 'mean_word_length': 4.524324324324325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '334223', 'n_tokens_mistral': 337, 'n_tokens_neox': 325, 'n_words': 83}