<s> """<STR_LIT>""" <EOL> import pygame <EOL> import pygame . locals <EOL> import time <EOL> from mpf . media_controller . core . display import Decorator <EOL> class Blink ( Decorator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , parent_element , on_secs = <NUM_LIT> , off_secs = <NUM_LIT> , repeats = - <NUM_LIT:1> , <EOL> ** kwargs ) : <EOL> self . next_action_time = <NUM_LIT:0> <EOL> self . current_state = <NUM_LIT:1> <EOL> self . on_secs = on_secs <EOL> self . off_secs = off_secs <EOL> self . repeats = repeats <EOL> self . parent_element = parent_element <EOL> @ property <EOL> def dirty ( self ) : <EOL> if self . next_action_time <= time . time ( ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def update ( self ) : <EOL> """<STR_LIT>""" <EOL> current_time = time . time ( ) <EOL> if self . next_action_time <= current_time : <EOL> if self . current_state : <EOL> self . parent_element . opacity = <NUM_LIT:0> <EOL> self . current_state = <NUM_LIT:0> <EOL> self . next_action_time = current_time + self . off_secs <EOL> if self . repeats == <NUM_LIT:0> : <EOL> self . unload ( ) <EOL> elif self . repeats > <NUM_LIT:0> : <EOL> self . repeats -= <NUM_LIT:1> <EOL> else : <EOL> self . current_state = <NUM_LIT:1> <EOL> self . next_action_time = current_time + self . on_secs <EOL> self . parent_element . opacity = <NUM_LIT:255> <EOL> return True <EOL> return False </s>
