<commit_before>#!/usr/bin/env python
from lifxlan import *
from array import *
import sys
from time import sleep

def main():
    num_lights = None
    if len(sys.argv) != 2:
        print("\nDiscovery will go much faster if you provide the number of lights on your LAN:")
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance 
    # simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights,False)

    # get devices
    devices = lifx.get_lights()
    bulb = devices[0]
    print("Selected {}".format(bulb.get_label()))

    speed = 5
    color1 = RED
    color2 = GREEN
    size = 12 #WIDTH

    for b in devices:
        print(b.get_label())
        if b.get_label() == "strip":
            strip =  MultiZoneLight(b)
            zones = strip.get_color_zones() #autodetect zones
            size = size - 1 #0 based
            zones = zones - 1
            start = 0
            while True:
                strip.set_zone_color(0, zones, color1, 500, False, 0) #queue command
                if start > zones-size:
                    end = size - (zones - start) - 1
                    strip.set_zone_color(0, end, color2, 500, False, 0)#queue command
                strip.set_zone_color(start, start+size, color2,500,False,1) #execute command<commit_msg>made improvements in speed (via rapid=true and fixing the multizone fire-and-forget function), set the transition time (duration) to zero. Looks much more like a chase animation now. There are still funky glitches due to the way the logic works, which still need to be fixed. Also need to remove dependency on light name for discovering a multizone light.<commit_after>#!/usr/bin/env python
from lifxlan import *
from array import *
import sys
from time import sleep

def main():
    num_lights = None
    if len(sys.argv) != 2:
        print("\nDiscovery will go much faster if you provide the number of lights on your LAN:")
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance 
    # simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights,False)

    # get devices
    devices = lifx.get_lights()
    bulb = devices[0]
    print("Selected {}".format(bulb.get_label()))

    speed = 0.1
    color1 = RED
    color2 = GREEN
    size = 12 #WIDTH

    for b in devices:
        print(b.get_label())
        if "strip" in b.get_label().lower():
            strip =  MultiZoneLight(b)
            zones = strip.get_color_zones() #autodetect zones
            print(zones)
            size = size - 1 #0 based
            zones = zones - 1
            start = 0
            while True:
                strip.set_zone_color(0, zones, color1, 0, True, 0) #queue command
                if start > zones-size:
                    end = size - (zones - start) - 1
                    strip.set_zone_color(0, end, color2, 0, True, 0)#queue command
                strip.set_zone_color(start, start+size, color2,0,True,1) #execute command
{'fraction_non_alphanumeric': 0.09678313921242374, 'fraction_numerical': 0.015806988352745424, 'mean_word_length': 2.312213039485767, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 7, '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': '5792321', 'n_tokens_mistral': 1129, 'n_tokens_neox': 1057, 'n_words': 384}