Add a callback to the initialized atlas state
180520
def atlas_node_add_callback(atlas_state, callback_name, callback):
    
    if callback_name == 'store_zonefile':
        atlas_state['zonefile_crawler'].set_store_zonefile_callback(callback)

    else:
        raise ValueError("Unrecognized callback {}".format(callback_name))
301495
def atlas_init(blockstack_opts, db, recover=False, port=None):
    
    if port is None:
        port = blockstack_opts['rpc_port']

    # start atlas node
    atlas_state = None
    if is_atlas_enabled(blockstack_opts):
        atlas_seed_peers = filter( lambda x: len(x) > 0, blockstack_opts['atlas_seeds'].split(","))
        atlas_blacklist = filter( lambda x: len(x) > 0, blockstack_opts['atlas_blacklist'].split(","))
        zonefile_dir = blockstack_opts['zonefiles']
        my_hostname = blockstack_opts['atlas_hostname']
        my_port = blockstack_opts['atlas_port']

        initial_peer_table = atlasdb_init(blockstack_opts['atlasdb_path'], zonefile_dir, db, atlas_seed_peers, atlas_blacklist, validate=True, recover=recover)
        atlas_peer_table_init(initial_peer_table)

        atlas_state = atlas_node_init(my_hostname, my_port, blockstack_opts['atlasdb_path'], zonefile_dir, db.working_dir)

    return atlas_state
473273
def initialize(self):
        '''
        
        '''
        if not hasattr(self.application, 'event_listener'):
            log.debug('init a listener')
            self.application.event_listener = EventListener(
                self.application.mod_opts,
                self.application.opts,
            )

        if not hasattr(self, 'saltclients'):
            local_client = salt.client.get_local_client(mopts=self.application.opts)
            self.saltclients = {
                'local': local_client.run_job_async,
                # not the actual client we'll use.. but its what we'll use to get args
                'local_async': local_client.run_job_async,
                'runner': salt.runner.RunnerClient(opts=self.application.opts).cmd_async,
                'runner_async': None,  # empty, since we use the same client as `runner`
                }

        if not hasattr(self, 'ckminions'):
            self.ckminions = salt.utils.minions.CkMinions(self.application.opts)
688409
@Override
    public void onAdd(Collection<? extends IDataType> dataTypes) throws AtlasException {
        AtlasGraphManagement management = provider.get().getManagementSystem();
               
        for (IDataType dataType : dataTypes) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Creating indexes for type name={}, definition={}", dataType.getName(), dataType.getClass());
            }

            try {
                addIndexForType(management, dataType);
                LOG.info("Index creation for type {} complete", dataType.getName());
            } catch (Throwable throwable) {
                LOG.error("Error creating index for type {}", dataType, throwable);
                //Rollback indexes if any failure
                rollback(management);
                throw new IndexCreationException("Error while creating index for type " + dataType, throwable);
            }
        }

        //Commit indexes
        commit(management);
    }
149143
def add_to_initial_stack(self, frame):
    """"""
    if not self._setable_initial_frames:
      raise ValueError(
          "This instance does not allow to manually set initial frame stack.")
    assert_msg = "{}, {}".format(frame.shape, self._initial_frames.shape[:1])
    assert frame.shape == self._initial_frames.shape[2:], assert_msg
    initial_frames = np.roll(self._initial_frames, shift=-1, axis=1)
    initial_frames[0, -1, ...] = frame
    self._initial_frames = initial_frames
268108
function AddCallback(mesgId, callbackFunction, callbackTimeout) {
    var callbackElement, now;

    now = new Date().getTime();

    callbackElement = {
        id      :   mesgId,
        func    :   callbackFunction,
        timeout :   now + callbackTimeout
    };

    callbackList.push(callbackElement);
}
181812
def set_initial_state(self, kwargs):
        """"""

        self.main_window = kwargs.pop("main_window")

        try:
            statustext = kwargs.pop("statustext")

        except KeyError:
            statustext = ""

        try:
            self.total_lines = kwargs.pop("total_lines")
            self.statustext = statustext + \
                _("{nele} of {totalele} elements processed.")

        except KeyError:
            self.total_lines = None
            self.statustext = statustext + _("{nele} elements processed.")

        try:
            self.freq = kwargs.pop("freq")

        except KeyError:
            self.freq = 1000

        # The aborted attribute makes next() to raise StopIteration
        self.aborted = False

        # Line counter
        self.line = 0

        # Bindings
        self.main_window.Bind(wx.EVT_KEY_DOWN, self.on_key)
1353712
def add_callback(type, options, &block)
      callbacks[type == :around ? :before : type] << callback = Callback.new(type, options, &block)
      add_states(callback.known_states)
      callback
    end
