High light active state machine.
15441
def execution_engine_model_changed(self, model, prop_name, info):
        

        notebook = self.view['notebook']
        active_state_machine_id = self.model.state_machine_manager.active_state_machine_id

        if active_state_machine_id is None:
            # un-mark all state machine that are marked with execution-running style class
            for tab in self.tabs.values():
                label = notebook.get_tab_label(tab['page']).get_child().get_children()[0]
                if label.get_style_context().has_class(constants.execution_running_style_class):
                    label.get_style_context().remove_class(constants.execution_running_style_class)
        else:
            # mark active state machine with execution-running style class
            page = self.get_page_for_state_machine_id(active_state_machine_id)
            if page:
                label = notebook.get_tab_label(page).get_child().get_children()[0]
                label.get_style_context().add_class(constants.execution_running_style_class)
23628
@Override
    protected boolean onStateChange(int[] state) {
        final int color = state == null ? mColorStateList.getDefaultColor() : mColorStateList.getColorForState(state, mColor);
        boolean bFlag = mColor != color;
        if (bFlag) {
            mColor = color;
        }
        return bFlag;
    }
236199
def _get_states(self, result):
        """"""
        if 'devices' not in result.keys():
            return

        for device_states in result['devices']:
            device = self.__devices[device_states['deviceURL']]
            try:
                device.set_active_states(device_states['states'])
            except KeyError:
                pass
999311
def active_io(self, iocb):
        """"""
        if _debug: IOController._debug("active_io %r", iocb)

        # requests should be idle or pending before coming active
        if (iocb.ioState != IDLE) and (iocb.ioState != PENDING):
            raise RuntimeError("invalid state transition (currently %d)" % (iocb.ioState,))

        # change the state
        iocb.ioState = ACTIVE
1089819
function mainViewStateSet(mode, recursive) {
    mainView.state.mode = mode;
    mainView.state.recursive = recursive;
  }
1154764
def state_machine_success():
    """"""
    from furious.async import Async
    from furious.context import get_current_async

    result = get_current_async().result

    if result == 'ALPHA':
        logging.info('Inserting continuation for state %s.', result)
        return Async(target=complex_state_generator_alpha, args=[result])

    elif result == 'BRAVO':
        logging.info('Inserting continuation for state %s.', result)
        return Async(target=complex_state_generator_bravo, args=[result])

    logging.info('Done working, stop now.')
872073
function Machine(initialState, transitions, stateActions) {
    Pusher.EventsDispatcher.call(this);

    this.state = undefined;
    this.errors = [];

    // functions for each state
    this.stateActions = stateActions;

    // set up the transitions
    this.transitions = transitions;

    this.transition(initialState);
  }
1187070
def lights(self):
        """"""
        return [Light(self._device, i) for i in range(len(self.raw))]
423577
def led(host, seq, anim, f, d):
    
    at(host, 'LED', seq, [anim, float(f), d])
1339678
function fsmEvent (start, events) {
  if (typeof start === 'object') {
    events = start
    start = 'START'
  }
  assert.equal(typeof start, 'string')
  assert.equal(typeof events, 'object')
  assert.ok(events[start], 'invalid starting state ' + start)
  assert.ok(fsm.validate(events))

  const emitter = new EventEmitter()
  emit._graph = fsm.reachable(events)
  emit._emitter = emitter
  emit._events = events
  emit._state = start
  emit.emit = emit
  emit.on = on

  return emit

  // set a state listener
  // str, fn -> null
  function on (event, cb) {
    emitter.on(event, cb)
  }

  // change the state
  // str -> null
  function emit (str) {
    const nwState = emit._events[emit._state][str]
    if (!reach(emit._state, nwState, emit._graph)) {
      const err = 'invalid transition: ' + emit._state + ' -> ' + str
      return emitter.emit('error', err)
    }

    const leaveEv = emit._state + ':leave'
    const enterEv = nwState + ':enter'

    if (!emit._state) return enter()
    return leave()

    function leave () {
      if (!emitter._events[leaveEv]) enter()
      else emitter.emit(leaveEv, enter)
    }

    function enter () {
      if (!emitter._events[enterEv]) done()
      else emitter.emit(enterEv, done)
    }

    function done () {
      emit._state = nwState
      emitter.emit(nwState)
      emitter.emit('done')
    }
  }
}
1288524
def run_fsm(self, name, command, events, transitions, timeout, max_transitions=20):
        """"""
        self.ctrl.send_command(command)
        return FSM(name, self, events, transitions, timeout=timeout, max_transitions=max_transitions).run()
434595
def is_active(self, state: 'State') -> bool:
        
        # Remove the genes which does not contribute to the multiplex
        sub_state = state.sub_state_by_gene_name(*self.expression.variables)
        # If this state is not in the cache
        if sub_state not in self._is_active:
            params = self._transform_state_to_dict(sub_state)
            # We add the result of the expression for this state of the multiplex to the cache
            self._is_active[sub_state] = self.expression.evaluate(**params)
        return self._is_active[sub_state]
464708
def state(self, value):
        
        self._state = value
        self.state_changed.emit(value)
86668
def toggle_state(self, state, active=TOGGLE, scope=None):
        
        self.conversation(scope).toggle_state(state, active)
1271450
def status_light(self):
        
        result = self.deviceProperties.GetLEDState()
        LEDState = result["CurrentLEDState"]  # pylint: disable=invalid-name
        return True if LEDState == "On" else False
1143364
def main():
    """"""
    while 1:
        events = get_mouse()
        for event in events:
            print(event.ev_type, event.code, event.state)
511504
def set_state(self, light_id, **kwargs):
        '''
        
        '''
        light = self.get_light(light_id)
        url = '/api/%s/lights/%s/state' % (self.username, light.light_id)
        response = self.make_request('PUT', url, kwargs)
        setting_count = len(kwargs.items())
        success_count = 0

        for data in response:
            if 'success' in data:
                success_count += 1

        if success_count == setting_count:
            return True
        else:
            return False