<commit_before>import pyglet
from pyglet.window.key import SPACE

from .levels import Level


class IntroScreen(Level):
  def __init__(self, window):
    self.welcome = pyglet.text.Label('WELCOME\n\tTO\nCLAIRE', x=100, y=window.height-80,
                                    width=window.width//2,
                                    font_size=40, multiline=True)

    scores = self.get_scores()
    self.scores = pyglet.text.Label("".join(scores), x=100, y=window.height-280,
                                    width=int(window.width * .8),
                                    font_size=30, multiline=True)
    super(IntroScreen, self).__init__(window)

  def reset(self):
    scores = self.get_scores()
    self.scores.text = "".join(scores)

  def get_scores(self):
    with open("scores.txt") as fp:
      lines = fp.readlines()
    lines = sorted(lines, reverse=True, key=lambda l: float(l.split(': ')[-1]))
    return ["{}. {}".format(i, line) for i, line in enumerate(lines[:5], 1)]

  def key(self, symbol, mod):
    if symbol == SPACE:
      self.container.next()

  def draw(self):
    self.window.clear()
    self.welcome.draw()
    self.scores.draw()<commit_msg>Change formate of top 5 list<commit_after>import pyglet
from pyglet.window.key import SPACE

from .levels import Level


class IntroScreen(Level):
  def __init__(self, window):
    self.welcome = pyglet.text.Label('WELCOME\n\tTO\nCLAIRE', x=100, y=window.height-80,
                                    width=window.width//2,
                                    font_size=40, multiline=True)

    scores = self.get_scores()
    self.scores = pyglet.text.Label("".join(scores), x=100, y=window.height-280,
                                    width=int(window.width * .8),
                                    font_size=30, multiline=True)
    super(IntroScreen, self).__init__(window)

  def reset(self):
    scores = self.get_scores()
    self.scores.text = "".join(scores)

  def get_scores(self):
    with open("scores.txt") as fp:
      lines = fp.readlines()
    lines = sorted(lines, reverse=True, key=lambda l: float(l.split(': ')[-1]))
    return ["#{} - {}".format(i, line) for i, line in enumerate(lines[:5], 1)]

  def key(self, symbol, mod):
    if symbol == SPACE:
      self.container.next()

  def draw(self):
    self.window.clear()
    self.welcome.draw()
    self.scores.draw()
{'fraction_non_alphanumeric': 0.14490916772285595, 'fraction_numerical': 0.017321504013519222, 'mean_word_length': 2.311888111888112, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6017909', 'n_tokens_mistral': 829, 'n_tokens_neox': 761, 'n_words': 158}