Set up the SlotMachine in a ready to use state
439114
private function initialize()
    {
        $this->undefinedCardResolution = isset($this->config['options']['undefined_card'])
            ? static::translateUndefinedCardResolution($this->config['options']['undefined_card'])
            : UndefinedCardResolution::DEFAULT_CARD;

        if (isset($this->config['options']['delimiter'])) {
            $this->delimiter = $this->config['options']['delimiter'];
        }

        foreach ($this->config['slots'] as $slotName => &$slotData) {
            $slotData['name'] = $slotName;

            if (is_string($slotData['reel'])) {
                $slotData['reel'] = $this->config['reels'][$slotData['reel']];
            }

            if (!isset($slotData['nested'])) {
                $slotData['nested'] = array();
            }

            $slotData['undefined_card'] = (!isset($slotData['undefined_card']))
                ? $this->undefinedCardResolution
                : static::translateUndefinedCardResolution($slotData['undefined_card']);

            $this->offsetSet($slotName, function () use ($slotData) {
                return new Slot($slotData);
            });
        }
    }
1216150
def init_device(self):
        """"""
        Device.init_device(self)
        time.sleep(0.1)
        self.set_state(DevState.STANDBY)
590975
def register(self):
        
        # logger.debug("StateMachineEditionChangeHistory register state_machine old/new sm_id %s/%s" %
        #              (self.__my_selected_sm_id, self.model.selected_state_machine_id))

        # relieve old models
        if self.__my_selected_sm_id is not None:  # no old models available
            self.relieve_model(self._selected_sm_model.history)

        if self.model.selected_state_machine_id is not None and global_gui_config.get_config_value('HISTORY_ENABLED'):

            # set own selected state machine id
            self.__my_selected_sm_id = self.model.selected_state_machine_id

            # observe new models
            self._selected_sm_model = self.model.state_machines[self.__my_selected_sm_id]
            if self._selected_sm_model.history:
                self.observe_model(self._selected_sm_model.history)
                self.update(None, None, None)
            else:
                logger.warning("The history is enabled but not generated {0}. {1}"
                               "".format(self._selected_sm_model.state_machine.state_machine_id,
                                         self._selected_sm_model.state_machine.file_system_path))
        else:
            if self.__my_selected_sm_id is not None:
                self.doing_update = True
                self.history_tree_store.clear()
                self.doing_update = False
            self.__my_selected_sm_id = None
            self._selected_sm_model = None
162567
protected function _setStateMachine($stateMachine)
    {
        if ($stateMachine !== null && !($stateMachine instanceof StateMachineInterface)) {
            throw $this->_createInvalidArgumentException(
                $this->__('Argument is not a valid state machine instance'),
                null,
                null,
                $stateMachine
            );
        }

        $this->stateMachine = $stateMachine;
    }
417993
def ActivateCard(self, card):
        """"""
        if not hasattr(card, 'connection'):
            card.connection = card.createConnection()
            if None != self.parent.apdutracerpanel:
                card.connection.addObserver(self.parent.apdutracerpanel)
            card.connection.connect()
        self.dialogpanel.OnActivateCard(card)
93363
void initUI(){
        mLogo = ButterKnife.findById(this, R.id.logo);
        mEulaText = ButterKnife.findById(this, R.id.eula_text);
        mActionCancel = ButterKnife.findById(this, R.id.action_cancel);
        mActionAccept = ButterKnife.findById(this, R.id.action_accept);

        mActionCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                supportFinishAfterTransition();
            }
        });

        mActionAccept.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // do something
            }
        });
    }
885395
def init_ui(self):
        """"""
        self.control_layout = QHBoxLayout()
        self.setLayout(self.control_layout)
        self.reset_button = QPushButton()
        self.reset_button.setFixedSize(40, 40)
        self.reset_button.setIcon(QtGui.QIcon(WIN_PATH))
        self.game_timer = QLCDNumber()
        self.game_timer.setStyleSheet("QLCDNumber {color: red;}")
        self.game_timer.setFixedWidth(100)
        self.move_counter = QLCDNumber()
        self.move_counter.setStyleSheet("QLCDNumber {color: red;}")
        self.move_counter.setFixedWidth(100)

        self.control_layout.addWidget(self.game_timer)
        self.control_layout.addWidget(self.reset_button)
        self.control_layout.addWidget(self.move_counter)
1081617
def setup(self):
        """"""
        if self.dry_run is not True:
            self.client = self._get_client()
            self._disable_access_key()
476054
function setup() {
  createCanvas(windowWidth, windowHeight);

  // Instantiate our SerialPort object
  serial = new p5.SerialPort();

  // Get a list the ports available
  // You should have a callback defined to see the results
  serial.list();

  // Assuming our Arduino is connected, let's open the connection to it
  // Change this to the name of your arduino's serial port
  serial.open("/dev/cu.usbmodem1411");

  // Here are the callbacks that you can register

  // When we connect to the underlying server
  serial.on('connected', serverConnected);

  // When we get a list of serial ports that are available
  serial.on('list', gotList);
  // OR
  //serial.onList(gotList);

  // When we some data from the serial port
  serial.on('data', gotData);
  // OR
  //serial.onData(gotData);

  // When or if we get an error
  serial.on('error', gotError);
  // OR
  //serial.onError(gotError);

  // When our serial port is opened and ready for read/write
  serial.on('open', gotOpen);
  // OR
  //serial.onOpen(gotOpen);

  // Callback to get the raw data, as it comes in for handling yourself
  //serial.on('rawdata', gotRawData);
  // OR
  //serial.onRawData(gotRawData);
}
574352
def ready(self):
        """"""
        models_config.auto_load_configs()

        self.auto_load_app_modules(['layouts', 'signals'])

        app_menu.auto_load_model_menu()

        auto_register_search_models()
        tabs.auto_generate_missing_tabs()
