Generates the default success transition of a state to its parent success port

    :return:
551155
def add_transitions_from_selected_state_to_parent():
    
    task_string = "create transition"
    sub_task_string = "to parent state"

    selected_state_m, msg = get_selected_single_state_model_and_check_for_its_parent()
    if selected_state_m is None:
        logger.warning("Can not {0} {1}: {2}".format(task_string, sub_task_string, msg))
        return
    logger.debug("Check to {0} {1} ...".format(task_string, sub_task_string))
    state = selected_state_m.state
    parent_state = state.parent

    # find all possible from outcomes
    from_outcomes = get_all_outcomes_except_of_abort_and_preempt(state)

    # find lowest valid outcome id
    possible_oc_ids = [oc_id for oc_id in state.parent.outcomes.keys() if oc_id >= 0]
    possible_oc_ids.sort()
    to_outcome = state.parent.outcomes[possible_oc_ids[0]]

    oc_connected_to_parent = [oc for oc in from_outcomes if is_outcome_connect_to_state(oc, parent_state.state_id)]
    oc_not_connected = [oc for oc in from_outcomes if not state.parent.get_transition_for_outcome(state, oc)]
    if all(oc in oc_connected_to_parent for oc in from_outcomes):
        logger.info("Remove transition {0} because all outcomes are connected to it.".format(sub_task_string))
        for from_outcome in oc_connected_to_parent:
            transition = parent_state.get_transition_for_outcome(state, from_outcome)
            parent_state.remove(transition)
    elif oc_not_connected:
        logger.debug("Create transition {0} ... ".format(sub_task_string))
        for from_outcome in from_outcomes:
            parent_state.add_transition(state.state_id, from_outcome.outcome_id,
                                        parent_state.state_id, to_outcome.outcome_id)
    else:
        if remove_transitions_if_target_is_the_same(from_outcomes):
            logger.info("Removed transitions origin from outcomes of selected state {0}"
                        "because all point to the same target.".format(sub_task_string))
            return add_transitions_from_selected_state_to_parent()
        logger.info("Will not create transition {0}: Not clear situation of connected transitions."
                    "There will be no transitions to other states be touched.".format(sub_task_string))

    return True
1312886
def state_pop(self):
        ""
        for of in self.output_fns:
            if hasattr(of,'state_pop'):
                of.state_pop()
        super(PatternGenerator, self).state_pop()
607280
@Override
    public void succeeded() {
        boolean process = false;
        try (Locker.Lock lock = _locker.lock()) {
            switch (_state) {
                case PROCESSING: {
                    _state = State.CALLED;
                    break;
                }
                case PENDING: {
                    _state = State.PROCESSING;
                    process = true;
                    break;
                }
                case CLOSED:
                case FAILED: {
                    // Too late!
                    break;
                }
                default: {
                    throw new IllegalStateException(toString());
                }
            }
        }
        if (process)
            processing();
    }
638059
def finalize_backward_execution(self):
        
        # backward_execution needs to be True to signal the parent container state the backward execution
        self.backward_execution = True
        # pop the ConcurrencyItem as we are leaving the barrier concurrency state
        last_history_item = self.execution_history.pop_last_item()
        assert isinstance(last_history_item, ConcurrencyItem)

        last_history_item = self.execution_history.pop_last_item()
        assert isinstance(last_history_item, CallItem)
        # this copy is convenience and not required here
        self.scoped_data = last_history_item.scoped_data
        self.state_execution_status = StateExecutionStatus.WAIT_FOR_NEXT_STATE
        return self.finalize()
434809
def add_state(self, state, storage_load=False):
        
        state_id = super(BarrierConcurrencyState, self).add_state(state)
        if not storage_load and not self.__init_running and not state.state_id == UNIQUE_DECIDER_STATE_ID:
            # the transitions must only be created for the initial add_state call and not during each load procedure
            for o_id, o in list(state.outcomes.items()):
                if not o_id == -1 and not o_id == -2:
                    self.add_transition(state.state_id, o_id, self.states[UNIQUE_DECIDER_STATE_ID].state_id, None)
        return state_id
1329539
def success(self):
        
        return self.ack.upper() in (self.config.ACK_SUCCESS,
                                    self.config.ACK_SUCCESS_WITH_WARNING)
