<s> from calvin . actor . actor import Actor , ActionResult , manage , condition , guard <EOL> from copy import copy <EOL> class SampleHold ( Actor ) : <EOL> """<STR_LIT>""" <EOL> @ manage ( [ '<STR_LIT>' ] ) <EOL> def init ( self , default = None ) : <EOL> self . held = default <EOL> @ condition ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> def action ( self , sample , tok ) : <EOL> if sample is True : <EOL> self . held = copy ( tok ) <EOL> return ActionResult ( production = ( self . held , ) ) <EOL> action_priority = ( action , ) <EOL> test_args = [ - <NUM_LIT:1> ] <EOL> test_set = [ <EOL> { <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , '<STR_LIT>' : [ False , True , <NUM_LIT:1> , True ] } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ - <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:3> ] } , <EOL> } , <EOL> ] </s>