375822
protected void onPrevious()
	{
		stateMachine.previous();
		updateButtonState();
		final String name = getStateMachine().getCurrentState().getName();
		final CardLayout cardLayout = getWizardContentPanel().getCardLayout();
		cardLayout.show(getWizardContentPanel(), name);
	}
1087383
function ensureInitialSetup() {
    if (!initialized) {
        initialized = true;
        process.stdin.resume();
        process.stdin.setEncoding("utf8");
        process.stdin.on("data", function (text) {
            // Store input in buffer
            inputBuffer += text;

            // After input received, if main fiber was waiting, wake it up
            if (inputListenerFiber)
                inputListenerFiber.run();
        });
    }
}
1068506
def initialize():
    """"""
    try:
        requests.get('http://localhost:4242/poll')
        state['connected_to_bot'] = True
    except requests.exceptions.ConnectionError:
        state['connected_to_bot'] = False

    # set up turtle
    state['window'] = turtle.Screen()
    state['window'].setup(width=AXI_WIDTH, height=AXI_HEIGHT)
    state['turtle'] = turtle.Turtle()
    state['turtle'].width(2)
    state['turtle'].speed(0)
    point_in_direction(0)

    pen_up()
122531
function resetState() {
                    setStatus(DataSourceStatus.ready);

                    // Track count promises
                    getCountPromise = null;

                    // Track whether listDataAdapter.endEdits needs to be called
                    beginEditsCalled = false;

                    // Track whether finishNotifications should be called after each edit
                    editsInProgress = false;

                    // Track whether the first queued edit should be attempted
                    firstEditInProgress = false;

                    // Queue of edis that have yet to be completed
                    editQueue = {};
                    editQueue.next = editQueue;
                    editQueue.prev = editQueue;

                    // Track whether there are currently edits queued
                    editsQueued = false;

                    // If an edit has returned noResponse, the edit queue will be reapplied when the next refresh is requested
                    waitForRefresh = false;

                    // Change to count while multiple edits are taking place
                    countDelta = 0;

                    // True while the indices are temporarily in a bad state due to multiple edits
                    indexUpdateDeferred = false;

                    // Next temporary key to use
                    nextTempKey = 0;

                    // Set of fetches for which results have not yet arrived
                    fetchesInProgress = {};

                    // Queue of complete callbacks for fetches
                    fetchCompleteCallbacks = [];

                    // Tracks the count returned explicitly or implicitly by the data adapter
                    knownCount = CountResult.unknown;

                    // Sentinel objects for list of slots
                    // Give the start sentinel an index so we can always use predecessor + 1.
                    slotsStart = {
                        firstInSequence: true,
                        lastInSequence: true,
                        index: -1
                    };
                    slotListEnd = {
                        firstInSequence: true,
                        lastInSequence: true
                    };
                    slotsEnd = {
                        firstInSequence: true,
                        lastInSequence: true
                    };
                    slotsStart.next = slotListEnd;
                    slotListEnd.prev = slotsStart;
                    slotListEnd.next = slotsEnd;
                    slotsEnd.prev = slotListEnd;

                    // Map of request IDs to slots
                    handleMap = {};

                    // Map of keys to slots
                    keyMap = {};

                    // Map of indices to slots
                    indexMap = {};
                    indexMap[-1] = slotsStart;

                    // Count of slots that have been released but not deleted
                    releasedSlots = 0;

                    lastSlotReleased = null;

                    // At most one call to reduce the number of refresh slots should be posted at any given time
                    reduceReleasedSlotCountPosted = false;

                    // Multiple refresh requests are coalesced
                    refreshRequested = false;

                    // Requests do not cause fetches while a refresh is in progress
                    refreshInProgress = false;

                    // Refresh requests yield the same promise until a refresh completes
                    refreshSignal = null;
                }
894389
def setup(self):
        '''
        
        '''
        self.zoo_client.add_listener(self.state_listener)

        if self.ensure:
            self.zoo_client.ensure_path(self.my_file)
1334778
def initialize(signal_number=DEFAULT_TIMER_SIGNAL_NUMBER,
               update_period_s=DEFAULT_UPDATE_PERIOD_S):
    """"""
    global initialized
    if initialized:
        return
    initialized = True
    uwsgi.add_timer(signal_number, update_period_s)
    uwsgi.register_signal(signal_number, MULE, emit)
154166
def connect(self, slot):
        
        if not callable(slot):
            raise ValueError("Connection to non-callable '%s' object failed" % slot.__class__.__name__)

        if (isinstance(slot, partial) or '<' in slot.__name__):
            # If it's a partial or a lambda. The '<' check is the only py2 and py3 compatible way I could find
            if slot not in self._slots:
                self._slots.append(slot)
        elif inspect.ismethod(slot):
            # Check if it's an instance method and store it with the instance as the key
            slotSelf = slot.__self__
            slotDict = weakref.WeakKeyDictionary()
            slotDict[slotSelf] = slot.__func__
            if slotDict not in self._slots:
                self._slots.append(slotDict)
        else:
            # If it's just a function then just store it as a weakref.
            newSlotRef = weakref.ref(slot)
            if newSlotRef not in self._slots:
                self._slots.append(newSlotRef)