<commit_before>__author__ = 'Isaac'
from services import Services
from services.temp_monitor import TempMonitor
from services.air_handler import AirHandler
from hardware_abstraction import Pin, TemperatureSensor

class FakePin:

    def __init__(self, name):
        self.name = name
        self.state = False

    def sense(self):
        return False

    def set(self, state):
        self.state = state


    def get(self):
        return self.state

Services.TempMonitor = TempMonitor(TemperatureSensor(0x48))
from services.database import DB
Services.DB = DB()
Services.AirHandler = AirHandler(AC_pin=Pin(4), fan_pin=FakePin("fan"), heater_pin=FakePin("heater"), db=Services.DB)
import time

from services.thermostat import Thermostat
Services.Thermostat = Thermostat(Services.AirHandler, 3)

Services.Thermostat.set_AC_target(21)
Services.Thermostat.set_heater_target(0)


def centigrade_to_fahrenheit(c):
    return c * 212/100 + 32

def main_loop():
    Services.TempMonitor.check_temp()
    print("temp: " + str(centigrade_to_fahrenheit(Services.TempMonitor.last_temp)) + "(F), " + str(Services.TempMonitor.last_temp))
    time.sleep(1)

@Services.TempMonitor.temp_changed
def temp_change(temp):
    print("temp changed now: " + str(centigrade_to_fahrenheit(temp)))

while True:
    main_loop()<commit_msg>Uses Floats<commit_after>__author__ = 'Isaac'
from services import Services
from services.temp_monitor import TempMonitor
from services.air_handler import AirHandler
from hardware_abstraction import Pin, TemperatureSensor

class FakePin:

    def __init__(self, name):
        self.name = name
        self.state = False

    def sense(self):
        return False

    def set(self, state):
        self.state = state


    def get(self):
        return self.state

Services.TempMonitor = TempMonitor(TemperatureSensor(0x48))
from services.database import DB
Services.DB = DB()
Services.AirHandler = AirHandler(AC_pin=Pin(4), fan_pin=FakePin("fan"), heater_pin=FakePin("heater"), db=Services.DB)
import time

from services.thermostat import Thermostat
Services.Thermostat = Thermostat(Services.AirHandler, 3)

Services.Thermostat.set_AC_target(21)
Services.Thermostat.set_heater_target(0)


def centigrade_to_fahrenheit(c):
    return c * 212.0/100.0 + 32

def main_loop():
    Services.TempMonitor.check_temp()
    print("temp: " + str(centigrade_to_fahrenheit(Services.TempMonitor.last_temp)) + "(F), " + str(Services.TempMonitor.last_temp))
    time.sleep(1)

@Services.TempMonitor.temp_changed
def temp_change(temp):
    print("temp changed now: " + str(centigrade_to_fahrenheit(temp)))

while True:
    main_loop()
{'fraction_non_alphanumeric': 0.1047040971168437, 'fraction_numerical': 0.013657056145675266, 'mean_word_length': 4.75764192139738, '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': '2513499', 'n_tokens_mistral': 886, 'n_tokens_neox': 839, 'n_words': 178}