<commit_before>import datetime
import threading
import pygame
#only one clock at a moment
_clock = None

pygame.mixer.init()
# alarm sound from http://www.orangefreesounds.com/
pygame.mixer.music.load("alarm.mp3")

def turn_off():
    pygame.mixer.music.stop()
    _clock = None

def set_alarm(date):
    if(_clock is not None):
        return "there is already an alarm going on"
    time = datetime.datetime.strptime(date,"%H:%M")
    clock = Clock()
    clock.set_alarm(time.hour, time.minute)
    clock.run()

def set_countdown(milis):
    if(_clock is not None):
        return "there is already an alarm going on"
    time = datetime.datetime.now() + datetime.timedelta(milliseconds=milis)
    clock = Clock()
    clock.set_alarm(time.hour, time.minute)
    clock.run()

def ring_ring():<commit_msg>Update alarm.py<commit_after>import datetime
import threading
import pygame
import os

#only one clock at a moment
_clock = None

ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
FILE_PATH = os.path.join(ROOT_DIR, 'alarm.mp3')

pygame.mixer.init()
# alarm sound from http://www.orangefreesounds.com/
pygame.mixer.music.load(FILE_PATH)

def turn_off():
    pygame.mixer.music.stop()
    _clock = None

def set_alarm(date):
    if(_clock is not None):
        return "there is already an alarm going on"
    time = datetime.datetime.strptime(date,"%H:%M")
    clock = Clock()
    clock.set_alarm(time.hour, time.minute)
    clock.run()

def set_countdown(milis):
    if(_clock is not None):
        return "there is already an alarm going on"
    time = datetime.datetime.now() + datetime.timedelta(milliseconds=milis)
    clock = Clock()
    clock.set_alarm(time.hour, time.minute)
    clock.run()

def ring_ring():
{'fraction_non_alphanumeric': 0.12180974477958237, 'fraction_numerical': 0.001160092807424594, 'mean_word_length': 3.7131147540983607, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2587142', 'n_tokens_mistral': 593, 'n_tokens_neox': 588, 'n_words': 147}