<commit_before>from __future__ import print_function
from flask import Flask, redirect, request, render_template
from pathlib import Path
import time
app = Flask(__name__)


@app.route('/set', methods=['GET', 'POST'])
def colorhandler():
    f = open(str(Path("/dev/pi-blaster").absolute()), "w")
    color = request.form['color']
    timer = int(request.form['timer'])
    print(str(timer))
    red = "22=" + "%.3f" % (int(color[:2], 16) / 255.0)
    green = "23=" + "%.3f" % (int(color[2:4], 16) / 255.0)
    blue = "24=" + "%.3f" % (int(color[4:], 16) / 255.0)
    print(red, file=f)
    print(green, file=f)
    print(blue, file=f)

    if timer is not 0:
        for x in range(0, 100):
            time.sleep(timer)
            print("22=0", file=f)
            print("23=0", file=f)
            print("24=0", file=f)
            time.sleep(timer)
            print(red, file=f)
            print(green, file=f)
            print(blue, file=f)
            x += 1

    return redirect('/')


@app.route('/')
def index():
    return render_template("index.html")

if __name__ == '__main__':
   app.run(debug=True)<commit_msg>fixed blink functionality and confirmed that it is working<commit_after>from __future__ import print_function
from flask import Flask, redirect, request, render_template
from pathlib import Path
import time
import sys
app = Flask(__name__)


@app.route('/set', methods=['GET', 'POST'])
def colorhandler():
    f = open(str(Path("/dev/pi-blaster").absolute()), "w", 0)
    color = request.form['color']
    timer = int(request.form['timer'])
    red = "22=" + "%.3f" % (int(color[:2], 16) / 255.0)
    green = "23=" + "%.3f" % (int(color[2:4], 16) / 255.0)
    blue = "24=" + "%.3f" % (int(color[4:], 16) / 255.0)
    print(red, file=f)
    print(green, file=f)
    print(blue, file=f)

    if timer != 0:
        for x in range(0, 20):
            time.sleep(timer / 100.0)
            print("22=0", file=f)
            print("23=0", file=f)
            print("24=0", file=f)
            time.sleep(timer / 100.0)
            print(red, file=f)
            print(green, file=f)
            print(blue, file=f)
            x += 1

    return redirect('/')


@app.route('/')
def index():
    return render_template("index.html")

if __name__ == '__main__':
   app.run(debug=True)

{'fraction_non_alphanumeric': 0.18422193324664066, 'fraction_numerical': 0.043346337234503686, 'mean_word_length': 2.61189358372457, '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': '178477', 'n_tokens_mistral': 872, 'n_tokens_neox': 802, 'n_words': 195}