<commit_before>import datetime
import requests
import time
import sys
import CHIP_IO.GPIO as GPIO

POLL_INTERVAL_SECONDS = 3
FAILED_JOB_COLORS = ['yellow', 'red']
PIN = "XIO-P4"
ON = GPIO.LOW
OFF = GPIO.HIGH
WORKDAY_START_TIME = datetime.time(8, 45)
WORKDAY_END_TIME = datetime.time(18, 0)

def during_working_hours():
    now = datetime.datetime.today()
    return now.weekday() in range(1,5) and WORKDAY_START_TIME < now.time() and now.time() < WORKDAY_END_TIME

def get_number_of_failed_jenkins_jobs(view_url):
    req = requests.get(view_url + '/api/json?tree=jobs[color]')
    if req.status_code != 200:
        print "Failed to get status of Jenkins jobs, returned status: {}, content:\n{}".format(req.status_code, req.text)
    
    job_results = [job for job in req.json()['jobs'] if job['color'] in FAILED_JOB_COLORS]
    return len(job_results)
<commit_msg>Fix working day detection: Weekday 0 is indeed Monday, the bug is that range() is exclusive the last element.<commit_after>import datetime
import requests
import time
import sys
import CHIP_IO.GPIO as GPIO

POLL_INTERVAL_SECONDS = 3
FAILED_JOB_COLORS = ['yellow', 'red']
PIN = "XIO-P4"
ON = GPIO.LOW
OFF = GPIO.HIGH
WORKDAY_START_TIME = datetime.time(8, 45)
WORKDAY_END_TIME = datetime.time(18, 0)

def during_working_hours():
    now = datetime.datetime.today()
    return now.weekday() in range(0,5) and WORKDAY_START_TIME < now.time() and now.time() < WORKDAY_END_TIME

def get_number_of_failed_jenkins_jobs(view_url):
    req = requests.get(view_url + '/api/json?tree=jobs[color]')
    if req.status_code != 200:
        print "Failed to get status of Jenkins jobs, returned status: {}, content:\n{}".format(req.status_code, req.text)
    
    job_results = [job for job in req.json()['jobs'] if job['color'] in FAILED_JOB_COLORS]
    return len(job_results)

{'fraction_non_alphanumeric': 0.1185792349726776, 'fraction_numerical': 0.014754098360655738, 'mean_word_length': 4.721875, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5920836', 'n_tokens_mistral': 662, 'n_tokens_neox': 630, 'n_words': 168}