138868
def successful(self):
        """"""
        status = self.status
        assert status >= COMPLETED, "status is %s" % status
        return (self.status == COMPLETED)
621054
def _check_transition_validity(self, check_transition):
        
        valid, message = super(BarrierConcurrencyState, self)._check_transition_validity(check_transition)
        if not valid:
            return False, message

        # Only the following transitions are allowed in barrier concurrency states:
        # - Transitions from the decider state to the parent state\n"
        # - Transitions from not-decider states to the decider state\n"
        # - Transitions from not_decider states from aborted/preempted outcomes to the
        #   aborted/preempted outcome of the parent

        from_state_id = check_transition.from_state
        to_state_id = check_transition.to_state
        from_outcome_id = check_transition.from_outcome
        to_outcome_id = check_transition.to_outcome

        if from_state_id == UNIQUE_DECIDER_STATE_ID:
            if to_state_id != self.state_id:
                return False, "Transition from the decider state must go to the parent state"
        else:
            if to_state_id != UNIQUE_DECIDER_STATE_ID:
                if from_outcome_id not in [-2, -1] or to_outcome_id not in [-2, -1]:
                    return False, "Transition from this state must go to the decider state. The only exception are " \
                                  "transition from aborted/preempted to the parent aborted/preempted outcomes"

        return True, message
77140
def transition(start_states, end_states)
      # Convert end_states into canonical hash form.
      canonical_end_states = canonical_hash_form(end_states)

      Array(start_states).each do |start_state|
        # Validate start state.
        unless self.valid_states.include?(start_state)
          abort "Invalid state :#{start_state}. Must be one of the symbols #{self.valid_states.map{|x| ":#{x}"}.join(', ')}"
        end

        # Create a new metric to hold the task, end states, and conditions.
        m = Metric.new(self, canonical_end_states)

        if block_given?
          # Let the config file define some conditions on the metric.
          yield(m)
        else
          # Add an :always condition if no block was given.
          m.condition(:always) do |c|
            c.what = true
          end
        end

        # Populate the condition -> metric directory.
        m.conditions.each do |c|
          self.directory[c] = m
        end

        # Record the metric.
        self.metrics[start_state] ||= []
        self.metrics[start_state] << m
      end
    end
41800
private void transitionTo(State newState, CheckedRunnable listener) {
    boolean transitioned = false;
    synchronized (this) {
      if (!getState().equals(newState)) {
        switch (newState) {
          case CLOSED:
            state.set(new ClosedState(this));
            break;
          case OPEN:
            state.set(new OpenState(this, state.get()));
            break;
          case HALF_OPEN:
            state.set(new HalfOpenState(this));
            break;
        }
        transitioned = true;
      }
    }

    if (transitioned && listener != null) {
      try {
        listener.run();
      } catch (Exception ignore) {
      }
    }
  }
566391
def get_success_url(self):
        """"""
        if not self.success_url:
            if self.request.GET.get("inmodal"):
                return reverse("arctic:redirect_to_parent")
            raise ImproperlyConfigured(
                "No URL to redirect to. Provide a success_url."
            )
        return self.in_modal(str(self.success_url))
1110573
def _generate_state() -> str:
        
        state = str(uuid.uuid4()).replace('-', '')
        logger.debug("Generated OAuth state: %s" % state)
        return state
750768
def transition_allowed(self, initial_state, target_state):
        # type: (str, str) -> bool
        """"""
        assert initial_state in self._allowed, \
            "%s is not in %s" % (initial_state, list(self._allowed))
        return target_state in self._allowed[initial_state]
1318199
def make_setup_state(
            self,
            app: 'Quart',
            first_registration: bool,
            *,
            url_prefix: Optional[str]=None,
    ) -> 'BlueprintSetupState':
        
        return BlueprintSetupState(self, app, first_registration, url_prefix=url_prefix)
126284
def mainswitch_state(sequence_number, state):
        """"""
        return MessageWriter().string("mainswitch.state").uint64(sequence_number).bool(state).get()
570094
def state(self):
    
    state = 'in progress'
    if self.is_complete:
      if self.failed:
        state = 'failed with error: %s' % str(self._fatal_error)
      elif self._errors:
        state = 'completed with some non-fatal errors'
      else:
        state = 'completed'
    return state
416967
def state_pop(self):
        
        super(Composite,self).state_pop()
        for gen in self.generators:
            gen.state_pop()