sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def run_to_selected_state(self, path, state_machine_id=None): """Execute the state machine until a specific state. This state won't be executed. This is an asynchronous task """ if self.state_machine_manager.get_active_state_machine() is not None: self.state_machine_manager.get_activ...
Execute the state machine until a specific state. This state won't be executed. This is an asynchronous task
entailment
def _wait_while_in_pause_or_in_step_mode(self): """ Waits as long as the execution_mode is in paused or step_mode """ while (self._status.execution_mode is StateMachineExecutionStatus.PAUSED) \ or (self._status.execution_mode is StateMachineExecutionStatus.STEP_MODE): ...
Waits as long as the execution_mode is in paused or step_mode
entailment
def _wait_if_required(self, container_state, next_child_state_to_execute, woke_up_from_pause_or_step_mode): """ Calls a blocking wait for the calling thread, depending on the execution mode. :param container_state: the current hierarhcy state to handle the execution mode for :param next_child_s...
Calls a blocking wait for the calling thread, depending on the execution mode. :param container_state: the current hierarhcy state to handle the execution mode for :param next_child_state_to_execute: the next child state for :param container_state to be executed :param woke_up_from_pause_or_ste...
entailment
def handle_execution_mode(self, container_state, next_child_state_to_execute=None): """Checks the current execution status and returns it. Depending on the execution state, the calling thread (currently only hierarchy states) waits for the execution to continue. If the execution mode i...
Checks the current execution status and returns it. Depending on the execution state, the calling thread (currently only hierarchy states) waits for the execution to continue. If the execution mode is any of the step modes, a condition variable stops the current execution, until it get...
entailment
def _modify_run_to_states(self, state): """ This is a special case. Inside a hierarchy state a step_over is triggered and affects the last child. In this case the self.run_to_states has to be modified in order to contain the parent of the hierarchy state. Otherwise the execution won't re...
This is a special case. Inside a hierarchy state a step_over is triggered and affects the last child. In this case the self.run_to_states has to be modified in order to contain the parent of the hierarchy state. Otherwise the execution won't respect the step_over any more and run until the end of the st...
entailment
def execute_state_machine_from_path(self, state_machine=None, path=None, start_state_path=None, wait_for_execution_finished=True): """ A helper function to start an arbitrary state machine at a given path. :param path: The path where the state machine resides :param start_state_path: The path t...
A helper function to start an arbitrary state machine at a given path. :param path: The path where the state machine resides :param start_state_path: The path to the state from which the execution will start :return: a reference to the created state machine
entailment
def set_execution_mode(self, execution_mode, notify=True): """ An observed setter for the execution mode of the state machine status. This is necessary for the monitoring client to update the local state machine in the same way as the root state machine of the server. :param execution_mode: the...
An observed setter for the execution mode of the state machine status. This is necessary for the monitoring client to update the local state machine in the same way as the root state machine of the server. :param execution_mode: the new execution mode of the state machine :raises exceptions.Typ...
entailment
def run_to_states(self): """Property for the _run_to_states field """ self.execution_engine_lock.acquire() return_value = self._run_to_states self.execution_engine_lock.release() return return_value
Property for the _run_to_states field
entailment
def recursively_preempt_states(self): """ Preempt the state and all of it child states. """ super(ContainerState, self).recursively_preempt_states() # notify the transition condition variable to let the state instantaneously stop self._transitions_cv.acquire() self._trans...
Preempt the state and all of it child states.
entailment
def recursively_pause_states(self): """ Pause the state and all of it child states. """ super(ContainerState, self).recursively_pause_states() for state in self.states.values(): state.recursively_pause_states()
Pause the state and all of it child states.
entailment
def recursively_resume_states(self): """ Resume the state and all of it child states. """ super(ContainerState, self).recursively_resume_states() for state in self.states.values(): state.recursively_resume_states()
Resume the state and all of it child states.
entailment
def setup_run(self): """ Executes a generic set of actions that has to be called in the run methods of each derived state class. :return: """ super(ContainerState, self).setup_run() # reset the scoped data self._scoped_data = {} self._start_state_modified = False...
Executes a generic set of actions that has to be called in the run methods of each derived state class. :return:
entailment
def handle_no_transition(self, state): """ This function handles the case that there is no transition for a specific outcome of a sub-state. The method waits on a condition variable to a new transition that will be connected by the programmer or GUI-user. :param state: The sub-state to...
This function handles the case that there is no transition for a specific outcome of a sub-state. The method waits on a condition variable to a new transition that will be connected by the programmer or GUI-user. :param state: The sub-state to find a transition for :return: The transit...
entailment
def handle_no_start_state(self): """Handles the situation, when no start state exists during execution The method waits, until a transition is created. It then checks again for an existing start state and waits again, if this is not the case. It returns the None state if the the state machine w...
Handles the situation, when no start state exists during execution The method waits, until a transition is created. It then checks again for an existing start state and waits again, if this is not the case. It returns the None state if the the state machine was stopped.
entailment
def group_states(self, state_ids, scoped_variable_ids=None): """ Group states and scoped variables into a new hierarchy state and remain internal connections. Interconnecting transitions and data flows to parent and other child states are removed, at the moment. :param state_ids: state_id's...
Group states and scoped variables into a new hierarchy state and remain internal connections. Interconnecting transitions and data flows to parent and other child states are removed, at the moment. :param state_ids: state_id's of all states that are to be grouped. :param scoped_variable_ids...
entailment
def ungroup_state(self, state_id): """ Ungroup state with state id state_id into its parent and remain internal linkage in parent. Interconnecting transitions and data flows to parent and other child states are preserved except: - a transition that is going from income to outcome directl...
Ungroup state with state id state_id into its parent and remain internal linkage in parent. Interconnecting transitions and data flows to parent and other child states are preserved except: - a transition that is going from income to outcome directly and - a data-flow that is linking...
entailment
def add_state(self, state, storage_load=False): """Adds a state to the container state. :param state: the state that is going to be added :param storage_load: True if the state was directly loaded from filesystem :return: the state_id of the new state :raises exceptions.Attribut...
Adds a state to the container state. :param state: the state that is going to be added :param storage_load: True if the state was directly loaded from filesystem :return: the state_id of the new state :raises exceptions.AttributeError: if state.state_id already exist
entailment
def remove_state(self, state_id, recursive=True, force=False, destroy=True): """Remove a state from the container state. :param state_id: the id of the state to remove :param recursive: a flag to indicate a recursive disassembling of all substates :param force: a flag to indicate forcef...
Remove a state from the container state. :param state_id: the id of the state to remove :param recursive: a flag to indicate a recursive disassembling of all substates :param force: a flag to indicate forcefully deletion of all states (important for the decider state in the barr...
entailment
def destroy(self, recursive): """ Removes all the state elements. :param recursive: Flag whether to destroy all state elements which are removed """ for transition_id in list(self.transitions.keys()): self.remove_transition(transition_id, destroy=recursive) for data_...
Removes all the state elements. :param recursive: Flag whether to destroy all state elements which are removed
entailment
def related_linkage_state(self, state_id): """ TODO: document """ related_transitions = {'external': {'ingoing': [], 'outgoing': []}, 'internal': {'enclosed': [], 'ingoing': [], 'outgoing': []}} related_data_flows = {'external': {'ingoing': [], 'outgoing':...
TODO: document
entailment
def related_linkage_states_and_scoped_variables(self, state_ids, scoped_variables): """ TODO: document """ # find all related transitions related_transitions = {'enclosed': [], 'ingoing': [], 'outgoing': []} for t in self.transitions.values(): # check if internal of ...
TODO: document
entailment
def change_state_type(self, state, new_state_class): """ Changes the type of the state to another type :param state: the state to be changed :param new_state_class: the new type of the state :return: the new state having the new state type :rtype: :py:class:`rafcon.core.states.s...
Changes the type of the state to another type :param state: the state to be changed :param new_state_class: the new type of the state :return: the new state having the new state type :rtype: :py:class:`rafcon.core.states.state.State` :raises exceptions.ValueError: if the state d...
entailment
def set_start_state(self, state): """Sets the start state of a container state :param state: The state_id of a state or a direct reference ot he state (that was already added to the container) that will be the start state of this container state. """ if state is Non...
Sets the start state of a container state :param state: The state_id of a state or a direct reference ot he state (that was already added to the container) that will be the start state of this container state.
entailment
def get_start_state(self, set_final_outcome=False): """Get the start state of the container state :param set_final_outcome: if the final_outcome of the state should be set if the income directly connects to an outcome :return: the start state """ ...
Get the start state of the container state :param set_final_outcome: if the final_outcome of the state should be set if the income directly connects to an outcome :return: the start state
entailment
def remove(self, state_element, recursive=True, force=False, destroy=True): """Remove item from state :param StateElement state_element: State or state element to be removed :param bool recursive: Only applies to removal of state and decides whether the removal should be called recu...
Remove item from state :param StateElement state_element: State or state element to be removed :param bool recursive: Only applies to removal of state and decides whether the removal should be called recursively on all child states :param bool force: if the removal should be forced ...
entailment
def check_transition_id(self, transition_id): """ Check the transition id and calculate a new one if its None :param transition_id: The transition-id to check :return: The new transition id :raises exceptions.AttributeError: if transition.transition_id already exists """ ...
Check the transition id and calculate a new one if its None :param transition_id: The transition-id to check :return: The new transition id :raises exceptions.AttributeError: if transition.transition_id already exists
entailment
def check_if_outcome_already_connected(self, from_state_id, from_outcome): """ check if outcome of from state is not already connected :param from_state_id: The source state of the transition :param from_outcome: The outcome of the source state to connect the transition to :raises excep...
check if outcome of from state is not already connected :param from_state_id: The source state of the transition :param from_outcome: The outcome of the source state to connect the transition to :raises exceptions.AttributeError: if the outcome of the state with the state_id==from_state_id ...
entailment
def create_transition(self, from_state_id, from_outcome, to_state_id, to_outcome, transition_id): """ Creates a new transition. Lookout: Check the parameters first before creating a new transition :param from_state_id: The source state of the transition :param from_outcome: The outcome...
Creates a new transition. Lookout: Check the parameters first before creating a new transition :param from_state_id: The source state of the transition :param from_outcome: The outcome of the source state to connect the transition to :param to_state_id: The target state of the transiti...
entailment
def add_transition(self, from_state_id, from_outcome, to_state_id, to_outcome, transition_id=None): """Adds a transition to the container state Note: Either the toState or the toOutcome needs to be "None" :param from_state_id: The source state of the transition :param from_outcome: The...
Adds a transition to the container state Note: Either the toState or the toOutcome needs to be "None" :param from_state_id: The source state of the transition :param from_outcome: The outcome id of the source state to connect the transition to :param to_state_id: The target state of th...
entailment
def get_transition_for_outcome(self, state, outcome): """Determines the next transition of a state. :param state: The state for which the transition is determined :param outcome: The outcome of the state, that is given in the first parameter :return: the transition specified by the the ...
Determines the next transition of a state. :param state: The state for which the transition is determined :param outcome: The outcome of the state, that is given in the first parameter :return: the transition specified by the the state and the outcome :raises exceptions.TypeError: if th...
entailment
def remove_transition(self, transition_id, destroy=True): """Removes a transition from the container state :param transition_id: the id of the transition to remove :raises exceptions.AttributeError: if the transition_id is already used """ if transition_id == -1 or transition_id...
Removes a transition from the container state :param transition_id: the id of the transition to remove :raises exceptions.AttributeError: if the transition_id is already used
entailment
def remove_outcome_hook(self, outcome_id): """Removes internal transition going to the outcome """ for transition_id in list(self.transitions.keys()): transition = self.transitions[transition_id] if transition.to_outcome == outcome_id and transition.to_state == self.state...
Removes internal transition going to the outcome
entailment
def check_data_flow_id(self, data_flow_id): """ Check the data flow id and calculate a new one if its None :param data_flow_id: The data flow id to check :return: The new data flow id :raises exceptions.AttributeError: if data_flow.data_flow_id already exists """ if data...
Check the data flow id and calculate a new one if its None :param data_flow_id: The data flow id to check :return: The new data flow id :raises exceptions.AttributeError: if data_flow.data_flow_id already exists
entailment
def add_data_flow(self, from_state_id, from_data_port_id, to_state_id, to_data_port_id, data_flow_id=None): """Adds a data_flow to the container state :param from_state_id: The id source state of the data_flow :param from_data_port_id: The output_key of the source state :param to_state_...
Adds a data_flow to the container state :param from_state_id: The id source state of the data_flow :param from_data_port_id: The output_key of the source state :param to_state_id: The id target state of the data_flow :param to_data_port_id: The input_key of the target state :par...
entailment
def remove_data_flow(self, data_flow_id, destroy=True): """ Removes a data flow from the container state :param int data_flow_id: the id of the data_flow to remove :raises exceptions.AttributeError: if the data_flow_id does not exist """ if data_flow_id not in self._data_flows: ...
Removes a data flow from the container state :param int data_flow_id: the id of the data_flow to remove :raises exceptions.AttributeError: if the data_flow_id does not exist
entailment
def remove_data_flows_with_data_port_id(self, data_port_id): """Remove an data ports whose from_key or to_key equals the passed data_port_id :param int data_port_id: the id of a data_port of which all data_flows should be removed, the id can be a input or output data port id...
Remove an data ports whose from_key or to_key equals the passed data_port_id :param int data_port_id: the id of a data_port of which all data_flows should be removed, the id can be a input or output data port id
entailment
def get_scoped_variable_from_name(self, name): """ Get the scoped variable for a unique name :param name: the unique name of the scoped variable :return: the scoped variable specified by the name :raises exceptions.AttributeError: if the name is not in the the scoped_variables dictionar...
Get the scoped variable for a unique name :param name: the unique name of the scoped variable :return: the scoped variable specified by the name :raises exceptions.AttributeError: if the name is not in the the scoped_variables dictionary
entailment
def add_scoped_variable(self, name, data_type=None, default_value=None, scoped_variable_id=None): """ Adds a scoped variable to the container state :param name: The name of the scoped variable :param data_type: An optional data type of the scoped variable :param default_value: An option...
Adds a scoped variable to the container state :param name: The name of the scoped variable :param data_type: An optional data type of the scoped variable :param default_value: An optional default value of the scoped variable :param scoped_variable_id: An optional scoped variable id of t...
entailment
def remove_scoped_variable(self, scoped_variable_id, destroy=True): """Remove a scoped variable from the container state :param scoped_variable_id: the id of the scoped variable to remove :raises exceptions.AttributeError: if the id of the scoped variable already exists """ if s...
Remove a scoped variable from the container state :param scoped_variable_id: the id of the scoped variable to remove :raises exceptions.AttributeError: if the id of the scoped variable already exists
entailment
def get_data_port(self, state_id, port_id): """Searches for a data port The data port specified by the state id and data port id is searched in the state itself and in its children. :param str state_id: The id of the state the port is in :param int port_id: The id of the port ...
Searches for a data port The data port specified by the state id and data port id is searched in the state itself and in its children. :param str state_id: The id of the state the port is in :param int port_id: The id of the port :return: The searched port or None if it is not found
entailment
def get_data_port_by_id(self, data_port_id): """Search for the given data port id in the data ports of the state The method tries to find a data port in the input and output data ports as well as in the scoped variables. :param data_port_id: the unique id of the data port :return: the ...
Search for the given data port id in the data ports of the state The method tries to find a data port in the input and output data ports as well as in the scoped variables. :param data_port_id: the unique id of the data port :return: the data port with the searched id or None if not found
entailment
def get_inputs_for_state(self, state): """Retrieves all input data of a state. If several data flows are connected to an input port the most current data is used for the specific input port. :param state: the state of which the input data is determined :return: the input data of the tar...
Retrieves all input data of a state. If several data flows are connected to an input port the most current data is used for the specific input port. :param state: the state of which the input data is determined :return: the input data of the target state
entailment
def add_input_data_to_scoped_data(self, dictionary): """Add a dictionary to the scoped data As the input_data dictionary maps names to values, the functions looks for the proper data_ports keys in the input_data_ports dictionary :param dictionary: The dictionary that is added to the sc...
Add a dictionary to the scoped data As the input_data dictionary maps names to values, the functions looks for the proper data_ports keys in the input_data_ports dictionary :param dictionary: The dictionary that is added to the scoped data :param state: The state to which the input_dat...
entailment
def add_state_execution_output_to_scoped_data(self, dictionary, state): """Add a state execution output to the scoped data :param dictionary: The dictionary that is added to the scoped data :param state: The state that finished execution and provide the dictionary """ for output...
Add a state execution output to the scoped data :param dictionary: The dictionary that is added to the scoped data :param state: The state that finished execution and provide the dictionary
entailment
def add_default_values_of_scoped_variables_to_scoped_data(self): """Add the scoped variables default values to the scoped_data dictionary """ for key, scoped_var in self.scoped_variables.items(): self.scoped_data[str(scoped_var.data_port_id) + self.state_id] = \ Scop...
Add the scoped variables default values to the scoped_data dictionary
entailment
def update_scoped_variables_with_output_dictionary(self, dictionary, state): """Update the values of the scoped variables with the output dictionary of a specific state. :param: the dictionary to update the scoped variables with :param: the state the output dictionary belongs to """ ...
Update the values of the scoped variables with the output dictionary of a specific state. :param: the dictionary to update the scoped variables with :param: the state the output dictionary belongs to
entailment
def change_state_id(self, state_id=None): """ Changes the id of the state to a new id. This functions replaces the old state_id with the new state_id in all data flows and transitions. :param state_id: The new state if of the state """ old_state_id = self.state_id ...
Changes the id of the state to a new id. This functions replaces the old state_id with the new state_id in all data flows and transitions. :param state_id: The new state if of the state
entailment
def get_state_for_transition(self, transition): """Calculate the target state of a transition :param transition: The transition of which the target state is determined :return: the to-state of the transition :raises exceptions.TypeError: if the transition parameter is of wrong type ...
Calculate the target state of a transition :param transition: The transition of which the target state is determined :return: the to-state of the transition :raises exceptions.TypeError: if the transition parameter is of wrong type
entailment
def write_output_data(self, specific_output_dictionary=None): """ Write the scoped data to output of the state. Called before exiting the container state. :param specific_output_dictionary: an optional dictionary to write the output data in :return: """ if isinstance(specific_ou...
Write the scoped data to output of the state. Called before exiting the container state. :param specific_output_dictionary: an optional dictionary to write the output data in :return:
entailment
def check_child_validity(self, child): """Check validity of passed child object The method is called by state child objects (transitions, data flows) when these are initialized or changed. The method checks the type of the child and then checks its validity in the context of the state. ...
Check validity of passed child object The method is called by state child objects (transitions, data flows) when these are initialized or changed. The method checks the type of the child and then checks its validity in the context of the state. :param object child: The child of the state that ...
entailment
def check_data_port_connection(self, check_data_port): """Checks the connection validity of a data port The method is called by a child state to check the validity of a data port in case it is connected with data flows. The data port does not belong to 'self', but to one of self.states. ...
Checks the connection validity of a data port The method is called by a child state to check the validity of a data port in case it is connected with data flows. The data port does not belong to 'self', but to one of self.states. If the data port is connected to a data flow, the method checks, ...
entailment
def _check_data_port_id(self, data_port): """Checks the validity of a data port id Checks whether the id of the given data port is already used by anther data port (input, output, scoped vars) within the state. :param rafcon.core.data_port.DataPort data_port: The data port to be checke...
Checks the validity of a data port id Checks whether the id of the given data port is already used by anther data port (input, output, scoped vars) within the state. :param rafcon.core.data_port.DataPort data_port: The data port to be checked :return bool validity, str message: validit...
entailment
def _check_data_port_name(self, data_port): """Checks the validity of a data port name Checks whether the name of the given data port is already used by anther data port within the state. Names must be unique with input data ports, output data ports and scoped variables. :param rafcon....
Checks the validity of a data port name Checks whether the name of the given data port is already used by anther data port within the state. Names must be unique with input data ports, output data ports and scoped variables. :param rafcon.core.data_port.DataPort data_port: The data port to be ...
entailment
def _check_data_flow_validity(self, check_data_flow): """Checks the validity of a data flow Calls further checks to inspect the id, ports and data types. :param rafcon.core.data_flow.DataFlow check_data_flow: The data flow to be checked :return bool validity, str message: validity is T...
Checks the validity of a data flow Calls further checks to inspect the id, ports and data types. :param rafcon.core.data_flow.DataFlow check_data_flow: The data flow to be checked :return bool validity, str message: validity is True, when the data flow is valid, False else. message gives ...
entailment
def _check_data_flow_id(self, data_flow): """Checks the validity of a data flow id Checks whether the id of the given data flow is already by anther data flow used within the state. :param rafcon.core.data_flow.DataFlow data_flow: The data flow to be checked :return bool validity, str ...
Checks the validity of a data flow id Checks whether the id of the given data flow is already by anther data flow used within the state. :param rafcon.core.data_flow.DataFlow data_flow: The data flow to be checked :return bool validity, str message: validity is True, when the data flow is vali...
entailment
def _check_data_flow_ports(self, data_flow): """Checks the validity of the ports of a data flow Checks whether the ports of a data flow are existing and whether it is allowed to connect these ports. :param rafcon.core.data_flow.DataFlow data_flow: The data flow to be checked :return bo...
Checks the validity of the ports of a data flow Checks whether the ports of a data flow are existing and whether it is allowed to connect these ports. :param rafcon.core.data_flow.DataFlow data_flow: The data flow to be checked :return bool validity, str message: validity is True, when the dat...
entailment
def _check_data_flow_types(self, check_data_flow): """Checks the validity of the data flow connection Checks whether the ports of a data flow have matching data types. :param rafcon.core.data_flow.DataFlow check_data_flow: The data flow to be checked :return bool validity, str message:...
Checks the validity of the data flow connection Checks whether the ports of a data flow have matching data types. :param rafcon.core.data_flow.DataFlow check_data_flow: The data flow to be checked :return bool validity, str message: validity is True, when the data flow is valid, False else. me...
entailment
def _check_transition_validity(self, check_transition): """Checks the validity of a transition Calls further checks to inspect the id, origin, target and connection of the transition. :param rafcon.core.transition.Transition check_transition: The transition to be checked :return bool v...
Checks the validity of a transition Calls further checks to inspect the id, origin, target and connection of the transition. :param rafcon.core.transition.Transition check_transition: The transition to be checked :return bool validity, str message: validity is True, when the transition is vali...
entailment
def _check_transition_id(self, transition): """Checks the validity of a transition id Checks whether the transition id is already used by another transition within the state :param rafcon.core.transition.Transition transition: The transition to be checked :return bool validity, str mes...
Checks the validity of a transition id Checks whether the transition id is already used by another transition within the state :param rafcon.core.transition.Transition transition: The transition to be checked :return bool validity, str message: validity is True, when the transition is valid, F...
entailment
def _check_start_transition(self, start_transition): """Checks the validity of a start transition Checks whether the given transition is a start transition a whether it is the only one within the state. :param rafcon.core.transition.Transition start_transition: The transition to be checked ...
Checks the validity of a start transition Checks whether the given transition is a start transition a whether it is the only one within the state. :param rafcon.core.transition.Transition start_transition: The transition to be checked :return bool validity, str message: validity is True, when ...
entailment
def _check_transition_target(self, transition): """Checks the validity of a transition target Checks whether the transition target is valid. :param rafcon.core.transition.Transition transition: The transition to be checked :return bool validity, str message: validity is True, when the ...
Checks the validity of a transition target Checks whether the transition target is valid. :param rafcon.core.transition.Transition transition: The transition to be checked :return bool validity, str message: validity is True, when the transition is valid, False else. message gives ...
entailment
def _check_transition_origin(self, transition): """Checks the validity of a transition origin Checks whether the transition origin is valid. :param rafcon.core.transition.Transition transition: The transition to be checked :return bool validity, str message: validity is True, when the ...
Checks the validity of a transition origin Checks whether the transition origin is valid. :param rafcon.core.transition.Transition transition: The transition to be checked :return bool validity, str message: validity is True, when the transition is valid, False else. message gives ...
entailment
def _check_transition_connection(self, check_transition): """Checks the validity of a transition connection Checks whether the transition is allowed to connect the origin with the target. :param rafcon.core.transition.Transition check_transition: The transition to be checked :return bo...
Checks the validity of a transition connection Checks whether the transition is allowed to connect the origin with the target. :param rafcon.core.transition.Transition check_transition: The transition to be checked :return bool validity, str message: validity is True, when the transition is va...
entailment
def get_states_statistics(self, hierarchy_level): """ Returns the numer of child states :return: """ number_of_all_child_states = 0 max_child_hierarchy_level = 0 for s in self.states.values(): child_hierarchy_level = 0 number_of_child_state...
Returns the numer of child states :return:
entailment
def get_number_of_transitions(self): """ Returns the numer of child states :return: """ number_of_all_transitions = 0 for s in self.states.values(): number_of_all_transitions += s.get_number_of_transitions() return number_of_all_transitions + len(self....
Returns the numer of child states :return:
entailment
def states(self, states): """ Setter for _states field See property :param states: Dictionary of States :raises exceptions.TypeError: if the states parameter is of wrong type :raises exceptions.AttributeError: if the keys of the dictionary and the state_ids in the dictionary do...
Setter for _states field See property :param states: Dictionary of States :raises exceptions.TypeError: if the states parameter is of wrong type :raises exceptions.AttributeError: if the keys of the dictionary and the state_ids in the dictionary do not match
entailment
def transitions(self, transitions): """ Setter for _transitions field See property :param: transitions: Dictionary transitions[transition_id] of :class:`rafcon.core.transition.Transition` :raises exceptions.TypeError: if the transitions parameter has the wrong type :raises exce...
Setter for _transitions field See property :param: transitions: Dictionary transitions[transition_id] of :class:`rafcon.core.transition.Transition` :raises exceptions.TypeError: if the transitions parameter has the wrong type :raises exceptions.AttributeError: if the keys of the transi...
entailment
def data_flows(self, data_flows): """ Setter for _data_flows field See property :param dict data_flows: Dictionary data_flows[data_flow_id] of :class:`rafcon.core.data_flow.DataFlow` :raises exceptions.TypeError: if the data_flows parameter has the wrong type :raises exceptions...
Setter for _data_flows field See property :param dict data_flows: Dictionary data_flows[data_flow_id] of :class:`rafcon.core.data_flow.DataFlow` :raises exceptions.TypeError: if the data_flows parameter has the wrong type :raises exceptions.AttributeError: if the keys of the data_flows...
entailment
def start_state_id(self): """ The start state is the state to which the first transition goes to. The setter-method creates a unique first transition to the state with the given id. Existing first transitions are removed. If the given state id is None, the first transition is removed. ...
The start state is the state to which the first transition goes to. The setter-method creates a unique first transition to the state with the given id. Existing first transitions are removed. If the given state id is None, the first transition is removed. :return: The id of the start state
entailment
def start_state_id(self, start_state_id, to_outcome=None): """Set the start state of the container state See property :param start_state_id: The state id of the state which should be executed first in the Container state :raises exceptions.ValueError: if the start_state_id does not exi...
Set the start state of the container state See property :param start_state_id: The state id of the state which should be executed first in the Container state :raises exceptions.ValueError: if the start_state_id does not exist in :py:attr:`rafcon.core.states...
entailment
def scoped_variables(self, scoped_variables): """ Setter for _scoped_variables field See property :param dict scoped_variables: Dictionary scoped_variables[data_port_id] of :class:`rafcon.core.scope.ScopedVariable` :raises exceptions.TypeError: if the scoped_variables parameter has the...
Setter for _scoped_variables field See property :param dict scoped_variables: Dictionary scoped_variables[data_port_id] of :class:`rafcon.core.scope.ScopedVariable` :raises exceptions.TypeError: if the scoped_variables parameter has the wrong type :raises exceptions.AttributeError: if ...
entailment
def _execute(self, execute_inputs, execute_outputs, backward_execution=False): """Calls the custom execute function of the script.py of the state """ self._script.build_module() outcome_item = self._script.execute(self, execute_inputs, execute_outputs, backward_execution) # in...
Calls the custom execute function of the script.py of the state
entailment
def run(self): """ This defines the sequence of actions that are taken when the execution state is executed :return: """ if self.is_root_state: self.execution_history.push_call_history_item(self, CallType.EXECUTE, None, self.input_data) logger.debug("Running {0}{1}"...
This defines the sequence of actions that are taken when the execution state is executed :return:
entailment
def register_view(self, view): """Called when the view was registered""" super(StateMachineTreeController, self).register_view(view) self.view.connect('button_press_event', self.mouse_click) self.view_is_registered = True self.update(with_expand=True)
Called when the view was registered
entailment
def register_actions(self, shortcut_manager): """Register callback methods for triggered actions :param rafcon.gui.shortcut_manager.ShortcutManager shortcut_manager: Shortcut Manager Object holding mappings between shortcuts and actions. """ shortcut_manager.add_callback_for...
Register callback methods for triggered actions :param rafcon.gui.shortcut_manager.ShortcutManager shortcut_manager: Shortcut Manager Object holding mappings between shortcuts and actions.
entailment
def register(self): """Change the state machine that is observed for new selected states to the selected state machine.""" self._do_selection_update = True # relieve old model if self.__my_selected_sm_id is not None: # no old models available self.relieve_model(self._selecte...
Change the state machine that is observed for new selected states to the selected state machine.
entailment
def paste_action_callback(self, *event): """Callback method for paste action""" if react_to_event(self.view, self.tree_view, event): sm_selection, _ = self.get_state_machine_selection() # only list specific elements are cut by widget if len(sm_selection.states) == 1: ...
Callback method for paste action
entailment
def _add_new_state(self, *event, **kwargs): """Triggered when shortcut keys for adding a new state are pressed, or Menu Bar "Edit, Add State" is clicked. Adds a new state only if the the state machine tree is in focus. """ if react_to_event(self.view, self.view['state_machine_tree_view'...
Triggered when shortcut keys for adding a new state are pressed, or Menu Bar "Edit, Add State" is clicked. Adds a new state only if the the state machine tree is in focus.
entailment
def selection_changed(self, widget, event=None): """Notify state machine about tree view selection""" # do not forward cursor selection updates if state update is running # TODO maybe make this generic for respective abstract controller if self._state_which_is_updated: return...
Notify state machine about tree view selection
entailment
def redo_expansion_state(self, ignore_not_existing_rows=False): """ Considers the tree to be collapsed and expand into all tree item with the flag set True """ def set_expansion_state(state_path): state_row_iter = self.state_row_iter_dict_by_state_path[state_path] if state_row_i...
Considers the tree to be collapsed and expand into all tree item with the flag set True
entailment
def update(self, changed_state_model=None, with_expand=False): """Checks if all states are in tree and if tree has states which were deleted :param changed_state_model: Model that row has to be updated :param with_expand: The expand flag for the tree """ if not self.view_is_regi...
Checks if all states are in tree and if tree has states which were deleted :param changed_state_model: Model that row has to be updated :param with_expand: The expand flag for the tree
entailment
def show_content(self, state_model): """Check state machine tree specific show content flag. Is returning true if the upper most library state of a state model has a enabled show content flag or if there is no library root state above this state. :param rafcon.gui.models.abstract_state...
Check state machine tree specific show content flag. Is returning true if the upper most library state of a state model has a enabled show content flag or if there is no library root state above this state. :param rafcon.gui.models.abstract_state.AbstractStateModel state_model: The state model...
entailment
def insert_and_update_recursively(self, parent_iter, state_model, with_expand=False): """ Insert and/or update the handed state model in parent tree store element iterator :param parent_iter: Parent tree store iterator the insert should be performed in :param StateModel state_model: Model of st...
Insert and/or update the handed state model in parent tree store element iterator :param parent_iter: Parent tree store iterator the insert should be performed in :param StateModel state_model: Model of state that has to be insert and/or updated :param bool with_expand: Trigger to expand tree ...
entailment
def get_state_machine_selection(self): """Getter state machine selection :return: selection object, filtered set of selected states :rtype: rafcon.gui.selection.Selection, set """ if self._selected_sm_model: return self._selected_sm_model.selection, self._selected_sm...
Getter state machine selection :return: selection object, filtered set of selected states :rtype: rafcon.gui.selection.Selection, set
entailment
def _handle_double_click(self, event): """ Double click with left mouse button focuses the state and toggles the collapse status""" if event.get_button()[1] == 1: # Left mouse button path_info = self.tree_view.get_path_at_pos(int(event.x), int(event.y)) if path_info: # Valid en...
Double click with left mouse button focuses the state and toggles the collapse status
entailment
def execute(self, state, inputs=None, outputs=None, backward_execution=False): """Execute the user 'execute' function specified in the script :param ExecutionState state: the state belonging to the execute function, refers to 'self' :param dict inputs: the input data of the script :para...
Execute the user 'execute' function specified in the script :param ExecutionState state: the state belonging to the execute function, refers to 'self' :param dict inputs: the input data of the script :param dict outputs: the output data of the script :param bool backward_execution: Flag...
entailment
def _load_script(self): """Loads the script from the filesystem :raises exceptions.IOError: if the script file could not be opened """ script_text = filesystem.read_file(self.path, self.filename) if not script_text: raise IOError("Script file could not be opened or ...
Loads the script from the filesystem :raises exceptions.IOError: if the script file could not be opened
entailment
def build_module(self): """Builds a temporary module from the script file :raises exceptions.IOError: if the compilation of the script module failed """ try: imp.acquire_lock() module_name = os.path.splitext(self.filename)[0] + str(self._script_id) #...
Builds a temporary module from the script file :raises exceptions.IOError: if the compilation of the script module failed
entailment
def register_view(self, view): """Called when the View was registered""" super(MenuBarController, self).register_view(view) data_flow_mode = global_runtime_config.get_config_value("DATA_FLOW_MODE", False) view["data_flow_mode"].set_active(data_flow_mode) show_data_flows = global...
Called when the View was registered
entailment
def on_config_value_changed(self, config_m, prop_name, info): """Callback when a config value has been changed :param ConfigModel config_m: The config model that has been changed :param str prop_name: Should always be 'config' :param dict info: Information e.g. about the changed config ...
Callback when a config value has been changed :param ConfigModel config_m: The config model that has been changed :param str prop_name: Should always be 'config' :param dict info: Information e.g. about the changed config key
entailment
def _update_recently_opened_state_machines(self): """Update the sub menu Open Recent in File menu Method clean's first all menu items of the sub menu 'recent open', then insert the user menu item to clean recent opened state machine paths and finally insert menu items for all elements in recent...
Update the sub menu Open Recent in File menu Method clean's first all menu items of the sub menu 'recent open', then insert the user menu item to clean recent opened state machine paths and finally insert menu items for all elements in recent opened state machines list.
entailment
def on_full_screen_activate(self, *args): """ function to display the currently selected state machine in full screen mode :param args: :return: """ self.sm_notebook.set_show_tabs(False) self.main_window_view['graphical_editor_vbox'].remove(self.sm_notebook) ...
function to display the currently selected state machine in full screen mode :param args: :return:
entailment
def unregister_view(self): """import log Unregister all registered functions to a view element :return: """ for handler_id in self.handler_ids.keys(): self.view[handler_id].disconnect(self.handler_ids[handler_id])
import log Unregister all registered functions to a view element :return:
entailment
def register_actions(self, shortcut_manager): """Register callback methods for triggered actions :param rafcon.gui.shortcut_manager.ShortcutManager shortcut_manager: Shortcut Manager Object holding mappings between shortcuts and actions. """ self.add_callback_to_shortcut_man...
Register callback methods for triggered actions :param rafcon.gui.shortcut_manager.ShortcutManager shortcut_manager: Shortcut Manager Object holding mappings between shortcuts and actions.
entailment
def add_callback_to_shortcut_manager(self, action, callback): """ Helper function to add an callback for an action to the shortcut manager. :param action: the action to add a shortcut for :param callback: the callback if the action is executed :return: """ if acti...
Helper function to add an callback for an action to the shortcut manager. :param action: the action to add a shortcut for :param callback: the callback if the action is executed :return:
entailment
def remove_all_callbacks(self): """ Remove all callbacks registered to the shortcut manager :return: """ for action in self.registered_shortcut_callbacks.keys(): for callback in self.registered_shortcut_callbacks[action]: self.shortcut_manager.remove_c...
Remove all callbacks registered to the shortcut manager :return:
entailment
def point_left_of_line(point, line_start, line_end): """Determines whether a point is left of a line :param point: Point to be checked (tuple with x any y coordinate) :param line_start: Starting point of the line (tuple with x any y coordinate) :param line_end: End point of the line (tuple with x any y...
Determines whether a point is left of a line :param point: Point to be checked (tuple with x any y coordinate) :param line_start: Starting point of the line (tuple with x any y coordinate) :param line_end: End point of the line (tuple with x any y coordinate) :return: True if point is left of line, els...
entailment
def point_on_line(point, line_start, line_end, accuracy=50.): """Checks whether a point lies on a line The function checks whether the point "point" (P) lies on the line defined by its starting point line_start (A) and its end point line_end (B). This is done by comparing the distance of [AB] with the ...
Checks whether a point lies on a line The function checks whether the point "point" (P) lies on the line defined by its starting point line_start (A) and its end point line_end (B). This is done by comparing the distance of [AB] with the sum of the distances [AP] and [PB]. If the difference is smaller ...
entailment
def point_in_triangle(p, v1, v2, v3): """Checks whether a point is within the given triangle The function checks, whether the given point p is within the triangle defined by the the three corner point v1, v2 and v3. This is done by checking whether the point is on all three half-planes defined by the t...
Checks whether a point is within the given triangle The function checks, whether the given point p is within the triangle defined by the the three corner point v1, v2 and v3. This is done by checking whether the point is on all three half-planes defined by the three edges of the triangle. :param p: The...
entailment
def equal(t1, t2, digit=None): """ Compare two iterators and its elements on specific digit precision The method assume that t1 and t2 are are list or tuple. :param t1: First element to compare :param t2: Second element to compare :param int digit: Number of digits to compare :rtype bool :...
Compare two iterators and its elements on specific digit precision The method assume that t1 and t2 are are list or tuple. :param t1: First element to compare :param t2: Second element to compare :param int digit: Number of digits to compare :rtype bool :return: True if equal and False if diff...
entailment