<commit_before>""" Test Server File without GPIO Pins """

from flask import Flask, render_template, request, jsonify
import time
import schedule

APP = Flask(__name__)

# Create a dictionary called pins to store the pin number, name, and pin state:
PINS = [
    {
        'number': 1,
        'name': 'GPIO 01',
        'state': 0,
        'rules': [
            {
                'setTo': True,
                'time': '9:00'
            },
            {
                'setTo': True,
                'time': '16:08'
            },
            {
                'setTo': False,
                'time': '21:00'
            }
        ]
    },
    {
        'number': 2,
        'name': 'GPIO 02',
        'state': 0,
        'rules': []
    }
]

print "--- Started Raspitron Server --- \n"
print "Running initial pin states"

for _pin in PINS:
    print '---'
    print '  Pin Number: ' + str(_pin['number'])
    print '  Pin Name: "' + _pin['name'] + '"'


def job(pin_number, action_time, set_to):
    """ Scheduler """
    gpio = 'GPIO.LOW' if set_to else 'GPIO.HIGH'
    print 'At ' + action_time + ' set pin #' + str(pin_number) + ' to ' + gpio

def sched():
    """ Function for schedule """
    schedule.clear()

    for _pin in PINS:
        if len(_pin['rules']) > 0:
            for rule in _pin['rules']:
                _num = _pin['number']
                _time = rule['time']
                _set = rule['setTo']
                schedule.every().day.at(_time).do(job, _num, _time, _set)

    while True:
        schedule.run_pending()
        time.sleep(1)


sched()<commit_msg>updated test<commit_after>""" Test Server File without GPIO Pins """

from flask import Flask, render_template, request, jsonify
import time
import schedule

APP = Flask(__name__)

# Create a dictionary called pins to store the pin number, name, and pin state:
PINS = [
    {
        'number': 1,
        'name': 'GPIO 01',
        'state': 0,
        'rules': [
            {
                'setTo': True,
                'time': '9:00'
            },
            {
                'setTo': True,
                'time': '16:08'
            },
            {
                'setTo': False,
                'time': '21:00'
            }
        ]
    },
    {
        'number': 2,
        'name': 'GPIO 02',
        'state': 0,
        'rules': []
    }
]

print "--- Started Raspitron Server --- \n"
print "Running initial pin states"

for _pin in PINS:
    print '---'
    print '  Pin Number: ' + str(_pin['number'])
    print '  Pin Name: "' + _pin['name'] + '"'


def job(pin_number, action_time, set_to):
    """ Scheduler """
    gpio = 'GPIO.LOW' if set_to else 'GPIO.HIGH'
    print 'At ' + action_time + ' set pin #' + str(pin_number) + ' to ' + gpio

def scheduler():
    """ Function for schedule """
    schedule.clear()

    for _pin in PINS:
        if len(_pin['rules']) > 0:
            for rule in _pin['rules']:
                _num = _pin['number']
                _time = rule['time']
                _set = rule['setTo']
                schedule.every().day.at(_time).do(job, _num, _time, _set)

    while True:
        schedule.run_pending()
        time.sleep(1)

# Run scheduler
scheduler()
{'fraction_non_alphanumeric': 0.1485981308411215, 'fraction_numerical': 0.013084112149532711, 'mean_word_length': 1.6063311688311688, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6291549', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1002, 'n_words': 276}