<s> from lifxlan import * <EOL> import sys <EOL> colors = { <EOL> "<STR_LIT>" : RED , <EOL> "<STR_LIT>" : ORANGE , <EOL> "<STR_LIT>" : YELLOW , <EOL> "<STR_LIT>" : GREEN , <EOL> "<STR_LIT>" : CYAN , <EOL> "<STR_LIT>" : BLUE , <EOL> "<STR_LIT>" : PURPLE , <EOL> "<STR_LIT>" : PINK , <EOL> "<STR_LIT>" : WHITE , <EOL> "<STR_LIT>" : COLD_WHTE , <EOL> "<STR_LIT>" : WARM_WHITE , <EOL> "<STR_LIT>" : GOLD <EOL> } <EOL> error_message = """<STR_LIT>""" + "<STR_LIT:U+002CU+0020>" . join ( colors . keys ( ) ) <EOL> lifxlan = LifxLAN ( ) <EOL> color = None <EOL> if len ( sys . argv ) == <NUM_LIT:2> : <EOL> if sys . argv [ <NUM_LIT:1> ] . lower ( ) not in colors : <EOL> print ( error_message ) <EOL> sys . exit ( ) <EOL> else : <EOL> color = colors [ sys . argv [ <NUM_LIT:1> ] . lower ( ) ] <EOL> elif len ( sys . argv ) == <NUM_LIT:5> : <EOL> color = [ ] <EOL> for ( i , value ) in enumerate ( sys . argv [ <NUM_LIT:1> : ] ) : <EOL> try : <EOL> value = int ( value ) <EOL> except : <EOL> print ( "<STR_LIT>" . format ( value ) ) <EOL> print ( error_message ) <EOL> sys . exit ( ) <EOL> if i == <NUM_LIT:3> and ( value < <NUM_LIT> or value > <NUM_LIT> ) : <EOL> print ( "<STR_LIT>" . format ( value ) ) <EOL> print ( error_message ) <EOL> sys . exit ( ) <EOL> elif value < <NUM_LIT:0> or value > <NUM_LIT> : <EOL> print ( "<STR_LIT>" . format ( value ) ) <EOL> print ( error_message ) <EOL> sys . exit ( ) <EOL> color . append ( value ) <EOL> else : <EOL> print ( error_message ) <EOL> sys . exit ( ) <EOL> lifxlan . set_color_all_lights ( color , rapid = True ) </s>
