<commit_before>from control_milight.models import LightAutomation
from control_milight.views import update_lightstate
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.utils.timezone import now
from ledcontroller import LedController
import datetime

class Command(BaseCommand):
    args = ''
    help = 'Run timed transitions'

    def handle(self, *args, **options):
        led = LedController(settings.MILIGHT_IP)
        time = datetime.datetime.now()
        hour = datetime.time(time.hour, time.minute)
        for item in LightAutomation.objects.filter(running=True):
            if not item.is_running(time):
                continue
            percent_done = item.percent_done(time)
            if item.action == "evening":
                print "Setting evening brightness to", ((1-percent_done)*100)
                led.set_brightness((1-percent_done)*100)
            elif item.action == "morning":
                print "Setting morning brightness to", ((percent_done)*100)
                led.set_brightness((percent_done)*100)<commit_msg>Cast to int<commit_after>from control_milight.models import LightAutomation
from control_milight.views import update_lightstate
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.utils.timezone import now
from ledcontroller import LedController
import datetime

class Command(BaseCommand):
    args = ''
    help = 'Run timed transitions'

    def handle(self, *args, **options):
        led = LedController(settings.MILIGHT_IP)
        time = datetime.datetime.now()
        hour = datetime.time(time.hour, time.minute)
        for item in LightAutomation.objects.filter(running=True):
            if not item.is_running(time):
                continue
            percent_done = item.percent_done(time)
            if item.action == "evening":
                print "Setting evening brightness to", ((1-percent_done)*100)
                led.set_brightness(int((1-percent_done)*100))
            elif item.action == "morning":
                print "Setting morning brightness to", ((percent_done)*100)
                led.set_brightness(int((percent_done)*100))
{'fraction_non_alphanumeric': 0.09196428571428572, 'fraction_numerical': 0.0125, 'mean_word_length': 2.966371681415929, 'pattern_counts': {'":': 4, '<': 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': '4331179', 'n_tokens_mistral': 613, 'n_tokens_neox': 571, 'n_words': 151}