<commit_before>#!/usr/bin/env python3.5

import time
import threading

from modules.camera import Camera
from modules.door import Door
from modules.light import Light
from modules.sms import Sms
from modules.pirs import Pirs
from modules.blue import Scanner

camera = Camera()
door = Door()
light = Light()
sms = Sms()
pirs = Pirs()
scanner = Scanner()

# check that everything is ok
sms.send_sms_async('alarm started')
light.turn_on(5)
camera.capture_and_upload_async()
scanner.scan()


def main_loop():
    while True:
        if pirs.is_detecting_move() or door.is_opened() or door.is_vibrating():
            light.turn_on()
        if scanner.is_armed:
            if pirs.is_detecting_move() or door.is_opened():
                sms.send_sms_async('presence detected')
                camera.capture_and_upload_async()
            else:
                if door.is_vibrating():
                    sms.send_sms_async('presence felt')
                    time.sleep(0.5)
        else:
            time.sleep(1)


# start bluetooth scanning in the background
new_bluetooth_thread = threading.Thread(target=scanner.watch)
new_bluetooth_thread.daemon = True  # stop if the program exits
new_bluetooth_thread.start()
<commit_msg>do not open light when door is vibrating<commit_after>#!/usr/bin/env python3.5

import time
import threading

from modules.camera import Camera
from modules.door import Door
from modules.light import Light
from modules.sms import Sms
from modules.pirs import Pirs
from modules.blue import Scanner

camera = Camera()
door = Door()
light = Light()
sms = Sms()
pirs = Pirs()
scanner = Scanner()

# check that everything is ok
sms.send_sms_async('alarm started')
light.turn_on(5)
camera.capture_and_upload_async()
scanner.scan()


def main_loop():
    while True:
        if pirs.is_detecting_move() or door.is_opened():
            light.turn_on()
        if scanner.is_armed:
            if pirs.is_detecting_move() or door.is_opened():
                sms.send_sms_async('presence detected')
                camera.capture_and_upload_async()
            else:
                if door.is_vibrating():
                    sms.send_sms_async('presence felt')
                    time.sleep(0.5)
        else:
            time.sleep(1)


# start bluetooth scanning in the background
new_bluetooth_thread = threading.Thread(target=scanner.watch)
new_bluetooth_thread.daemon = True  # stop if the program exits
new_bluetooth_thread.start()

{'fraction_non_alphanumeric': 0.09057676685621446, 'fraction_numerical': 0.00487408610885459, 'mean_word_length': 2.9157392686804453, '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': '148330', 'n_tokens_mistral': 786, 'n_tokens_neox': 759, 'n_words': 197}