<s> from st2common . constants import action as action_constants <EOL> from st2common . policies import base <EOL> from st2common . util import action_db as action_utils <EOL> class FakeConcurrencyApplicator ( base . ResourcePolicyApplicator ) : <EOL> def __init__ ( self , policy_ref , policy_type , * args , ** kwargs ) : <EOL> super ( FakeConcurrencyApplicator , self ) . __init__ ( policy_ref , policy_type , * args , ** kwargs ) <EOL> self . threshold = kwargs . get ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> def get_threshold ( self ) : <EOL> return self . threshold <EOL> def apply_before ( self , target ) : <EOL> if self . get_threshold ( ) <= <NUM_LIT:0> : <EOL> target = action_utils . update_liveaction_status ( <EOL> status = action_constants . LIVEACTION_STATUS_CANCELED , <EOL> liveaction_id = target . id , <EOL> publish = False ) <EOL> return target <EOL> def apply_after ( self , target ) : <EOL> return target </s>