1228484
def recursively_register_child_states(self, state):
        
        self.logger.info("Execution status observer add new state {}".format(state))
        if isinstance(state, ContainerState):
            state.add_observer(self, "add_state",
                               notify_after_function=self.on_add_state)
            for state in list(state.states.values()):
                self.recursively_register_child_states(state)
                state.add_observer(self, "state_execution_status",
                                   notify_after_function=self.on_state_execution_status_changed_after)

        if isinstance(state, LibraryState):
            self.recursively_register_child_states(state.state_copy)
            state.add_observer(self, "state_execution_status",
                               notify_after_function=self.on_state_execution_status_changed_after)
279417
def _initilize(self, state: State) -> State:
        """"""

        targets = {}
        for pc, instr in enumerate(self):
            if isinstance(instr, Label):
                targets[instr.target] = pc

        state = state.update({PC: 0,
                              TARGETS: targets,
                              NAMEDGATES: STDGATES.copy()})
        return state
11257
def _add_new_state(self, *event, **kwargs):
        
        if react_to_event(self.view, self.view['state_machine_tree_view'], event):
            state_type = StateType.EXECUTION if 'state_type' not in kwargs else kwargs['state_type']
            gui_helper_state_machine.add_new_state(self._selected_sm_model, state_type)
            return True
1122319
def _init_map(self, record_types=None, **kwargs):
        """"""
        osid_objects.OsidCatalogForm._init_map(self, record_types, **kwargs)
894994
private void initialize(AtlasGraph graph) throws RepositoryException, IndexException {
        AtlasGraphManagement management = graph.getManagementSystem();

        try {
            if (management.containsPropertyKey(Constants.VERTEX_TYPE_PROPERTY_KEY)) {
                LOG.info("Global indexes already exist for graph");
                management.commit();

                return;
            }

            /* This is called only once, which is the first time Atlas types are made indexable .*/
            LOG.info("Indexes do not exist, Creating indexes for graph.");

            
            management.createVertexIndex(Constants.VERTEX_INDEX, Constants.BACKING_INDEX, Collections.<AtlasPropertyKey>emptyList());              
            management.createEdgeIndex(Constants.EDGE_INDEX, Constants.BACKING_INDEX);

            // create a composite index for guid as its unique
            createIndexes(management, Constants.GUID_PROPERTY_KEY, String.class, true,
                    AtlasCardinality.SINGLE, true, true);

            // Add creation_timestamp property to Vertex Index (mixed index)
            createIndexes(management, Constants.TIMESTAMP_PROPERTY_KEY, Long.class, false, AtlasCardinality.SINGLE, false, false);

            // Add modification_timestamp property to Vertex Index (mixed index)
            createIndexes(management, Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY, Long.class, false,
                    AtlasCardinality.SINGLE, false, false);


            // create a mixed index for entity state. Set systemProperty flag deliberately to false
            // so that it doesnt create a composite index which has issues with
            // titan 0.5.4 - Refer https://groups.google.com/forum/#!searchin/aureliusgraphs/hemanth/aureliusgraphs/bx7T843mzXU/fjAsclx7GAAJ
            createIndexes(management, Constants.STATE_PROPERTY_KEY, String.class, false, AtlasCardinality.SINGLE, false, false);

            // Create a composite and mixed index for created by property
            createIndexes(management, Constants.CREATED_BY_KEY, String.class, false,
                    AtlasCardinality.SINGLE, true, true);

            // Create a composite and mixed index for modified by property
            createIndexes(management, Constants.MODIFIED_BY_KEY, String.class, false,
                    AtlasCardinality.SINGLE, true, true);

            // create a composite and mixed index for type since it can be combined with other keys
            createIndexes(management, Constants.ENTITY_TYPE_PROPERTY_KEY, String.class, false, AtlasCardinality.SINGLE,
                    true, true);

            // create a composite and mixed index for type since it can be combined with other keys
            createIndexes(management, Constants.SUPER_TYPES_PROPERTY_KEY, String.class, false, AtlasCardinality.SET,
                    true, true);

            // create a composite and mixed index for traitNames since it can be combined with other
            // keys. Traits must be a set and not a list.
            createIndexes(management, Constants.TRAIT_NAMES_PROPERTY_KEY, String.class, false, AtlasCardinality.SET,
                    true, true);

            // Index for full text search
            createFullTextIndex(management);

            //Indexes for graph backed type system store
            createTypeStoreIndexes(management);
      
            
            commit(management);
            LOG.info("Index creation for global keys complete.");
        } catch (Throwable t) {
            rollback(management);
            throw new RepositoryException(t);
        }
    }
1243313
private void initialize(Handler callbackHandler, int threadPoolSize) {
		mDownloadDispatchers = new DownloadDispatcher[threadPoolSize];
		mDelivery = new CallBackDelivery(callbackHandler);
	}
920135
@SuppressWarnings("unchecked")
    @Override
    public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
        this.callbackHandler = callbackHandler;
        this.subject = subject;
        this.sharedState = (Map<String, Object>) sharedState;
        this.options = options;
    }
1043339
def state(self, state: str) -> None:
        """"""
        self._state = state
        for callback in self._callbacks:
            callback()
495789
def add_state(self):
        """"""
        sid = len(self.states)
        self.states.append(DFAState(sid))
        return sid