repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.get_default_input_values_for_state | def get_default_input_values_for_state(self, state):
""" Computes the default input values for a state
:param State state: the state to get the default input values for
"""
from rafcon.core.states.library_state import LibraryState
result_dict = {}
for input_port_key, va... | python | def get_default_input_values_for_state(self, state):
""" Computes the default input values for a state
:param State state: the state to get the default input values for
"""
from rafcon.core.states.library_state import LibraryState
result_dict = {}
for input_port_key, va... | [
"def",
"get_default_input_values_for_state",
"(",
"self",
",",
"state",
")",
":",
"from",
"rafcon",
".",
"core",
".",
"states",
".",
"library_state",
"import",
"LibraryState",
"result_dict",
"=",
"{",
"}",
"for",
"input_port_key",
",",
"value",
"in",
"state",
... | Computes the default input values for a state
:param State state: the state to get the default input values for | [
"Computes",
"the",
"default",
"input",
"values",
"for",
"a",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L326-L356 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.create_output_dictionary_for_state | def create_output_dictionary_for_state(state):
"""Return empty output dictionary for a state
:param state: the state of which the output data is determined
:return: the output data of the target state
"""
from rafcon.core.states.library_state import LibraryState
result_d... | python | def create_output_dictionary_for_state(state):
"""Return empty output dictionary for a state
:param state: the state of which the output data is determined
:return: the output data of the target state
"""
from rafcon.core.states.library_state import LibraryState
result_d... | [
"def",
"create_output_dictionary_for_state",
"(",
"state",
")",
":",
"from",
"rafcon",
".",
"core",
".",
"states",
".",
"library_state",
"import",
"LibraryState",
"result_dict",
"=",
"{",
"}",
"for",
"key",
",",
"data_port",
"in",
"state",
".",
"output_data_port... | Return empty output dictionary for a state
:param state: the state of which the output data is determined
:return: the output data of the target state | [
"Return",
"empty",
"output",
"dictionary",
"for",
"a",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L359-L372 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.add_input_data_port | def add_input_data_port(self, name, data_type=None, default_value=None, data_port_id=None):
"""Add a new input data port to the state.
:param str name: the name of the new input data port
:param data_type: the type of the new output data port considered of class :class:`type` or
... | python | def add_input_data_port(self, name, data_type=None, default_value=None, data_port_id=None):
"""Add a new input data port to the state.
:param str name: the name of the new input data port
:param data_type: the type of the new output data port considered of class :class:`type` or
... | [
"def",
"add_input_data_port",
"(",
"self",
",",
"name",
",",
"data_type",
"=",
"None",
",",
"default_value",
"=",
"None",
",",
"data_port_id",
"=",
"None",
")",
":",
"if",
"data_port_id",
"is",
"None",
":",
"# All data port ids have to passed to the id generation as... | Add a new input data port to the state.
:param str name: the name of the new input data port
:param data_type: the type of the new output data port considered of class :class:`type` or
:class:`str` which has to be convertible to :class:`type`
:param default_value: the ... | [
"Add",
"a",
"new",
"input",
"data",
"port",
"to",
"the",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L379-L403 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.remove_input_data_port | def remove_input_data_port(self, data_port_id, force=False, destroy=True):
"""Remove an input data port from the state
:param int data_port_id: the id or the output data port to remove
:param bool force: if the removal should be forced without checking constraints
:raises exceptions.Att... | python | def remove_input_data_port(self, data_port_id, force=False, destroy=True):
"""Remove an input data port from the state
:param int data_port_id: the id or the output data port to remove
:param bool force: if the removal should be forced without checking constraints
:raises exceptions.Att... | [
"def",
"remove_input_data_port",
"(",
"self",
",",
"data_port_id",
",",
"force",
"=",
"False",
",",
"destroy",
"=",
"True",
")",
":",
"if",
"data_port_id",
"in",
"self",
".",
"_input_data_ports",
":",
"if",
"destroy",
":",
"self",
".",
"remove_data_flows_with_... | Remove an input data port from the state
:param int data_port_id: the id or the output data port to remove
:param bool force: if the removal should be forced without checking constraints
:raises exceptions.AttributeError: if the specified input data port does not exist | [
"Remove",
"an",
"input",
"data",
"port",
"from",
"the",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L407-L420 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.remove_data_flows_with_data_port_id | def remove_data_flows_with_data_port_id(self, data_port_id):
"""Remove all data flows whose from_key or to_key equals the passed data_port_id
:param 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
... | python | def remove_data_flows_with_data_port_id(self, data_port_id):
"""Remove all data flows whose from_key or to_key equals the passed data_port_id
:param 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
... | [
"def",
"remove_data_flows_with_data_port_id",
"(",
"self",
",",
"data_port_id",
")",
":",
"if",
"not",
"self",
".",
"is_root_state",
":",
"# delete all data flows in parent related to data_port_id and self.state_id",
"data_flow_ids_to_remove",
"=",
"[",
"]",
"for",
"data_flow... | Remove all data flows whose from_key or to_key equals the passed data_port_id
:param 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",
"all",
"data",
"flows",
"whose",
"from_key",
"or",
"to_key",
"equals",
"the",
"passed",
"data_port_id"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L423-L439 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.add_output_data_port | def add_output_data_port(self, name, data_type, default_value=None, data_port_id=None):
"""Add a new output data port to the state
:param str name: the name of the new output data port
:param data_type: the type of the new output data port considered of class :class:`type` or
... | python | def add_output_data_port(self, name, data_type, default_value=None, data_port_id=None):
"""Add a new output data port to the state
:param str name: the name of the new output data port
:param data_type: the type of the new output data port considered of class :class:`type` or
... | [
"def",
"add_output_data_port",
"(",
"self",
",",
"name",
",",
"data_type",
",",
"default_value",
"=",
"None",
",",
"data_port_id",
"=",
"None",
")",
":",
"if",
"data_port_id",
"is",
"None",
":",
"# All data port ids have to passed to the id generation as the data port i... | Add a new output data port to the state
:param str name: the name of the new output data port
:param data_type: the type of the new output data port considered of class :class:`type` or
:class:`str` which has to be convertible to :class:`type`
:param default_value: the... | [
"Add",
"a",
"new",
"output",
"data",
"port",
"to",
"the",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L443-L467 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.remove_output_data_port | def remove_output_data_port(self, data_port_id, force=False, destroy=True):
"""Remove an output data port from the state
:param int data_port_id: the id of the output data port to remove
:raises exceptions.AttributeError: if the specified input data port does not exist
"""
if da... | python | def remove_output_data_port(self, data_port_id, force=False, destroy=True):
"""Remove an output data port from the state
:param int data_port_id: the id of the output data port to remove
:raises exceptions.AttributeError: if the specified input data port does not exist
"""
if da... | [
"def",
"remove_output_data_port",
"(",
"self",
",",
"data_port_id",
",",
"force",
"=",
"False",
",",
"destroy",
"=",
"True",
")",
":",
"if",
"data_port_id",
"in",
"self",
".",
"_output_data_ports",
":",
"if",
"destroy",
":",
"self",
".",
"remove_data_flows_wit... | Remove an output data port from the state
:param int data_port_id: the id of the output data port to remove
:raises exceptions.AttributeError: if the specified input data port does not exist | [
"Remove",
"an",
"output",
"data",
"port",
"from",
"the",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L471-L483 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.get_io_data_port_id_from_name_and_type | def get_io_data_port_id_from_name_and_type(self, name, data_port_type):
"""Returns the data_port_id of a data_port with a certain name and data port type
:param name: the name of the target data_port
:param data_port_type: the data port type of the target data port
:return: the data por... | python | def get_io_data_port_id_from_name_and_type(self, name, data_port_type):
"""Returns the data_port_id of a data_port with a certain name and data port type
:param name: the name of the target data_port
:param data_port_type: the data port type of the target data port
:return: the data por... | [
"def",
"get_io_data_port_id_from_name_and_type",
"(",
"self",
",",
"name",
",",
"data_port_type",
")",
":",
"if",
"data_port_type",
"is",
"InputDataPort",
":",
"for",
"ip_id",
",",
"output_port",
"in",
"self",
".",
"input_data_ports",
".",
"items",
"(",
")",
":"... | Returns the data_port_id of a data_port with a certain name and data port type
:param name: the name of the target data_port
:param data_port_type: the data port type of the target data port
:return: the data port specified by the name and the type
:raises exceptions.AttributeError: if ... | [
"Returns",
"the",
"data_port_id",
"of",
"a",
"data_port",
"with",
"a",
"certain",
"name",
"and",
"data",
"port",
"type"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L485-L505 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.get_data_port_by_id | 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.
:param int data_port_id: the unique id of the data port
:return: the data port with the searched id o... | python | 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.
:param int data_port_id: the unique id of the data port
:return: the data port with the searched id o... | [
"def",
"get_data_port_by_id",
"(",
"self",
",",
"data_port_id",
")",
":",
"if",
"data_port_id",
"in",
"self",
".",
"input_data_ports",
":",
"return",
"self",
".",
"input_data_ports",
"[",
"data_port_id",
"]",
"elif",
"data_port_id",
"in",
"self",
".",
"output_da... | 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.
:param int data_port_id: the unique id of the data port
:return: the data port with the searched id or None if it is not found | [
"Search",
"for",
"the",
"given",
"data",
"port",
"id",
"in",
"the",
"data",
"ports",
"of",
"the",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L507-L518 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.get_path | def get_path(self, appendix=None, by_name=False):
""" Recursively create the path of the state.
The path is generated in bottom up method i.e. from the nested child states to the root state. The method
concatenates either State.state_id (always unique) or State.name (maybe not unique but human ... | python | def get_path(self, appendix=None, by_name=False):
""" Recursively create the path of the state.
The path is generated in bottom up method i.e. from the nested child states to the root state. The method
concatenates either State.state_id (always unique) or State.name (maybe not unique but human ... | [
"def",
"get_path",
"(",
"self",
",",
"appendix",
"=",
"None",
",",
"by_name",
"=",
"False",
")",
":",
"if",
"by_name",
":",
"state_identifier",
"=",
"self",
".",
"name",
"else",
":",
"state_identifier",
"=",
"self",
".",
"state_id",
"if",
"not",
"self",
... | Recursively create the path of the state.
The path is generated in bottom up method i.e. from the nested child states to the root state. The method
concatenates either State.state_id (always unique) or State.name (maybe not unique but human readable) as
state identifier for the path.
:... | [
"Recursively",
"create",
"the",
"path",
"of",
"the",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L527-L553 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.get_storage_path | def get_storage_path(self, appendix=None):
""" Recursively create the storage path of the state.
The path is generated in bottom up method i.e. from the nested child states to the root state. The method
concatenates the concatenation of (State.name and State.state_id) as state identifier for th... | python | def get_storage_path(self, appendix=None):
""" Recursively create the storage path of the state.
The path is generated in bottom up method i.e. from the nested child states to the root state. The method
concatenates the concatenation of (State.name and State.state_id) as state identifier for th... | [
"def",
"get_storage_path",
"(",
"self",
",",
"appendix",
"=",
"None",
")",
":",
"state_identifier",
"=",
"storage",
".",
"get_storage_id_for_state",
"(",
"self",
")",
"if",
"not",
"self",
".",
"is_root_state",
":",
"if",
"appendix",
"is",
"None",
":",
"retur... | Recursively create the storage path of the state.
The path is generated in bottom up method i.e. from the nested child states to the root state. The method
concatenates the concatenation of (State.name and State.state_id) as state identifier for the path.
:param str appendix: the part of the p... | [
"Recursively",
"create",
"the",
"storage",
"path",
"of",
"the",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L555-L576 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.get_state_machine | def get_state_machine(self):
"""Get a reference of the state_machine the state belongs to
:rtype rafcon.core.state_machine.StateMachine
:return: respective state machine
"""
if self.parent:
if self.is_root_state:
return self.parent
else:
... | python | def get_state_machine(self):
"""Get a reference of the state_machine the state belongs to
:rtype rafcon.core.state_machine.StateMachine
:return: respective state machine
"""
if self.parent:
if self.is_root_state:
return self.parent
else:
... | [
"def",
"get_state_machine",
"(",
"self",
")",
":",
"if",
"self",
".",
"parent",
":",
"if",
"self",
".",
"is_root_state",
":",
"return",
"self",
".",
"parent",
"else",
":",
"return",
"self",
".",
"parent",
".",
"get_state_machine",
"(",
")",
"return",
"No... | Get a reference of the state_machine the state belongs to
:rtype rafcon.core.state_machine.StateMachine
:return: respective state machine | [
"Get",
"a",
"reference",
"of",
"the",
"state_machine",
"the",
"state",
"belongs",
"to"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L578-L590 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.file_system_path | def file_system_path(self, file_system_path):
"""Setter for file_system_path attribute of state
:param str file_system_path:
:return:
"""
if not isinstance(file_system_path, string_types):
raise TypeError("file_system_path must be a string")
self._file_system... | python | def file_system_path(self, file_system_path):
"""Setter for file_system_path attribute of state
:param str file_system_path:
:return:
"""
if not isinstance(file_system_path, string_types):
raise TypeError("file_system_path must be a string")
self._file_system... | [
"def",
"file_system_path",
"(",
"self",
",",
"file_system_path",
")",
":",
"if",
"not",
"isinstance",
"(",
"file_system_path",
",",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"\"file_system_path must be a string\"",
")",
"self",
".",
"_file_system_path",
"... | Setter for file_system_path attribute of state
:param str file_system_path:
:return: | [
"Setter",
"for",
"file_system_path",
"attribute",
"of",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L605-L613 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.add_outcome | def add_outcome(self, name, outcome_id=None):
"""Add a new outcome to the state
:param str name: the name of the outcome to add
:param int outcome_id: the optional outcome_id of the new outcome
:return: outcome_id: the outcome if of the generated state
:rtype: int
"""
... | python | def add_outcome(self, name, outcome_id=None):
"""Add a new outcome to the state
:param str name: the name of the outcome to add
:param int outcome_id: the optional outcome_id of the new outcome
:return: outcome_id: the outcome if of the generated state
:rtype: int
"""
... | [
"def",
"add_outcome",
"(",
"self",
",",
"name",
",",
"outcome_id",
"=",
"None",
")",
":",
"if",
"outcome_id",
"is",
"None",
":",
"outcome_id",
"=",
"generate_outcome_id",
"(",
"list",
"(",
"self",
".",
"outcomes",
".",
"keys",
"(",
")",
")",
")",
"if",... | Add a new outcome to the state
:param str name: the name of the outcome to add
:param int outcome_id: the optional outcome_id of the new outcome
:return: outcome_id: the outcome if of the generated state
:rtype: int | [
"Add",
"a",
"new",
"outcome",
"to",
"the",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L624-L643 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.remove | def remove(self, state_element, recursive=True, force=False, destroy=True):
"""Remove item from state
:param StateElement state_element: State element to be removed
:param bool recursive: Only applies to removal of state and decides whether the removal should be called
recursively o... | python | def remove(self, state_element, recursive=True, force=False, destroy=True):
"""Remove item from state
:param StateElement state_element: State element to be removed
:param bool recursive: Only applies to removal of state and decides whether the removal should be called
recursively o... | [
"def",
"remove",
"(",
"self",
",",
"state_element",
",",
"recursive",
"=",
"True",
",",
"force",
"=",
"False",
",",
"destroy",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"state_element",
",",
"Income",
")",
":",
"self",
".",
"remove_income",
"(",
... | Remove item from state
:param StateElement state_element: 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 without c... | [
"Remove",
"item",
"from",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L646-L664 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.remove_outcome | def remove_outcome(self, outcome_id, force=False, destroy=True):
"""Remove an outcome from the state
:param int outcome_id: the id of the outcome to remove
:raises exceptions.AttributeError: if the specified outcome does not exist or
equals the aborte... | python | def remove_outcome(self, outcome_id, force=False, destroy=True):
"""Remove an outcome from the state
:param int outcome_id: the id of the outcome to remove
:raises exceptions.AttributeError: if the specified outcome does not exist or
equals the aborte... | [
"def",
"remove_outcome",
"(",
"self",
",",
"outcome_id",
",",
"force",
"=",
"False",
",",
"destroy",
"=",
"True",
")",
":",
"if",
"outcome_id",
"not",
"in",
"self",
".",
"outcomes",
":",
"raise",
"AttributeError",
"(",
"\"There is no outcome_id %s\"",
"%",
"... | Remove an outcome from the state
:param int outcome_id: the id of the outcome to remove
:raises exceptions.AttributeError: if the specified outcome does not exist or
equals the aborted or preempted outcome | [
"Remove",
"an",
"outcome",
"from",
"the",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L676-L702 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.check_child_validity | def check_child_validity(self, child):
"""Check validity of passed child object
The method is called by state child objects (outcomes, data ports) 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.
:p... | python | def check_child_validity(self, child):
"""Check validity of passed child object
The method is called by state child objects (outcomes, data ports) 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.
:p... | [
"def",
"check_child_validity",
"(",
"self",
",",
"child",
")",
":",
"# Check type of child and call appropriate validity test",
"if",
"isinstance",
"(",
"child",
",",
"Income",
")",
":",
"return",
"self",
".",
"_check_income_validity",
"(",
"child",
")",
"if",
"isin... | Check validity of passed child object
The method is called by state child objects (outcomes, data ports) 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 is ... | [
"Check",
"validity",
"of",
"passed",
"child",
"object"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L719-L738 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State._check_outcome_validity | def _check_outcome_validity(self, check_outcome):
"""Checks the validity of an outcome
Checks whether the id or the name of the outcome is already used by another outcome within the state.
:param rafcon.core.logical_port.Outcome check_outcome: The outcome to be checked
:return bool val... | python | def _check_outcome_validity(self, check_outcome):
"""Checks the validity of an outcome
Checks whether the id or the name of the outcome is already used by another outcome within the state.
:param rafcon.core.logical_port.Outcome check_outcome: The outcome to be checked
:return bool val... | [
"def",
"_check_outcome_validity",
"(",
"self",
",",
"check_outcome",
")",
":",
"for",
"outcome_id",
",",
"outcome",
"in",
"self",
".",
"outcomes",
".",
"items",
"(",
")",
":",
"# Do not compare outcome with itself when checking for existing name/id",
"if",
"check_outcom... | Checks the validity of an outcome
Checks whether the id or the name of the outcome is already used by another outcome within the state.
:param rafcon.core.logical_port.Outcome check_outcome: The outcome to be checked
:return bool validity, str message: validity is True, when the outcome is val... | [
"Checks",
"the",
"validity",
"of",
"an",
"outcome"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L751-L767 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State._check_data_port_validity | def _check_data_port_validity(self, check_data_port):
"""Checks the validity of a data port
Checks whether the data flows connected to the port do not conflict with the data types.
:param rafcon.core.data_port.DataPort check_data_port: The data port to be checked
:return bool validity,... | python | def _check_data_port_validity(self, check_data_port):
"""Checks the validity of a data port
Checks whether the data flows connected to the port do not conflict with the data types.
:param rafcon.core.data_port.DataPort check_data_port: The data port to be checked
:return bool validity,... | [
"def",
"_check_data_port_validity",
"(",
"self",
",",
"check_data_port",
")",
":",
"valid",
",",
"message",
"=",
"self",
".",
"_check_data_port_id",
"(",
"check_data_port",
")",
"if",
"not",
"valid",
":",
"return",
"False",
",",
"message",
"valid",
",",
"messa... | Checks the validity of a data port
Checks whether the data flows connected to the port do not conflict with the data types.
:param rafcon.core.data_port.DataPort check_data_port: The data port to be checked
:return bool validity, str message: validity is True, when the data port is valid, Fals... | [
"Checks",
"the",
"validity",
"of",
"a",
"data",
"port"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L769-L797 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State._check_data_port_id | 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) within the
state.
:param rafcon.core.data_port.DataPort data_port: The data port to be checked
:re... | python | 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) within the
state.
:param rafcon.core.data_port.DataPort data_port: The data port to be checked
:re... | [
"def",
"_check_data_port_id",
"(",
"self",
",",
"data_port",
")",
":",
"for",
"input_data_port_id",
",",
"input_data_port",
"in",
"self",
".",
"input_data_ports",
".",
"items",
"(",
")",
":",
"if",
"data_port",
".",
"data_port_id",
"==",
"input_data_port_id",
"a... | 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) within the
state.
:param rafcon.core.data_port.DataPort data_port: The data port to be checked
:return bool validity, str message: validity is True, wh... | [
"Checks",
"the",
"validity",
"of",
"a",
"data",
"port",
"id"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L799-L815 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State._check_data_port_name | 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 and output data ports.
:param rafcon.core.data_port.Dat... | python | 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 and output data ports.
:param rafcon.core.data_port.Dat... | [
"def",
"_check_data_port_name",
"(",
"self",
",",
"data_port",
")",
":",
"if",
"data_port",
".",
"data_port_id",
"in",
"self",
".",
"input_data_ports",
":",
"for",
"input_data_port",
"in",
"self",
".",
"input_data_ports",
".",
"values",
"(",
")",
":",
"if",
... | 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 and output data ports.
:param rafcon.core.data_port.DataPort data_port: The data port to be checked
:r... | [
"Checks",
"the",
"validity",
"of",
"a",
"data",
"port",
"name"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L817-L837 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.check_input_data_type | def check_input_data_type(self):
"""Check the input data types of the state
Checks all input data ports if the handed data is not of the specified type and generate an error logger message
with details of the found type conflict.
"""
for data_port in self.input_data_ports.values... | python | def check_input_data_type(self):
"""Check the input data types of the state
Checks all input data ports if the handed data is not of the specified type and generate an error logger message
with details of the found type conflict.
"""
for data_port in self.input_data_ports.values... | [
"def",
"check_input_data_type",
"(",
"self",
")",
":",
"for",
"data_port",
"in",
"self",
".",
"input_data_ports",
".",
"values",
"(",
")",
":",
"if",
"data_port",
".",
"name",
"in",
"self",
".",
"input_data",
"and",
"self",
".",
"input_data",
"[",
"data_po... | Check the input data types of the state
Checks all input data ports if the handed data is not of the specified type and generate an error logger message
with details of the found type conflict. | [
"Check",
"the",
"input",
"data",
"types",
"of",
"the",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L839-L852 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.check_output_data_type | def check_output_data_type(self):
"""Check the output data types of the state
Checks all output data ports if the handed data is not of the specified type and generate an error logger
message with details of the found type conflict.
"""
for data_port in self.output_data_ports.va... | python | def check_output_data_type(self):
"""Check the output data types of the state
Checks all output data ports if the handed data is not of the specified type and generate an error logger
message with details of the found type conflict.
"""
for data_port in self.output_data_ports.va... | [
"def",
"check_output_data_type",
"(",
"self",
")",
":",
"for",
"data_port",
"in",
"self",
".",
"output_data_ports",
".",
"values",
"(",
")",
":",
"if",
"data_port",
".",
"name",
"in",
"self",
".",
"output_data",
"and",
"self",
".",
"output_data",
"[",
"dat... | Check the output data types of the state
Checks all output data ports if the handed data is not of the specified type and generate an error logger
message with details of the found type conflict. | [
"Check",
"the",
"output",
"data",
"types",
"of",
"the",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L854-L867 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.change_state_id | def change_state_id(self, state_id=None):
"""Changes the id of the state to a new id
If no state_id is passed as parameter, a new state id is generated.
:param str state_id: The new state id of the state
:return:
"""
if state_id is None:
state_id = state_id_... | python | def change_state_id(self, state_id=None):
"""Changes the id of the state to a new id
If no state_id is passed as parameter, a new state id is generated.
:param str state_id: The new state id of the state
:return:
"""
if state_id is None:
state_id = state_id_... | [
"def",
"change_state_id",
"(",
"self",
",",
"state_id",
"=",
"None",
")",
":",
"if",
"state_id",
"is",
"None",
":",
"state_id",
"=",
"state_id_generator",
"(",
"used_state_ids",
"=",
"[",
"self",
".",
"state_id",
"]",
")",
"if",
"not",
"self",
".",
"is_r... | Changes the id of the state to a new id
If no state_id is passed as parameter, a new state id is generated.
:param str state_id: The new state id of the state
:return: | [
"Changes",
"the",
"id",
"of",
"the",
"state",
"to",
"a",
"new",
"id"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L877-L892 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.get_semantic_data | def get_semantic_data(self, path_as_list):
""" Retrieves an entry of the semantic data.
:param list path_as_list: The path in the vividict to retrieve the value from
:return:
"""
target_dict = self.semantic_data
for path_element in path_as_list:
if path_eleme... | python | def get_semantic_data(self, path_as_list):
""" Retrieves an entry of the semantic data.
:param list path_as_list: The path in the vividict to retrieve the value from
:return:
"""
target_dict = self.semantic_data
for path_element in path_as_list:
if path_eleme... | [
"def",
"get_semantic_data",
"(",
"self",
",",
"path_as_list",
")",
":",
"target_dict",
"=",
"self",
".",
"semantic_data",
"for",
"path_element",
"in",
"path_as_list",
":",
"if",
"path_element",
"in",
"target_dict",
":",
"target_dict",
"=",
"target_dict",
"[",
"p... | Retrieves an entry of the semantic data.
:param list path_as_list: The path in the vividict to retrieve the value from
:return: | [
"Retrieves",
"an",
"entry",
"of",
"the",
"semantic",
"data",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L910-L924 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.add_semantic_data | def add_semantic_data(self, path_as_list, value, key):
""" Adds a semantic data entry.
:param list path_as_list: The path in the vividict to enter the value
:param value: The value of the new entry.
:param key: The key of the new entry.
:return:
"""
assert isinst... | python | def add_semantic_data(self, path_as_list, value, key):
""" Adds a semantic data entry.
:param list path_as_list: The path in the vividict to enter the value
:param value: The value of the new entry.
:param key: The key of the new entry.
:return:
"""
assert isinst... | [
"def",
"add_semantic_data",
"(",
"self",
",",
"path_as_list",
",",
"value",
",",
"key",
")",
":",
"assert",
"isinstance",
"(",
"key",
",",
"string_types",
")",
"target_dict",
"=",
"self",
".",
"get_semantic_data",
"(",
"path_as_list",
")",
"target_dict",
"[",
... | Adds a semantic data entry.
:param list path_as_list: The path in the vividict to enter the value
:param value: The value of the new entry.
:param key: The key of the new entry.
:return: | [
"Adds",
"a",
"semantic",
"data",
"entry",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L927-L938 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.remove_semantic_data | def remove_semantic_data(self, path_as_list):
""" Removes a entry from the semantic data vividict.
:param list path_as_list: The path of the vividict to delete.
:return: removed value or dict
"""
if len(path_as_list) == 0:
raise AttributeError("The argument path_as_l... | python | def remove_semantic_data(self, path_as_list):
""" Removes a entry from the semantic data vividict.
:param list path_as_list: The path of the vividict to delete.
:return: removed value or dict
"""
if len(path_as_list) == 0:
raise AttributeError("The argument path_as_l... | [
"def",
"remove_semantic_data",
"(",
"self",
",",
"path_as_list",
")",
":",
"if",
"len",
"(",
"path_as_list",
")",
"==",
"0",
":",
"raise",
"AttributeError",
"(",
"\"The argument path_as_list is empty but but the method remove_semantic_data needs a \"",
"\"valid path to remove... | Removes a entry from the semantic data vividict.
:param list path_as_list: The path of the vividict to delete.
:return: removed value or dict | [
"Removes",
"a",
"entry",
"from",
"the",
"semantic",
"data",
"vividict",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L941-L953 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.destroy | def destroy(self, recursive):
""" Removes all the state elements.
:param recursive: Flag wether to destroy all state elements which are removed
"""
for in_key in list(self.input_data_ports.keys()):
self.remove_input_data_port(in_key, force=True, destroy=recursive)
f... | python | def destroy(self, recursive):
""" Removes all the state elements.
:param recursive: Flag wether to destroy all state elements which are removed
"""
for in_key in list(self.input_data_ports.keys()):
self.remove_input_data_port(in_key, force=True, destroy=recursive)
f... | [
"def",
"destroy",
"(",
"self",
",",
"recursive",
")",
":",
"for",
"in_key",
"in",
"list",
"(",
"self",
".",
"input_data_ports",
".",
"keys",
"(",
")",
")",
":",
"self",
".",
"remove_input_data_port",
"(",
"in_key",
",",
"force",
"=",
"True",
",",
"dest... | Removes all the state elements.
:param recursive: Flag wether to destroy all state elements which are removed | [
"Removes",
"all",
"the",
"state",
"elements",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L956-L971 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.input_data_ports | def input_data_ports(self, input_data_ports):
"""Property for the _input_data_ports field
See Property.
:param dict input_data_ports: Dictionary that maps :class:`int` data_port_ids onto values of type
:class:`rafcon.core.state_elements.data_port.InputData... | python | def input_data_ports(self, input_data_ports):
"""Property for the _input_data_ports field
See Property.
:param dict input_data_ports: Dictionary that maps :class:`int` data_port_ids onto values of type
:class:`rafcon.core.state_elements.data_port.InputData... | [
"def",
"input_data_ports",
"(",
"self",
",",
"input_data_ports",
")",
":",
"if",
"not",
"isinstance",
"(",
"input_data_ports",
",",
"dict",
")",
":",
"raise",
"TypeError",
"(",
"\"input_data_ports must be of type dict\"",
")",
"if",
"[",
"port_id",
"for",
"port_id... | Property for the _input_data_ports field
See Property.
:param dict input_data_ports: Dictionary that maps :class:`int` data_port_ids onto values of type
:class:`rafcon.core.state_elements.data_port.InputDataPort`
:raises exceptions.TypeError: if the input_... | [
"Property",
"for",
"the",
"_input_data_ports",
"field"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1052-L1089 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.output_data_ports | def output_data_ports(self, output_data_ports):
""" Setter for _output_data_ports field
See property
:param dict output_data_ports: Dictionary that maps :class:`int` data_port_ids onto values of type
:class:`rafcon.core.state_elements.data_port.OutputDataP... | python | def output_data_ports(self, output_data_ports):
""" Setter for _output_data_ports field
See property
:param dict output_data_ports: Dictionary that maps :class:`int` data_port_ids onto values of type
:class:`rafcon.core.state_elements.data_port.OutputDataP... | [
"def",
"output_data_ports",
"(",
"self",
",",
"output_data_ports",
")",
":",
"if",
"not",
"isinstance",
"(",
"output_data_ports",
",",
"dict",
")",
":",
"raise",
"TypeError",
"(",
"\"output_data_ports must be of type dict\"",
")",
"if",
"[",
"port_id",
"for",
"por... | Setter for _output_data_ports field
See property
:param dict output_data_ports: Dictionary that maps :class:`int` data_port_ids onto values of type
:class:`rafcon.core.state_elements.data_port.OutputDataPort`
:raises exceptions.TypeError: if the output_dat... | [
"Setter",
"for",
"_output_data_ports",
"field"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1110-L1147 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.income | def income(self, income):
"""Setter for the state's income"""
if not isinstance(income, Income):
raise ValueError("income must be of type Income")
old_income = self.income
self._income = income
try:
income.parent = self
except ValueError:
... | python | def income(self, income):
"""Setter for the state's income"""
if not isinstance(income, Income):
raise ValueError("income must be of type Income")
old_income = self.income
self._income = income
try:
income.parent = self
except ValueError:
... | [
"def",
"income",
"(",
"self",
",",
"income",
")",
":",
"if",
"not",
"isinstance",
"(",
"income",
",",
"Income",
")",
":",
"raise",
"ValueError",
"(",
"\"income must be of type Income\"",
")",
"old_income",
"=",
"self",
".",
"income",
"self",
".",
"_income",
... | Setter for the state's income | [
"Setter",
"for",
"the",
"state",
"s",
"income"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1161-L1172 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.outcomes | def outcomes(self, outcomes):
""" Setter for _outcomes field
See property.
:param dict outcomes: Dictionary outcomes[outcome_id] that maps :class:`int` outcome_ids onto values of type
:class:`rafcon.core.state_elements.logical_port.Outcome`
:raises excepti... | python | def outcomes(self, outcomes):
""" Setter for _outcomes field
See property.
:param dict outcomes: Dictionary outcomes[outcome_id] that maps :class:`int` outcome_ids onto values of type
:class:`rafcon.core.state_elements.logical_port.Outcome`
:raises excepti... | [
"def",
"outcomes",
"(",
"self",
",",
"outcomes",
")",
":",
"if",
"not",
"isinstance",
"(",
"outcomes",
",",
"dict",
")",
":",
"raise",
"TypeError",
"(",
"\"outcomes must be of type dict\"",
")",
"if",
"[",
"outcome_id",
"for",
"outcome_id",
",",
"outcome",
"... | Setter for _outcomes field
See property.
:param dict outcomes: Dictionary outcomes[outcome_id] that maps :class:`int` outcome_ids onto values of type
:class:`rafcon.core.state_elements.logical_port.Outcome`
:raises exceptions.TypeError: if outcomes parameter has t... | [
"Setter",
"for",
"_outcomes",
"field"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1192-L1227 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.is_root_state_of_library | def is_root_state_of_library(self):
""" If self is the attribute LibraryState.state_copy of a LibraryState its the library root state and its parent
is a LibraryState
:return True or False
:rtype bool
"""
from rafcon.core.states.library_state import LibraryState
r... | python | def is_root_state_of_library(self):
""" If self is the attribute LibraryState.state_copy of a LibraryState its the library root state and its parent
is a LibraryState
:return True or False
:rtype bool
"""
from rafcon.core.states.library_state import LibraryState
r... | [
"def",
"is_root_state_of_library",
"(",
"self",
")",
":",
"from",
"rafcon",
".",
"core",
".",
"states",
".",
"library_state",
"import",
"LibraryState",
"return",
"isinstance",
"(",
"self",
".",
"parent",
",",
"LibraryState",
")"
] | If self is the attribute LibraryState.state_copy of a LibraryState its the library root state and its parent
is a LibraryState
:return True or False
:rtype bool | [
"If",
"self",
"is",
"the",
"attribute",
"LibraryState",
".",
"state_copy",
"of",
"a",
"LibraryState",
"its",
"the",
"library",
"root",
"state",
"and",
"its",
"parent",
"is",
"a",
"LibraryState",
":",
"return",
"True",
"or",
"False",
":",
"rtype",
"bool"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1410-L1417 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.get_next_upper_library_root_state | def get_next_upper_library_root_state(self):
""" Get next upper library root state
The method recursively checks state parent states till finding a StateMachine as parent or a library root state.
If self is a LibraryState the next upper library root state is searched and it is not handed self.s... | python | def get_next_upper_library_root_state(self):
""" Get next upper library root state
The method recursively checks state parent states till finding a StateMachine as parent or a library root state.
If self is a LibraryState the next upper library root state is searched and it is not handed self.s... | [
"def",
"get_next_upper_library_root_state",
"(",
"self",
")",
":",
"from",
"rafcon",
".",
"core",
".",
"state_machine",
"import",
"StateMachine",
"if",
"self",
".",
"is_root_state_of_library",
":",
"return",
"self",
"state",
"=",
"self",
"while",
"state",
".",
"... | Get next upper library root state
The method recursively checks state parent states till finding a StateMachine as parent or a library root state.
If self is a LibraryState the next upper library root state is searched and it is not handed self.state_copy.
:return library root state (Execution... | [
"Get",
"next",
"upper",
"library",
"root",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1419-L1439 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.get_uppermost_library_root_state | def get_uppermost_library_root_state(self):
"""Find state_copy of uppermost LibraryState
Method checks if there is a parent library root state and assigns it to be the current library root state till
there is no further parent library root state.
"""
library_root_state = self.g... | python | def get_uppermost_library_root_state(self):
"""Find state_copy of uppermost LibraryState
Method checks if there is a parent library root state and assigns it to be the current library root state till
there is no further parent library root state.
"""
library_root_state = self.g... | [
"def",
"get_uppermost_library_root_state",
"(",
"self",
")",
":",
"library_root_state",
"=",
"self",
".",
"get_next_upper_library_root_state",
"(",
")",
"parent_library_root_state",
"=",
"library_root_state",
"# initial a library root state has to be found and if there is no further ... | Find state_copy of uppermost LibraryState
Method checks if there is a parent library root state and assigns it to be the current library root state till
there is no further parent library root state. | [
"Find",
"state_copy",
"of",
"uppermost",
"LibraryState"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1441-L1459 |
DLR-RM/RAFCON | source/rafcon/core/states/state.py | State.finalize | def finalize(self, outcome=None):
"""Finalize state
This method is called when the run method finishes
:param rafcon.core.logical_port.Outcome outcome: final outcome of the state
:return: Nothing for the moment
"""
# Set the final outcome of the state
if outcom... | python | def finalize(self, outcome=None):
"""Finalize state
This method is called when the run method finishes
:param rafcon.core.logical_port.Outcome outcome: final outcome of the state
:return: Nothing for the moment
"""
# Set the final outcome of the state
if outcom... | [
"def",
"finalize",
"(",
"self",
",",
"outcome",
"=",
"None",
")",
":",
"# Set the final outcome of the state",
"if",
"outcome",
"is",
"not",
"None",
":",
"self",
".",
"final_outcome",
"=",
"outcome",
"# If we are within a concurrency state, we have to notify it about our ... | Finalize state
This method is called when the run method finishes
:param rafcon.core.logical_port.Outcome outcome: final outcome of the state
:return: Nothing for the moment | [
"Finalize",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1461-L1480 |
openego/eTraGo | etrago/cluster/networkclustering.py | cluster_on_extra_high_voltage | def cluster_on_extra_high_voltage(network, busmap, with_time=True):
""" Main function of the EHV-Clustering approach. Creates a new clustered
pypsa.Network given a busmap mapping all bus_ids to other bus_ids of the
same network.
Parameters
----------
network : pypsa.Network
Container fo... | python | def cluster_on_extra_high_voltage(network, busmap, with_time=True):
""" Main function of the EHV-Clustering approach. Creates a new clustered
pypsa.Network given a busmap mapping all bus_ids to other bus_ids of the
same network.
Parameters
----------
network : pypsa.Network
Container fo... | [
"def",
"cluster_on_extra_high_voltage",
"(",
"network",
",",
"busmap",
",",
"with_time",
"=",
"True",
")",
":",
"network_c",
"=",
"Network",
"(",
")",
"buses",
"=",
"aggregatebuses",
"(",
"network",
",",
"busmap",
",",
"{",
"'x'",
":",
"_leading",
"(",
"bu... | Main function of the EHV-Clustering approach. Creates a new clustered
pypsa.Network given a busmap mapping all bus_ids to other bus_ids of the
same network.
Parameters
----------
network : pypsa.Network
Container for all network components.
busmap : dict
Maps old bus_ids to new... | [
"Main",
"function",
"of",
"the",
"EHV",
"-",
"Clustering",
"approach",
".",
"Creates",
"a",
"new",
"clustered",
"pypsa",
".",
"Network",
"given",
"a",
"busmap",
"mapping",
"all",
"bus_ids",
"to",
"other",
"bus_ids",
"of",
"the",
"same",
"network",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/cluster/networkclustering.py#L65-L141 |
openego/eTraGo | etrago/cluster/networkclustering.py | graph_from_edges | def graph_from_edges(edges):
""" Constructs an undirected multigraph from a list containing data on
weighted edges.
Parameters
----------
edges : list
List of tuples each containing first node, second node, weight, key.
Returns
-------
M : :class:`networkx.classes.multigraph.Mu... | python | def graph_from_edges(edges):
""" Constructs an undirected multigraph from a list containing data on
weighted edges.
Parameters
----------
edges : list
List of tuples each containing first node, second node, weight, key.
Returns
-------
M : :class:`networkx.classes.multigraph.Mu... | [
"def",
"graph_from_edges",
"(",
"edges",
")",
":",
"M",
"=",
"nx",
".",
"MultiGraph",
"(",
")",
"for",
"e",
"in",
"edges",
":",
"n0",
",",
"n1",
",",
"weight",
",",
"key",
"=",
"e",
"M",
".",
"add_edge",
"(",
"n0",
",",
"n1",
",",
"weight",
"="... | Constructs an undirected multigraph from a list containing data on
weighted edges.
Parameters
----------
edges : list
List of tuples each containing first node, second node, weight, key.
Returns
-------
M : :class:`networkx.classes.multigraph.MultiGraph | [
"Constructs",
"an",
"undirected",
"multigraph",
"from",
"a",
"list",
"containing",
"data",
"on",
"weighted",
"edges",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/cluster/networkclustering.py#L144-L166 |
openego/eTraGo | etrago/cluster/networkclustering.py | gen | def gen(nodes, n, graph):
# TODO There could be a more convenient way of doing this. This generators
# single purpose is to prepare data for multiprocessing's starmap function.
""" Generator for applying multiprocessing.
Parameters
----------
nodes : list
List of nodes in the system.
... | python | def gen(nodes, n, graph):
# TODO There could be a more convenient way of doing this. This generators
# single purpose is to prepare data for multiprocessing's starmap function.
""" Generator for applying multiprocessing.
Parameters
----------
nodes : list
List of nodes in the system.
... | [
"def",
"gen",
"(",
"nodes",
",",
"n",
",",
"graph",
")",
":",
"# TODO There could be a more convenient way of doing this. This generators",
"# single purpose is to prepare data for multiprocessing's starmap function.",
"g",
"=",
"graph",
".",
"copy",
"(",
")",
"for",
"i",
"... | Generator for applying multiprocessing.
Parameters
----------
nodes : list
List of nodes in the system.
n : int
Number of desired multiprocessing units.
graph : :class:`networkx.classes.multigraph.MultiGraph
Graph representation of an electrical grid.
Returns
----... | [
"Generator",
"for",
"applying",
"multiprocessing",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/cluster/networkclustering.py#L169-L193 |
openego/eTraGo | etrago/cluster/networkclustering.py | busmap_from_psql | def busmap_from_psql(network, session, scn_name):
""" Retrieves busmap from `model_draft.ego_grid_pf_hv_busmap` on the
<OpenEnergyPlatform>[www.openenergy-platform.org] by a given scenario
name. If this busmap does not exist, it is created with default values.
Parameters
----------
network : py... | python | def busmap_from_psql(network, session, scn_name):
""" Retrieves busmap from `model_draft.ego_grid_pf_hv_busmap` on the
<OpenEnergyPlatform>[www.openenergy-platform.org] by a given scenario
name. If this busmap does not exist, it is created with default values.
Parameters
----------
network : py... | [
"def",
"busmap_from_psql",
"(",
"network",
",",
"session",
",",
"scn_name",
")",
":",
"def",
"fetch",
"(",
")",
":",
"query",
"=",
"session",
".",
"query",
"(",
"EgoGridPfHvBusmap",
".",
"bus0",
",",
"EgoGridPfHvBusmap",
".",
"bus1",
")",
".",
"filter",
... | Retrieves busmap from `model_draft.ego_grid_pf_hv_busmap` on the
<OpenEnergyPlatform>[www.openenergy-platform.org] by a given scenario
name. If this busmap does not exist, it is created with default values.
Parameters
----------
network : pypsa.Network object
Container for all network compo... | [
"Retrieves",
"busmap",
"from",
"model_draft",
".",
"ego_grid_pf_hv_busmap",
"on",
"the",
"<OpenEnergyPlatform",
">",
"[",
"www",
".",
"openenergy",
"-",
"platform",
".",
"org",
"]",
"by",
"a",
"given",
"scenario",
"name",
".",
"If",
"this",
"busmap",
"does",
... | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/cluster/networkclustering.py#L344-L386 |
openego/eTraGo | etrago/cluster/networkclustering.py | kmean_clustering | def kmean_clustering(network, n_clusters=10, load_cluster=False,
line_length_factor=1.25,
remove_stubs=False, use_reduced_coordinates=False,
bus_weight_tocsv=None, bus_weight_fromcsv=None,
n_init=10, max_iter=300, tol=1e-4,
... | python | def kmean_clustering(network, n_clusters=10, load_cluster=False,
line_length_factor=1.25,
remove_stubs=False, use_reduced_coordinates=False,
bus_weight_tocsv=None, bus_weight_fromcsv=None,
n_init=10, max_iter=300, tol=1e-4,
... | [
"def",
"kmean_clustering",
"(",
"network",
",",
"n_clusters",
"=",
"10",
",",
"load_cluster",
"=",
"False",
",",
"line_length_factor",
"=",
"1.25",
",",
"remove_stubs",
"=",
"False",
",",
"use_reduced_coordinates",
"=",
"False",
",",
"bus_weight_tocsv",
"=",
"No... | Main function of the k-mean clustering approach. Maps an original
network to a new one with adjustable number of nodes and new coordinates.
Parameters
----------
network : :class:`pypsa.Network
Container for all network components.
n_clusters : int
Desired number of clusters.
... | [
"Main",
"function",
"of",
"the",
"k",
"-",
"mean",
"clustering",
"approach",
".",
"Maps",
"an",
"original",
"network",
"to",
"a",
"new",
"one",
"with",
"adjustable",
"number",
"of",
"nodes",
"and",
"new",
"coordinates",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/cluster/networkclustering.py#L389-L566 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/description_editor.py | DescriptionEditorController.register_actions | 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.
"""
super(DescriptionEditorController... | python | 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.
"""
super(DescriptionEditorController... | [
"def",
"register_actions",
"(",
"self",
",",
"shortcut_manager",
")",
":",
"super",
"(",
"DescriptionEditorController",
",",
"self",
")",
".",
"register_actions",
"(",
"shortcut_manager",
")",
"shortcut_manager",
".",
"add_callback_for_action",
"(",
"\"abort\"",
",",
... | Register callback methods for triggered actions
:param rafcon.gui.shortcut_manager.ShortcutManager shortcut_manager: Shortcut Manager Object holding mappings
between shortcuts and actions. | [
"Register",
"callback",
"methods",
"for",
"triggered",
"actions"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/description_editor.py#L55-L62 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.register_view | def register_view(self, view):
"""Called when the View was registered"""
super(GraphicalEditorController, self).register_view(view)
self.view.connect('meta_data_changed', self._meta_data_changed)
self.focus_changed_handler_id = self.view.editor.connect('focus-changed', self._move_focuse... | python | def register_view(self, view):
"""Called when the View was registered"""
super(GraphicalEditorController, self).register_view(view)
self.view.connect('meta_data_changed', self._meta_data_changed)
self.focus_changed_handler_id = self.view.editor.connect('focus-changed', self._move_focuse... | [
"def",
"register_view",
"(",
"self",
",",
"view",
")",
":",
"super",
"(",
"GraphicalEditorController",
",",
"self",
")",
".",
"register_view",
"(",
"view",
")",
"self",
".",
"view",
".",
"connect",
"(",
"'meta_data_changed'",
",",
"self",
".",
"_meta_data_ch... | Called when the View was registered | [
"Called",
"when",
"the",
"View",
"was",
"registered"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L100-L109 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.register_actions | 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... | python | 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... | [
"def",
"register_actions",
"(",
"self",
",",
"shortcut_manager",
")",
":",
"shortcut_manager",
".",
"add_callback_for_action",
"(",
"\"add\"",
",",
"partial",
"(",
"self",
".",
"_add_new_state",
",",
"state_type",
"=",
"StateType",
".",
"EXECUTION",
")",
")",
"s... | Register callback methods for triggered actions
:param rafcon.gui.shortcut_manager.ShortcutManager shortcut_manager: Shortcut Manager Object holding mappings
between shortcuts and actions. | [
"Register",
"callback",
"methods",
"for",
"triggered",
"actions"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L111-L143 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.on_config_value_changed | 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 ... | python | 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 ... | [
"def",
"on_config_value_changed",
"(",
"self",
",",
"config_m",
",",
"prop_name",
",",
"info",
")",
":",
"config_key",
"=",
"info",
"[",
"'args'",
"]",
"[",
"1",
"]",
"# config_value = info['args'][2]",
"if",
"config_key",
"in",
"[",
"\"ENABLE_CACHING\"",
",",
... | 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 | [
"Callback",
"when",
"a",
"config",
"value",
"has",
"been",
"changed"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L146-L158 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.on_drag_data_received | def on_drag_data_received(self, widget, context, x, y, data, info, time):
"""Receives state_id from LibraryTree and moves the state to the position of the mouse
:param widget:
:param context:
:param x: Integer: x-position of mouse
:param y: Integer: y-position of mouse
:... | python | def on_drag_data_received(self, widget, context, x, y, data, info, time):
"""Receives state_id from LibraryTree and moves the state to the position of the mouse
:param widget:
:param context:
:param x: Integer: x-position of mouse
:param y: Integer: y-position of mouse
:... | [
"def",
"on_drag_data_received",
"(",
"self",
",",
"widget",
",",
"context",
",",
"x",
",",
"y",
",",
"data",
",",
"info",
",",
"time",
")",
":",
"state_id_insert",
"=",
"data",
".",
"get_text",
"(",
")",
"parent_m",
"=",
"self",
".",
"model",
".",
"s... | Receives state_id from LibraryTree and moves the state to the position of the mouse
:param widget:
:param context:
:param x: Integer: x-position of mouse
:param y: Integer: y-position of mouse
:param data: SelectionData: contains state_id
:param info:
:param time... | [
"Receives",
"state_id",
"from",
"LibraryTree",
"and",
"moves",
"the",
"state",
"to",
"the",
"position",
"of",
"the",
"mouse"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L161-L184 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.on_drag_motion | def on_drag_motion(self, widget, context, x, y, time):
"""Changes the selection on mouse over during drag motion
:param widget:
:param context:
:param x: Integer: x-position of mouse
:param y: Integer: y-position of mouse
:param time:
"""
hovered_item = I... | python | def on_drag_motion(self, widget, context, x, y, time):
"""Changes the selection on mouse over during drag motion
:param widget:
:param context:
:param x: Integer: x-position of mouse
:param y: Integer: y-position of mouse
:param time:
"""
hovered_item = I... | [
"def",
"on_drag_motion",
"(",
"self",
",",
"widget",
",",
"context",
",",
"x",
",",
"y",
",",
"time",
")",
":",
"hovered_item",
"=",
"ItemFinder",
"(",
"self",
".",
"view",
".",
"editor",
")",
".",
"get_item_at_point",
"(",
"(",
"x",
",",
"y",
")",
... | Changes the selection on mouse over during drag motion
:param widget:
:param context:
:param x: Integer: x-position of mouse
:param y: Integer: y-position of mouse
:param time: | [
"Changes",
"the",
"selection",
"on",
"mouse",
"over",
"during",
"drag",
"motion"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L187-L211 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController._add_new_state | 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 graphical editor is in focus.
"""
if react_to_event(self.view, self.view.editor, event):
sta... | python | 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 graphical editor is in focus.
"""
if react_to_event(self.view, self.view.editor, event):
sta... | [
"def",
"_add_new_state",
"(",
"self",
",",
"*",
"event",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"react_to_event",
"(",
"self",
".",
"view",
",",
"self",
".",
"view",
".",
"editor",
",",
"event",
")",
":",
"state_type",
"=",
"StateType",
".",
"EXECU... | 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 graphical editor is in focus. | [
"Triggered",
"when",
"shortcut",
"keys",
"for",
"adding",
"a",
"new",
"state",
"are",
"pressed",
"or",
"Menu",
"Bar",
"Edit",
"Add",
"State",
"is",
"clicked",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L221-L228 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController._copy_selection | def _copy_selection(self, *event):
"""Copies the current selection to the clipboard.
"""
if react_to_event(self.view, self.view.editor, event):
logger.debug("copy selection")
global_clipboard.copy(self.model.selection)
return True | python | def _copy_selection(self, *event):
"""Copies the current selection to the clipboard.
"""
if react_to_event(self.view, self.view.editor, event):
logger.debug("copy selection")
global_clipboard.copy(self.model.selection)
return True | [
"def",
"_copy_selection",
"(",
"self",
",",
"*",
"event",
")",
":",
"if",
"react_to_event",
"(",
"self",
".",
"view",
",",
"self",
".",
"view",
".",
"editor",
",",
"event",
")",
":",
"logger",
".",
"debug",
"(",
"\"copy selection\"",
")",
"global_clipboa... | Copies the current selection to the clipboard. | [
"Copies",
"the",
"current",
"selection",
"to",
"the",
"clipboard",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L231-L237 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController._cut_selection | def _cut_selection(self, *event):
"""Cuts the current selection and copys it to the clipboard.
"""
if react_to_event(self.view, self.view.editor, event):
logger.debug("cut selection")
global_clipboard.cut(self.model.selection)
return True | python | def _cut_selection(self, *event):
"""Cuts the current selection and copys it to the clipboard.
"""
if react_to_event(self.view, self.view.editor, event):
logger.debug("cut selection")
global_clipboard.cut(self.model.selection)
return True | [
"def",
"_cut_selection",
"(",
"self",
",",
"*",
"event",
")",
":",
"if",
"react_to_event",
"(",
"self",
".",
"view",
",",
"self",
".",
"view",
".",
"editor",
",",
"event",
")",
":",
"logger",
".",
"debug",
"(",
"\"cut selection\"",
")",
"global_clipboard... | Cuts the current selection and copys it to the clipboard. | [
"Cuts",
"the",
"current",
"selection",
"and",
"copys",
"it",
"to",
"the",
"clipboard",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L240-L246 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController._paste_clipboard | def _paste_clipboard(self, *event):
"""Paste the current clipboard into the current selection if the current selection is a container state.
"""
if react_to_event(self.view, self.view.editor, event):
logger.debug("Paste")
gui_helper_state_machine.paste_into_selected_state... | python | def _paste_clipboard(self, *event):
"""Paste the current clipboard into the current selection if the current selection is a container state.
"""
if react_to_event(self.view, self.view.editor, event):
logger.debug("Paste")
gui_helper_state_machine.paste_into_selected_state... | [
"def",
"_paste_clipboard",
"(",
"self",
",",
"*",
"event",
")",
":",
"if",
"react_to_event",
"(",
"self",
".",
"view",
",",
"self",
".",
"view",
".",
"editor",
",",
"event",
")",
":",
"logger",
".",
"debug",
"(",
"\"Paste\"",
")",
"gui_helper_state_machi... | Paste the current clipboard into the current selection if the current selection is a container state. | [
"Paste",
"the",
"current",
"clipboard",
"into",
"the",
"current",
"selection",
"if",
"the",
"current",
"selection",
"is",
"a",
"container",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L249-L255 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController._move_focused_item_into_viewport | def _move_focused_item_into_viewport(self, view, focused_item):
"""Called when an item is focused, moves the item into the viewport
:param view:
:param StateView | ConnectionView | PortView focused_item: The focused item
"""
self.view.editor.handler_block(self.drag_motion_handle... | python | def _move_focused_item_into_viewport(self, view, focused_item):
"""Called when an item is focused, moves the item into the viewport
:param view:
:param StateView | ConnectionView | PortView focused_item: The focused item
"""
self.view.editor.handler_block(self.drag_motion_handle... | [
"def",
"_move_focused_item_into_viewport",
"(",
"self",
",",
"view",
",",
"focused_item",
")",
":",
"self",
".",
"view",
".",
"editor",
".",
"handler_block",
"(",
"self",
".",
"drag_motion_handler_id",
")",
"self",
".",
"move_item_into_viewport",
"(",
"focused_ite... | Called when an item is focused, moves the item into the viewport
:param view:
:param StateView | ConnectionView | PortView focused_item: The focused item | [
"Called",
"when",
"an",
"item",
"is",
"focused",
"moves",
"the",
"item",
"into",
"the",
"viewport"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L257-L265 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.move_item_into_viewport | def move_item_into_viewport(self, item):
"""Causes the `item` to be moved into the viewport
The zoom factor and the position of the viewport are updated to move the `item` into the viewport. If `item`
is not a `StateView`, the parental `StateView` is moved into the viewport.
:param Sta... | python | def move_item_into_viewport(self, item):
"""Causes the `item` to be moved into the viewport
The zoom factor and the position of the viewport are updated to move the `item` into the viewport. If `item`
is not a `StateView`, the parental `StateView` is moved into the viewport.
:param Sta... | [
"def",
"move_item_into_viewport",
"(",
"self",
",",
"item",
")",
":",
"if",
"not",
"item",
":",
"return",
"HORIZONTAL",
"=",
"0",
"VERTICAL",
"=",
"1",
"if",
"not",
"isinstance",
"(",
"item",
",",
"Item",
")",
":",
"state_v",
"=",
"item",
".",
"parent"... | Causes the `item` to be moved into the viewport
The zoom factor and the position of the viewport are updated to move the `item` into the viewport. If `item`
is not a `StateView`, the parental `StateView` is moved into the viewport.
:param StateView | ConnectionView | PortView item: The item to... | [
"Causes",
"the",
"item",
"to",
"be",
"moved",
"into",
"the",
"viewport"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L267-L309 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.state_machine_destruction | def state_machine_destruction(self, model, prop_name, info):
""" Clean up when state machine is being destructed """
if self.model is model: # only used for the state machine destruction case
self.canvas.get_view_for_model(self.root_state_m).remove() | python | def state_machine_destruction(self, model, prop_name, info):
""" Clean up when state machine is being destructed """
if self.model is model: # only used for the state machine destruction case
self.canvas.get_view_for_model(self.root_state_m).remove() | [
"def",
"state_machine_destruction",
"(",
"self",
",",
"model",
",",
"prop_name",
",",
"info",
")",
":",
"if",
"self",
".",
"model",
"is",
"model",
":",
"# only used for the state machine destruction case",
"self",
".",
"canvas",
".",
"get_view_for_model",
"(",
"se... | Clean up when state machine is being destructed | [
"Clean",
"up",
"when",
"state",
"machine",
"is",
"being",
"destructed"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L316-L319 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.meta_changed_notify_after | def meta_changed_notify_after(self, state_machine_m, _, info):
"""Handle notification about the change of a state's meta data
The meta data of the affected state(s) are read and the view updated accordingly.
:param StateMachineModel state_machine_m: Always the state machine model belonging to t... | python | def meta_changed_notify_after(self, state_machine_m, _, info):
"""Handle notification about the change of a state's meta data
The meta data of the affected state(s) are read and the view updated accordingly.
:param StateMachineModel state_machine_m: Always the state machine model belonging to t... | [
"def",
"meta_changed_notify_after",
"(",
"self",
",",
"state_machine_m",
",",
"_",
",",
"info",
")",
":",
"meta_signal_message",
"=",
"info",
"[",
"'arg'",
"]",
"if",
"meta_signal_message",
".",
"origin",
"==",
"\"graphical_editor_gaphas\"",
":",
"# Ignore changes c... | Handle notification about the change of a state's meta data
The meta data of the affected state(s) are read and the view updated accordingly.
:param StateMachineModel state_machine_m: Always the state machine model belonging to this editor
:param str _: Always "state_meta_signal"
:param... | [
"Handle",
"notification",
"about",
"the",
"change",
"of",
"a",
"state",
"s",
"meta",
"data"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L322-L370 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.state_machine_change_after | def state_machine_change_after(self, model, prop_name, info):
"""Called on any change within th state machine
This method is called, when any state, transition, data flow, etc. within the state machine changes. This
then typically requires a redraw of the graphical editor, to display these chan... | python | def state_machine_change_after(self, model, prop_name, info):
"""Called on any change within th state machine
This method is called, when any state, transition, data flow, etc. within the state machine changes. This
then typically requires a redraw of the graphical editor, to display these chan... | [
"def",
"state_machine_change_after",
"(",
"self",
",",
"model",
",",
"prop_name",
",",
"info",
")",
":",
"if",
"'method_name'",
"in",
"info",
"and",
"info",
"[",
"'method_name'",
"]",
"==",
"'root_state_change'",
":",
"method_name",
",",
"model",
",",
"result"... | Called on any change within th state machine
This method is called, when any state, transition, data flow, etc. within the state machine changes. This
then typically requires a redraw of the graphical editor, to display these changes immediately.
:param rafcon.gui.models.state_machine.StateMac... | [
"Called",
"on",
"any",
"change",
"within",
"th",
"state",
"machine"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L380-L627 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.set_focus_to_state_model | def set_focus_to_state_model(self, state_m, ratio_requested=0.8):
""" Focus a state view of respective state model
:param rafcon.gui.model.state state_m: Respective state model of state view to be focused
:param ratio_requested: Minimum ratio of the screen which is requested, so can be more
... | python | def set_focus_to_state_model(self, state_m, ratio_requested=0.8):
""" Focus a state view of respective state model
:param rafcon.gui.model.state state_m: Respective state model of state view to be focused
:param ratio_requested: Minimum ratio of the screen which is requested, so can be more
... | [
"def",
"set_focus_to_state_model",
"(",
"self",
",",
"state_m",
",",
"ratio_requested",
"=",
"0.8",
")",
":",
"state_machine_m",
"=",
"self",
".",
"model",
"state_v",
"=",
"self",
".",
"canvas",
".",
"get_view_for_model",
"(",
"state_m",
")",
"if",
"state_v",
... | Focus a state view of respective state model
:param rafcon.gui.model.state state_m: Respective state model of state view to be focused
:param ratio_requested: Minimum ratio of the screen which is requested, so can be more
:return: | [
"Focus",
"a",
"state",
"view",
"of",
"respective",
"state",
"model",
":",
"param",
"rafcon",
".",
"gui",
".",
"model",
".",
"state",
"state_m",
":",
"Respective",
"state",
"model",
"of",
"state",
"view",
"to",
"be",
"focused",
":",
"param",
"ratio_requeste... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L705-L721 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.add_state_view_for_model | def add_state_view_for_model(self, state_m, parent_v=None, rel_pos=(0, 0), size=(100, 100), hierarchy_level=1):
"""Creates a `StateView` (recursively) and adds it to the canvas
The method uses the `StateModel` `state_m` to create the according `StateView`. For all content within
`state_m`, suc... | python | def add_state_view_for_model(self, state_m, parent_v=None, rel_pos=(0, 0), size=(100, 100), hierarchy_level=1):
"""Creates a `StateView` (recursively) and adds it to the canvas
The method uses the `StateModel` `state_m` to create the according `StateView`. For all content within
`state_m`, suc... | [
"def",
"add_state_view_for_model",
"(",
"self",
",",
"state_m",
",",
"parent_v",
"=",
"None",
",",
"rel_pos",
"=",
"(",
"0",
",",
"0",
")",
",",
"size",
"=",
"(",
"100",
",",
"100",
")",
",",
"hierarchy_level",
"=",
"1",
")",
":",
"assert",
"isinstan... | Creates a `StateView` (recursively) and adds it to the canvas
The method uses the `StateModel` `state_m` to create the according `StateView`. For all content within
`state_m`, such as connections, states and ports, the views are also created. All views are added to the canvas.
:param rafcon.g... | [
"Creates",
"a",
"StateView",
"(",
"recursively",
")",
"and",
"adds",
"it",
"to",
"the",
"canvas"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L746-L831 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.add_transition_view_for_model | def add_transition_view_for_model(self, transition_m, parent_state_m):
"""Creates a `TransitionView` and adds it to the canvas
The method creates a`TransitionView` from the given `TransitionModel `transition_m` and adds it to the canvas.
:param TransitionModel transition_m: The transition for ... | python | def add_transition_view_for_model(self, transition_m, parent_state_m):
"""Creates a `TransitionView` and adds it to the canvas
The method creates a`TransitionView` from the given `TransitionModel `transition_m` and adds it to the canvas.
:param TransitionModel transition_m: The transition for ... | [
"def",
"add_transition_view_for_model",
"(",
"self",
",",
"transition_m",
",",
"parent_state_m",
")",
":",
"parent_state_v",
"=",
"self",
".",
"canvas",
".",
"get_view_for_model",
"(",
"parent_state_m",
")",
"hierarchy_level",
"=",
"parent_state_v",
".",
"hierarchy_le... | Creates a `TransitionView` and adds it to the canvas
The method creates a`TransitionView` from the given `TransitionModel `transition_m` and adds it to the canvas.
:param TransitionModel transition_m: The transition for which a view is to be created
:param ContainerStateModel parent_state_m: ... | [
"Creates",
"a",
"TransitionView",
"and",
"adds",
"it",
"to",
"the",
"canvas"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L834-L852 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.add_data_flow_view_for_model | def add_data_flow_view_for_model(self, data_flow_m, parent_state_m):
"""Creates a `DataFlowView` and adds it to the canvas
The method creates a`DataFlowView` from the given `DataFlowModel `data_flow_m` and adds it to the canvas.
:param DataFlowModel data_flow_m: The data flow for which a view ... | python | def add_data_flow_view_for_model(self, data_flow_m, parent_state_m):
"""Creates a `DataFlowView` and adds it to the canvas
The method creates a`DataFlowView` from the given `DataFlowModel `data_flow_m` and adds it to the canvas.
:param DataFlowModel data_flow_m: The data flow for which a view ... | [
"def",
"add_data_flow_view_for_model",
"(",
"self",
",",
"data_flow_m",
",",
"parent_state_m",
")",
":",
"parent_state_v",
"=",
"self",
".",
"canvas",
".",
"get_view_for_model",
"(",
"parent_state_m",
")",
"hierarchy_level",
"=",
"parent_state_v",
".",
"hierarchy_leve... | Creates a `DataFlowView` and adds it to the canvas
The method creates a`DataFlowView` from the given `DataFlowModel `data_flow_m` and adds it to the canvas.
:param DataFlowModel data_flow_m: The data flow for which a view is to be created
:param ContainerStateModel parent_state_m: The parenta... | [
"Creates",
"a",
"DataFlowView",
"and",
"adds",
"it",
"to",
"the",
"canvas"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L855-L870 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/graphical_editor_gaphas.py | GraphicalEditorController.react_to_event | def react_to_event(self, event):
"""Check whether the given event should be handled
Checks, whether the editor widget has the focus and whether the selected state machine corresponds to the
state machine of this editor.
:param event: GTK event object
:return: True if the event ... | python | def react_to_event(self, event):
"""Check whether the given event should be handled
Checks, whether the editor widget has the focus and whether the selected state machine corresponds to the
state machine of this editor.
:param event: GTK event object
:return: True if the event ... | [
"def",
"react_to_event",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"react_to_event",
"(",
"self",
".",
"view",
",",
"self",
".",
"view",
".",
"editor",
",",
"event",
")",
":",
"return",
"False",
"if",
"not",
"rafcon",
".",
"gui",
".",
"single... | Check whether the given event should be handled
Checks, whether the editor widget has the focus and whether the selected state machine corresponds to the
state machine of this editor.
:param event: GTK event object
:return: True if the event should be handled, else False
:rtype... | [
"Check",
"whether",
"the",
"given",
"event",
"should",
"be",
"handled"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L1008-L1023 |
Cog-Creators/Red-Lavalink | lavalink/lavalink.py | initialize | async def initialize(bot: Bot, host, password, rest_port, ws_port, timeout=30):
"""
Initializes the websocket connection to the lavalink player.
.. important::
This function must only be called AFTER the bot has received its
"on_ready" event!
Parameters
----------
bot : Bot
... | python | async def initialize(bot: Bot, host, password, rest_port, ws_port, timeout=30):
"""
Initializes the websocket connection to the lavalink player.
.. important::
This function must only be called AFTER the bot has received its
"on_ready" event!
Parameters
----------
bot : Bot
... | [
"async",
"def",
"initialize",
"(",
"bot",
":",
"Bot",
",",
"host",
",",
"password",
",",
"rest_port",
",",
"ws_port",
",",
"timeout",
"=",
"30",
")",
":",
"global",
"_loop",
"_loop",
"=",
"bot",
".",
"loop",
"player_manager",
".",
"user_id",
"=",
"bot"... | Initializes the websocket connection to the lavalink player.
.. important::
This function must only be called AFTER the bot has received its
"on_ready" event!
Parameters
----------
bot : Bot
An instance of a discord.py `Bot` object.
host : str
The hostname or IP ad... | [
"Initializes",
"the",
"websocket",
"connection",
"to",
"the",
"lavalink",
"player",
"."
] | train | https://github.com/Cog-Creators/Red-Lavalink/blob/5b3fc6eb31ee5db8bd2b633a523cf69749957111/lavalink/lavalink.py#L34-L83 |
Cog-Creators/Red-Lavalink | lavalink/lavalink.py | connect | async def connect(channel: discord.VoiceChannel):
"""
Connects to a discord voice channel.
This is the publicly exposed way to connect to a discord voice channel.
The :py:func:`initialize` function must be called first!
Parameters
----------
channel
Returns
-------
Player
... | python | async def connect(channel: discord.VoiceChannel):
"""
Connects to a discord voice channel.
This is the publicly exposed way to connect to a discord voice channel.
The :py:func:`initialize` function must be called first!
Parameters
----------
channel
Returns
-------
Player
... | [
"async",
"def",
"connect",
"(",
"channel",
":",
"discord",
".",
"VoiceChannel",
")",
":",
"node_",
"=",
"node",
".",
"get_node",
"(",
"channel",
".",
"guild",
".",
"id",
")",
"p",
"=",
"await",
"node_",
".",
"player_manager",
".",
"create_player",
"(",
... | Connects to a discord voice channel.
This is the publicly exposed way to connect to a discord voice channel.
The :py:func:`initialize` function must be called first!
Parameters
----------
channel
Returns
-------
Player
The created Player object.
Raises
------
Inde... | [
"Connects",
"to",
"a",
"discord",
"voice",
"channel",
"."
] | train | https://github.com/Cog-Creators/Red-Lavalink/blob/5b3fc6eb31ee5db8bd2b633a523cf69749957111/lavalink/lavalink.py#L86-L109 |
Cog-Creators/Red-Lavalink | lavalink/lavalink.py | register_event_listener | def register_event_listener(coro):
"""
Registers a coroutine to receive lavalink event information.
This coroutine will accept three arguments: :py:class:`Player`,
:py:class:`LavalinkEvents`, and possibly an extra. The value of the extra depends
on the value of the second argument.
If the seco... | python | def register_event_listener(coro):
"""
Registers a coroutine to receive lavalink event information.
This coroutine will accept three arguments: :py:class:`Player`,
:py:class:`LavalinkEvents`, and possibly an extra. The value of the extra depends
on the value of the second argument.
If the seco... | [
"def",
"register_event_listener",
"(",
"coro",
")",
":",
"if",
"not",
"asyncio",
".",
"iscoroutinefunction",
"(",
"coro",
")",
":",
"raise",
"TypeError",
"(",
"\"Function is not a coroutine.\"",
")",
"if",
"coro",
"not",
"in",
"_event_listeners",
":",
"_event_list... | Registers a coroutine to receive lavalink event information.
This coroutine will accept three arguments: :py:class:`Player`,
:py:class:`LavalinkEvents`, and possibly an extra. The value of the extra depends
on the value of the second argument.
If the second argument is :py:attr:`LavalinkEvents.TRACK_E... | [
"Registers",
"a",
"coroutine",
"to",
"receive",
"lavalink",
"event",
"information",
"."
] | train | https://github.com/Cog-Creators/Red-Lavalink/blob/5b3fc6eb31ee5db8bd2b633a523cf69749957111/lavalink/lavalink.py#L126-L162 |
Cog-Creators/Red-Lavalink | lavalink/lavalink.py | register_update_listener | def register_update_listener(coro):
"""
Registers a coroutine to receive lavalink player update information.
This coroutine will accept a two arguments: an instance of :py:class:`Player`
and an instance of :py:class:`PlayerState`.
Parameters
----------
coro
Raises
------
TypeE... | python | def register_update_listener(coro):
"""
Registers a coroutine to receive lavalink player update information.
This coroutine will accept a two arguments: an instance of :py:class:`Player`
and an instance of :py:class:`PlayerState`.
Parameters
----------
coro
Raises
------
TypeE... | [
"def",
"register_update_listener",
"(",
"coro",
")",
":",
"if",
"not",
"asyncio",
".",
"iscoroutinefunction",
"(",
"coro",
")",
":",
"raise",
"TypeError",
"(",
"\"Function is not a coroutine.\"",
")",
"if",
"coro",
"not",
"in",
"_update_listeners",
":",
"_update_l... | Registers a coroutine to receive lavalink player update information.
This coroutine will accept a two arguments: an instance of :py:class:`Player`
and an instance of :py:class:`PlayerState`.
Parameters
----------
coro
Raises
------
TypeError
If ``coro`` is not a coroutine. | [
"Registers",
"a",
"coroutine",
"to",
"receive",
"lavalink",
"player",
"update",
"information",
"."
] | train | https://github.com/Cog-Creators/Red-Lavalink/blob/5b3fc6eb31ee5db8bd2b633a523cf69749957111/lavalink/lavalink.py#L211-L231 |
Cog-Creators/Red-Lavalink | lavalink/lavalink.py | register_stats_listener | def register_stats_listener(coro):
"""
Registers a coroutine to receive lavalink server stats information.
This coroutine will accept a single argument which will be an instance
of :py:class:`Stats`.
Parameters
----------
coro
Raises
------
TypeError
If ``coro`` is not... | python | def register_stats_listener(coro):
"""
Registers a coroutine to receive lavalink server stats information.
This coroutine will accept a single argument which will be an instance
of :py:class:`Stats`.
Parameters
----------
coro
Raises
------
TypeError
If ``coro`` is not... | [
"def",
"register_stats_listener",
"(",
"coro",
")",
":",
"if",
"not",
"asyncio",
".",
"iscoroutinefunction",
"(",
"coro",
")",
":",
"raise",
"TypeError",
"(",
"\"Function is not a coroutine.\"",
")",
"if",
"coro",
"not",
"in",
"_stats_listeners",
":",
"_stats_list... | Registers a coroutine to receive lavalink server stats information.
This coroutine will accept a single argument which will be an instance
of :py:class:`Stats`.
Parameters
----------
coro
Raises
------
TypeError
If ``coro`` is not a coroutine. | [
"Registers",
"a",
"coroutine",
"to",
"receive",
"lavalink",
"server",
"stats",
"information",
"."
] | train | https://github.com/Cog-Creators/Red-Lavalink/blob/5b3fc6eb31ee5db8bd2b633a523cf69749957111/lavalink/lavalink.py#L268-L288 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView.prepare_destruction | def prepare_destruction(self):
"""Get rid of circular references"""
self._tool = None
self._painter = None
self.relieve_model(self._selection)
self._selection = None
# clear observer class attributes, also see ExtendenController.destroy()
self._Observer__PROP_TO_M... | python | def prepare_destruction(self):
"""Get rid of circular references"""
self._tool = None
self._painter = None
self.relieve_model(self._selection)
self._selection = None
# clear observer class attributes, also see ExtendenController.destroy()
self._Observer__PROP_TO_M... | [
"def",
"prepare_destruction",
"(",
"self",
")",
":",
"self",
".",
"_tool",
"=",
"None",
"self",
".",
"_painter",
"=",
"None",
"self",
".",
"relieve_model",
"(",
"self",
".",
"_selection",
")",
"self",
".",
"_selection",
"=",
"None",
"# clear observer class a... | Get rid of circular references | [
"Get",
"rid",
"of",
"circular",
"references"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L41-L52 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView.get_port_at_point | def get_port_at_point(self, vpos, distance=10, exclude=None, exclude_port_fun=None):
"""
Find item with port closest to specified position.
List of items to be ignored can be specified with `exclude`
parameter.
Tuple is returned
- found item
- closest, connecta... | python | def get_port_at_point(self, vpos, distance=10, exclude=None, exclude_port_fun=None):
"""
Find item with port closest to specified position.
List of items to be ignored can be specified with `exclude`
parameter.
Tuple is returned
- found item
- closest, connecta... | [
"def",
"get_port_at_point",
"(",
"self",
",",
"vpos",
",",
"distance",
"=",
"10",
",",
"exclude",
"=",
"None",
",",
"exclude_port_fun",
"=",
"None",
")",
":",
"# Method had to be inherited, as the base method has a bug:",
"# It misses the statement max_dist = d",
"v2i",
... | Find item with port closest to specified position.
List of items to be ignored can be specified with `exclude`
parameter.
Tuple is returned
- found item
- closest, connectable port
- closest point on found port (in view coordinates)
:Parameters:
vpos
... | [
"Find",
"item",
"with",
"port",
"closest",
"to",
"specified",
"position",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L59-L115 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView.get_item_at_point_exclude | def get_item_at_point_exclude(self, pos, selected=True, exclude=None):
"""
Return the topmost item located at ``pos`` (x, y).
Parameters:
- selected: if False returns first non-selected item
- exclude: if specified don't check for these items
"""
items = self._... | python | def get_item_at_point_exclude(self, pos, selected=True, exclude=None):
"""
Return the topmost item located at ``pos`` (x, y).
Parameters:
- selected: if False returns first non-selected item
- exclude: if specified don't check for these items
"""
items = self._... | [
"def",
"get_item_at_point_exclude",
"(",
"self",
",",
"pos",
",",
"selected",
"=",
"True",
",",
"exclude",
"=",
"None",
")",
":",
"items",
"=",
"self",
".",
"_qtree",
".",
"find_intersect",
"(",
"(",
"pos",
"[",
"0",
"]",
",",
"pos",
"[",
"1",
"]",
... | Return the topmost item located at ``pos`` (x, y).
Parameters:
- selected: if False returns first non-selected item
- exclude: if specified don't check for these items | [
"Return",
"the",
"topmost",
"item",
"located",
"at",
"pos",
"(",
"x",
"y",
")",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L117-L136 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView.queue_draw_item | def queue_draw_item(self, *items):
"""Extends the base class method to allow Ports to be passed as item
:param items: Items that are to be redrawn
"""
gaphas_items = []
for item in items:
if isinstance(item, Element):
gaphas_items.append(item)
... | python | def queue_draw_item(self, *items):
"""Extends the base class method to allow Ports to be passed as item
:param items: Items that are to be redrawn
"""
gaphas_items = []
for item in items:
if isinstance(item, Element):
gaphas_items.append(item)
... | [
"def",
"queue_draw_item",
"(",
"self",
",",
"*",
"items",
")",
":",
"gaphas_items",
"=",
"[",
"]",
"for",
"item",
"in",
"items",
":",
"if",
"isinstance",
"(",
"item",
",",
"Element",
")",
":",
"gaphas_items",
".",
"append",
"(",
"item",
")",
"else",
... | Extends the base class method to allow Ports to be passed as item
:param items: Items that are to be redrawn | [
"Extends",
"the",
"base",
"class",
"method",
"to",
"allow",
"Ports",
"to",
"be",
"passed",
"as",
"item"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L163-L177 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView.get_items_at_point | def get_items_at_point(self, pos, selected=True, distance=0):
""" Return the items located at ``pos`` (x, y).
:param bool selected: if False returns first non-selected item
:param float distance: Maximum distance to be considered as "at point" (in viewport pixel)
"""
items = s... | python | def get_items_at_point(self, pos, selected=True, distance=0):
""" Return the items located at ``pos`` (x, y).
:param bool selected: if False returns first non-selected item
:param float distance: Maximum distance to be considered as "at point" (in viewport pixel)
"""
items = s... | [
"def",
"get_items_at_point",
"(",
"self",
",",
"pos",
",",
"selected",
"=",
"True",
",",
"distance",
"=",
"0",
")",
":",
"items",
"=",
"self",
".",
"_qtree",
".",
"find_intersect",
"(",
"(",
"pos",
"[",
"0",
"]",
"-",
"distance",
",",
"pos",
"[",
"... | Return the items located at ``pos`` (x, y).
:param bool selected: if False returns first non-selected item
:param float distance: Maximum distance to be considered as "at point" (in viewport pixel) | [
"Return",
"the",
"items",
"located",
"at",
"pos",
"(",
"x",
"y",
")",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L179-L198 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView.select_item | def select_item(self, items):
""" Select an items. This adds `items` to the set of selected items. """
if not items:
return
elif not hasattr(items, "__iter__"):
items = (items,)
selection_changed = False
with self._suppress_selection_events():
... | python | def select_item(self, items):
""" Select an items. This adds `items` to the set of selected items. """
if not items:
return
elif not hasattr(items, "__iter__"):
items = (items,)
selection_changed = False
with self._suppress_selection_events():
... | [
"def",
"select_item",
"(",
"self",
",",
"items",
")",
":",
"if",
"not",
"items",
":",
"return",
"elif",
"not",
"hasattr",
"(",
"items",
",",
"\"__iter__\"",
")",
":",
"items",
"=",
"(",
"items",
",",
")",
"selection_changed",
"=",
"False",
"with",
"sel... | Select an items. This adds `items` to the set of selected items. | [
"Select",
"an",
"items",
".",
"This",
"adds",
"items",
"to",
"the",
"set",
"of",
"selected",
"items",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L221-L235 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView.unselect_item | def unselect_item(self, item):
""" Unselect an item. """
self.queue_draw_item(item)
if item.model in self._selection:
with self._suppress_selection_events():
self._selection.remove(item.model)
self.emit('selection-changed', self._get_selected_items()) | python | def unselect_item(self, item):
""" Unselect an item. """
self.queue_draw_item(item)
if item.model in self._selection:
with self._suppress_selection_events():
self._selection.remove(item.model)
self.emit('selection-changed', self._get_selected_items()) | [
"def",
"unselect_item",
"(",
"self",
",",
"item",
")",
":",
"self",
".",
"queue_draw_item",
"(",
"item",
")",
"if",
"item",
".",
"model",
"in",
"self",
".",
"_selection",
":",
"with",
"self",
".",
"_suppress_selection_events",
"(",
")",
":",
"self",
".",... | Unselect an item. | [
"Unselect",
"an",
"item",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L237-L243 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView.unselect_all | def unselect_all(self):
""" Clearing the selected_item also clears the focused_item. """
items = self._get_selected_items()
with self._suppress_selection_events():
self._selection.clear()
self.queue_draw_item(*items)
self.emit('selection-changed', self._get_selected_i... | python | def unselect_all(self):
""" Clearing the selected_item also clears the focused_item. """
items = self._get_selected_items()
with self._suppress_selection_events():
self._selection.clear()
self.queue_draw_item(*items)
self.emit('selection-changed', self._get_selected_i... | [
"def",
"unselect_all",
"(",
"self",
")",
":",
"items",
"=",
"self",
".",
"_get_selected_items",
"(",
")",
"with",
"self",
".",
"_suppress_selection_events",
"(",
")",
":",
"self",
".",
"_selection",
".",
"clear",
"(",
")",
"self",
".",
"queue_draw_item",
"... | Clearing the selected_item also clears the focused_item. | [
"Clearing",
"the",
"selected_item",
"also",
"clears",
"the",
"focused_item",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L245-L251 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView._get_selected_items | def _get_selected_items(self):
""" Return an Item (e.g. StateView) for each model (e.g. StateModel) in the current selection """
return set(self.canvas.get_view_for_model(model) for model in self._selection) | python | def _get_selected_items(self):
""" Return an Item (e.g. StateView) for each model (e.g. StateModel) in the current selection """
return set(self.canvas.get_view_for_model(model) for model in self._selection) | [
"def",
"_get_selected_items",
"(",
"self",
")",
":",
"return",
"set",
"(",
"self",
".",
"canvas",
".",
"get_view_for_model",
"(",
"model",
")",
"for",
"model",
"in",
"self",
".",
"_selection",
")"
] | Return an Item (e.g. StateView) for each model (e.g. StateModel) in the current selection | [
"Return",
"an",
"Item",
"(",
"e",
".",
"g",
".",
"StateView",
")",
"for",
"each",
"model",
"(",
"e",
".",
"g",
".",
"StateModel",
")",
"in",
"the",
"current",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L253-L255 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView.handle_new_selection | def handle_new_selection(self, items):
""" Determines the selection
The selection is based on the previous selection, the currently pressed keys and the passes newly selected items
:param items: The newly selected item(s)
"""
if items is None:
items = ()
eli... | python | def handle_new_selection(self, items):
""" Determines the selection
The selection is based on the previous selection, the currently pressed keys and the passes newly selected items
:param items: The newly selected item(s)
"""
if items is None:
items = ()
eli... | [
"def",
"handle_new_selection",
"(",
"self",
",",
"items",
")",
":",
"if",
"items",
"is",
"None",
":",
"items",
"=",
"(",
")",
"elif",
"not",
"hasattr",
"(",
"items",
",",
"\"__iter__\"",
")",
":",
"items",
"=",
"(",
"items",
",",
")",
"models",
"=",
... | Determines the selection
The selection is based on the previous selection, the currently pressed keys and the passes newly selected items
:param items: The newly selected item(s) | [
"Determines",
"the",
"selection"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L257-L269 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView._get_focused_item | def _get_focused_item(self):
""" Returns the currently focused item """
focused_model = self._selection.focus
if not focused_model:
return None
return self.canvas.get_view_for_model(focused_model) | python | def _get_focused_item(self):
""" Returns the currently focused item """
focused_model = self._selection.focus
if not focused_model:
return None
return self.canvas.get_view_for_model(focused_model) | [
"def",
"_get_focused_item",
"(",
"self",
")",
":",
"focused_model",
"=",
"self",
".",
"_selection",
".",
"focus",
"if",
"not",
"focused_model",
":",
"return",
"None",
"return",
"self",
".",
"canvas",
".",
"get_view_for_model",
"(",
"focused_model",
")"
] | Returns the currently focused item | [
"Returns",
"the",
"currently",
"focused",
"item"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L280-L285 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/view.py | ExtendedGtkView._set_focused_item | def _set_focused_item(self, item):
""" Sets the focus to the passed item"""
if not item:
return self._del_focused_item()
if item.model is not self._selection.focus:
self.queue_draw_item(self._focused_item, item)
self._selection.focus = item.model
... | python | def _set_focused_item(self, item):
""" Sets the focus to the passed item"""
if not item:
return self._del_focused_item()
if item.model is not self._selection.focus:
self.queue_draw_item(self._focused_item, item)
self._selection.focus = item.model
... | [
"def",
"_set_focused_item",
"(",
"self",
",",
"item",
")",
":",
"if",
"not",
"item",
":",
"return",
"self",
".",
"_del_focused_item",
"(",
")",
"if",
"item",
".",
"model",
"is",
"not",
"self",
".",
"_selection",
".",
"focus",
":",
"self",
".",
"queue_d... | Sets the focus to the passed item | [
"Sets",
"the",
"focus",
"to",
"the",
"passed",
"item"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/view.py#L287-L295 |
DLR-RM/RAFCON | source/rafcon/utils/execution_log.py | log_to_raw_structure | def log_to_raw_structure(execution_history_items):
"""
:param dict execution_history_items: history items, in the simplest case
directly the opened shelve log file
:return: start_item, the StateMachineStartItem of the log file
previous, a dict mapping history_item_id --> history_item... | python | def log_to_raw_structure(execution_history_items):
"""
:param dict execution_history_items: history items, in the simplest case
directly the opened shelve log file
:return: start_item, the StateMachineStartItem of the log file
previous, a dict mapping history_item_id --> history_item... | [
"def",
"log_to_raw_structure",
"(",
"execution_history_items",
")",
":",
"previous",
"=",
"{",
"}",
"next_",
"=",
"{",
"}",
"concurrent",
"=",
"{",
"}",
"grouped_by_run_id",
"=",
"{",
"}",
"start_item",
"=",
"None",
"for",
"k",
",",
"v",
"in",
"execution_h... | :param dict execution_history_items: history items, in the simplest case
directly the opened shelve log file
:return: start_item, the StateMachineStartItem of the log file
previous, a dict mapping history_item_id --> history_item_id of previous history item
next_, a dict mapping... | [
":",
"param",
"dict",
"execution_history_items",
":",
"history",
"items",
"in",
"the",
"simplest",
"case",
"directly",
"the",
"opened",
"shelve",
"log",
"file",
":",
"return",
":",
"start_item",
"the",
"StateMachineStartItem",
"of",
"the",
"log",
"file",
"previo... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/execution_log.py#L24-L75 |
DLR-RM/RAFCON | source/rafcon/utils/execution_log.py | log_to_collapsed_structure | def log_to_collapsed_structure(execution_history_items, throw_on_pickle_error=True,
include_erroneous_data_ports=False, full_next=False):
"""
Collapsed structure means that all history items belonging to the same state execution are
merged together into one object (e.g. CallIt... | python | def log_to_collapsed_structure(execution_history_items, throw_on_pickle_error=True,
include_erroneous_data_ports=False, full_next=False):
"""
Collapsed structure means that all history items belonging to the same state execution are
merged together into one object (e.g. CallIt... | [
"def",
"log_to_collapsed_structure",
"(",
"execution_history_items",
",",
"throw_on_pickle_error",
"=",
"True",
",",
"include_erroneous_data_ports",
"=",
"False",
",",
"full_next",
"=",
"False",
")",
":",
"# for debugging purposes",
"# execution_history_items_dict = dict()",
... | Collapsed structure means that all history items belonging to the same state execution are
merged together into one object (e.g. CallItem and ReturnItem of an ExecutionState). This
is based on the log structure in which all Items which belong together have the same run_id.
The collapsed items hold input as ... | [
"Collapsed",
"structure",
"means",
"that",
"all",
"history",
"items",
"belonging",
"to",
"the",
"same",
"state",
"execution",
"are",
"merged",
"together",
"into",
"one",
"object",
"(",
"e",
".",
"g",
".",
"CallItem",
"and",
"ReturnItem",
"of",
"an",
"Executi... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/execution_log.py#L78-L302 |
DLR-RM/RAFCON | source/rafcon/utils/execution_log.py | log_to_DataFrame | def log_to_DataFrame(execution_history_items, data_in_columns=[], data_out_columns=[], scoped_in_columns=[],
scoped_out_columns=[], semantic_data_columns=[], throw_on_pickle_error=True):
"""
Returns all collapsed items in a table-like structure (pandas.DataFrame) with one row per executed
... | python | def log_to_DataFrame(execution_history_items, data_in_columns=[], data_out_columns=[], scoped_in_columns=[],
scoped_out_columns=[], semantic_data_columns=[], throw_on_pickle_error=True):
"""
Returns all collapsed items in a table-like structure (pandas.DataFrame) with one row per executed
... | [
"def",
"log_to_DataFrame",
"(",
"execution_history_items",
",",
"data_in_columns",
"=",
"[",
"]",
",",
"data_out_columns",
"=",
"[",
"]",
",",
"scoped_in_columns",
"=",
"[",
"]",
",",
"scoped_out_columns",
"=",
"[",
"]",
",",
"semantic_data_columns",
"=",
"[",
... | Returns all collapsed items in a table-like structure (pandas.DataFrame) with one row per executed
state and a set of properties resp. columns (e.g. state_name, outcome, run_id) for this state.
The data flow (data_in/out, scoped_data_in/out, semantic_data) is omitted from this table
representation by defau... | [
"Returns",
"all",
"collapsed",
"items",
"in",
"a",
"table",
"-",
"like",
"structure",
"(",
"pandas",
".",
"DataFrame",
")",
"with",
"one",
"row",
"per",
"executed",
"state",
"and",
"a",
"set",
"of",
"properties",
"resp",
".",
"columns",
"(",
"e",
".",
... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/execution_log.py#L305-L370 |
DLR-RM/RAFCON | source/rafcon/utils/execution_log.py | log_to_ganttplot | def log_to_ganttplot(execution_history_items):
"""
Example how to use the DataFrame representation
"""
import matplotlib.pyplot as plt
import matplotlib.dates as dates
import numpy as np
d = log_to_DataFrame(execution_history_items)
# de-duplicate states and make mapping from state to ... | python | def log_to_ganttplot(execution_history_items):
"""
Example how to use the DataFrame representation
"""
import matplotlib.pyplot as plt
import matplotlib.dates as dates
import numpy as np
d = log_to_DataFrame(execution_history_items)
# de-duplicate states and make mapping from state to ... | [
"def",
"log_to_ganttplot",
"(",
"execution_history_items",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"import",
"matplotlib",
".",
"dates",
"as",
"dates",
"import",
"numpy",
"as",
"np",
"d",
"=",
"log_to_DataFrame",
"(",
"execution_history_items... | Example how to use the DataFrame representation | [
"Example",
"how",
"to",
"use",
"the",
"DataFrame",
"representation"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/execution_log.py#L373-L399 |
DLR-RM/RAFCON | source/rafcon/utils/gui_functions.py | call_gui_callback | def call_gui_callback(callback, *args, **kwargs):
"""Wrapper method for GLib.idle_add
This method is intended as replacement for idle_add. It wraps the method with a callback option. The advantage is
that this way, the call is blocking. The method return, when the callback method has been called and execut... | python | def call_gui_callback(callback, *args, **kwargs):
"""Wrapper method for GLib.idle_add
This method is intended as replacement for idle_add. It wraps the method with a callback option. The advantage is
that this way, the call is blocking. The method return, when the callback method has been called and execut... | [
"def",
"call_gui_callback",
"(",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"future",
".",
"utils",
"import",
"raise_",
"from",
"threading",
"import",
"Condition",
"import",
"sys",
"from",
"rafcon",
".",
"utils",
"import",
"lo... | Wrapper method for GLib.idle_add
This method is intended as replacement for idle_add. It wraps the method with a callback option. The advantage is
that this way, the call is blocking. The method return, when the callback method has been called and executed.
:param callback: The callback method, e.g. on_op... | [
"Wrapper",
"method",
"for",
"GLib",
".",
"idle_add"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/gui_functions.py#L24-L73 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/label.py | create_tab_header_label | def create_tab_header_label(tab_name, icons):
"""Create the tab header labels for notebook tabs. If USE_ICONS_AS_TAB_LABELS is set to True in the gui_config,
icons are used as headers. Otherwise, the titles of the tabs are rotated by 90 degrees.
:param tab_name: The label text of the tab, written in small ... | python | def create_tab_header_label(tab_name, icons):
"""Create the tab header labels for notebook tabs. If USE_ICONS_AS_TAB_LABELS is set to True in the gui_config,
icons are used as headers. Otherwise, the titles of the tabs are rotated by 90 degrees.
:param tab_name: The label text of the tab, written in small ... | [
"def",
"create_tab_header_label",
"(",
"tab_name",
",",
"icons",
")",
":",
"tooltip_event_box",
"=",
"Gtk",
".",
"EventBox",
"(",
")",
"tooltip_event_box",
".",
"set_tooltip_text",
"(",
"tab_name",
")",
"tab_label",
"=",
"Gtk",
".",
"Label",
"(",
")",
"if",
... | Create the tab header labels for notebook tabs. If USE_ICONS_AS_TAB_LABELS is set to True in the gui_config,
icons are used as headers. Otherwise, the titles of the tabs are rotated by 90 degrees.
:param tab_name: The label text of the tab, written in small letters and separated by underscores, e.g. states_tre... | [
"Create",
"the",
"tab",
"header",
"labels",
"for",
"notebook",
"tabs",
".",
"If",
"USE_ICONS_AS_TAB_LABELS",
"is",
"set",
"to",
"True",
"in",
"the",
"gui_config",
"icons",
"are",
"used",
"as",
"headers",
".",
"Otherwise",
"the",
"titles",
"of",
"the",
"tabs"... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/label.py#L26-L49 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/label.py | create_button_label | def create_button_label(icon, font_size=constants.FONT_SIZE_NORMAL):
"""Create a button label with a chosen icon.
:param icon: The icon
:param font_size: The size of the icon
:return: The created label
"""
label = Gtk.Label()
set_label_markup(label, '&#x' + icon + ';', constants.ICON_FONT, ... | python | def create_button_label(icon, font_size=constants.FONT_SIZE_NORMAL):
"""Create a button label with a chosen icon.
:param icon: The icon
:param font_size: The size of the icon
:return: The created label
"""
label = Gtk.Label()
set_label_markup(label, '&#x' + icon + ';', constants.ICON_FONT, ... | [
"def",
"create_button_label",
"(",
"icon",
",",
"font_size",
"=",
"constants",
".",
"FONT_SIZE_NORMAL",
")",
":",
"label",
"=",
"Gtk",
".",
"Label",
"(",
")",
"set_label_markup",
"(",
"label",
",",
"'&#x'",
"+",
"icon",
"+",
"';'",
",",
"constants",
".",
... | Create a button label with a chosen icon.
:param icon: The icon
:param font_size: The size of the icon
:return: The created label | [
"Create",
"a",
"button",
"label",
"with",
"a",
"chosen",
"icon",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/label.py#L157-L167 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/label.py | get_widget_title | def get_widget_title(tab_label_text):
"""Transform Notebook tab label to title by replacing underscores with white spaces and capitalizing the first
letter of each word.
:param tab_label_text: The string of the tab label to be transformed
:return: The transformed title as a string
"""
title = '... | python | def get_widget_title(tab_label_text):
"""Transform Notebook tab label to title by replacing underscores with white spaces and capitalizing the first
letter of each word.
:param tab_label_text: The string of the tab label to be transformed
:return: The transformed title as a string
"""
title = '... | [
"def",
"get_widget_title",
"(",
"tab_label_text",
")",
":",
"title",
"=",
"''",
"title_list",
"=",
"tab_label_text",
".",
"split",
"(",
"'_'",
")",
"for",
"word",
"in",
"title_list",
":",
"title",
"+=",
"word",
".",
"upper",
"(",
")",
"+",
"' '",
"title"... | Transform Notebook tab label to title by replacing underscores with white spaces and capitalizing the first
letter of each word.
:param tab_label_text: The string of the tab label to be transformed
:return: The transformed title as a string | [
"Transform",
"Notebook",
"tab",
"label",
"to",
"title",
"by",
"replacing",
"underscores",
"with",
"white",
"spaces",
"and",
"capitalizing",
"the",
"first",
"letter",
"of",
"each",
"word",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/label.py#L183-L195 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/label.py | get_notebook_tab_title | def get_notebook_tab_title(notebook, page_num):
"""Helper function that gets a notebook's tab title given its page number
:param notebook: The GTK notebook
:param page_num: The page number of the tab, for which the title is required
:return: The title of the tab
"""
child = notebook.get_nth_pag... | python | def get_notebook_tab_title(notebook, page_num):
"""Helper function that gets a notebook's tab title given its page number
:param notebook: The GTK notebook
:param page_num: The page number of the tab, for which the title is required
:return: The title of the tab
"""
child = notebook.get_nth_pag... | [
"def",
"get_notebook_tab_title",
"(",
"notebook",
",",
"page_num",
")",
":",
"child",
"=",
"notebook",
".",
"get_nth_page",
"(",
"page_num",
")",
"tab_label_eventbox",
"=",
"notebook",
".",
"get_tab_label",
"(",
"child",
")",
"return",
"get_widget_title",
"(",
"... | Helper function that gets a notebook's tab title given its page number
:param notebook: The GTK notebook
:param page_num: The page number of the tab, for which the title is required
:return: The title of the tab | [
"Helper",
"function",
"that",
"gets",
"a",
"notebook",
"s",
"tab",
"title",
"given",
"its",
"page",
"number"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/label.py#L208-L217 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/label.py | set_notebook_title | def set_notebook_title(notebook, page_num, title_label):
"""Set the title of a GTK notebook to one of its tab's titles
:param notebook: The GTK notebook
:param page_num: The page number of a specific tab
:param title_label: The GTK label holding the notebook's title
:return: The new title of the no... | python | def set_notebook_title(notebook, page_num, title_label):
"""Set the title of a GTK notebook to one of its tab's titles
:param notebook: The GTK notebook
:param page_num: The page number of a specific tab
:param title_label: The GTK label holding the notebook's title
:return: The new title of the no... | [
"def",
"set_notebook_title",
"(",
"notebook",
",",
"page_num",
",",
"title_label",
")",
":",
"text",
"=",
"get_notebook_tab_title",
"(",
"notebook",
",",
"page_num",
")",
"set_label_markup",
"(",
"title_label",
",",
"text",
",",
"constants",
".",
"INTERFACE_FONT",... | Set the title of a GTK notebook to one of its tab's titles
:param notebook: The GTK notebook
:param page_num: The page number of a specific tab
:param title_label: The GTK label holding the notebook's title
:return: The new title of the notebook | [
"Set",
"the",
"title",
"of",
"a",
"GTK",
"notebook",
"to",
"one",
"of",
"its",
"tab",
"s",
"titles"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/label.py#L220-L230 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/label.py | create_menu_box_with_icon_and_label | def create_menu_box_with_icon_and_label(label_text):
""" Creates a MenuItem box, which is a replacement for the former ImageMenuItem. The box contains, a label
for the icon and one for the text.
:param label_text: The text, which is displayed for the text label
:return:
"""
box = Gtk.Box.ne... | python | def create_menu_box_with_icon_and_label(label_text):
""" Creates a MenuItem box, which is a replacement for the former ImageMenuItem. The box contains, a label
for the icon and one for the text.
:param label_text: The text, which is displayed for the text label
:return:
"""
box = Gtk.Box.ne... | [
"def",
"create_menu_box_with_icon_and_label",
"(",
"label_text",
")",
":",
"box",
"=",
"Gtk",
".",
"Box",
".",
"new",
"(",
"Gtk",
".",
"Orientation",
".",
"HORIZONTAL",
",",
"10",
")",
"box",
".",
"set_border_width",
"(",
"0",
")",
"icon_label",
"=",
"Gtk"... | Creates a MenuItem box, which is a replacement for the former ImageMenuItem. The box contains, a label
for the icon and one for the text.
:param label_text: The text, which is displayed for the text label
:return: | [
"Creates",
"a",
"MenuItem",
"box",
"which",
"is",
"a",
"replacement",
"for",
"the",
"former",
"ImageMenuItem",
".",
"The",
"box",
"contains",
"a",
"label",
"for",
"the",
"icon",
"and",
"one",
"for",
"the",
"text",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/label.py#L233-L248 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/label.py | set_window_size_and_position | def set_window_size_and_position(window, window_key):
"""Adjust GTK Window's size, position and maximized state according to the corresponding values in the
runtime_config file. The maximize method is triggered last to restore also the last stored size and position of the
window. If the runtime_config does ... | python | def set_window_size_and_position(window, window_key):
"""Adjust GTK Window's size, position and maximized state according to the corresponding values in the
runtime_config file. The maximize method is triggered last to restore also the last stored size and position of the
window. If the runtime_config does ... | [
"def",
"set_window_size_and_position",
"(",
"window",
",",
"window_key",
")",
":",
"size",
"=",
"global_runtime_config",
".",
"get_config_value",
"(",
"window_key",
"+",
"'_WINDOW_SIZE'",
")",
"position",
"=",
"global_runtime_config",
".",
"get_config_value",
"(",
"wi... | Adjust GTK Window's size, position and maximized state according to the corresponding values in the
runtime_config file. The maximize method is triggered last to restore also the last stored size and position of the
window. If the runtime_config does not exist, or the corresponding values are missing in the fil... | [
"Adjust",
"GTK",
"Window",
"s",
"size",
"position",
"and",
"maximized",
"state",
"according",
"to",
"the",
"corresponding",
"values",
"in",
"the",
"runtime_config",
"file",
".",
"The",
"maximize",
"method",
"is",
"triggered",
"last",
"to",
"restore",
"also",
"... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/label.py#L257-L287 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/label.py | react_to_event | def react_to_event(view, widget, event):
"""Checks whether the widget is supposed to react to passed event
The function is intended for callback methods registering to shortcut actions. As several widgets can register to
the same shortcut, only the one having the focus should react to it.
:param gtkmv... | python | def react_to_event(view, widget, event):
"""Checks whether the widget is supposed to react to passed event
The function is intended for callback methods registering to shortcut actions. As several widgets can register to
the same shortcut, only the one having the focus should react to it.
:param gtkmv... | [
"def",
"react_to_event",
"(",
"view",
",",
"widget",
",",
"event",
")",
":",
"# See",
"# http://pyGtk.org/pygtk2reference/class-gtkwidget.html#method-gtkwidget--is-focus and",
"# http://pyGtk.org/pygtk2reference/class-gtkwidget.html#method-gtkwidget--has-focus",
"# for detailed information... | Checks whether the widget is supposed to react to passed event
The function is intended for callback methods registering to shortcut actions. As several widgets can register to
the same shortcut, only the one having the focus should react to it.
:param gtkmvc3.View view: The view in which the widget is re... | [
"Checks",
"whether",
"the",
"widget",
"is",
"supposed",
"to",
"react",
"to",
"passed",
"event"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/label.py#L290-L335 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/label.py | is_event_of_key_string | def is_event_of_key_string(event, key_string):
"""Condition check if key string represent the key value of handed event and whether the event is of right type
The function checks for constructed event tuple that are generated by the rafcon.gui.shortcut_manager.ShortcutManager.
:param tuple event: Event tup... | python | def is_event_of_key_string(event, key_string):
"""Condition check if key string represent the key value of handed event and whether the event is of right type
The function checks for constructed event tuple that are generated by the rafcon.gui.shortcut_manager.ShortcutManager.
:param tuple event: Event tup... | [
"def",
"is_event_of_key_string",
"(",
"event",
",",
"key_string",
")",
":",
"return",
"len",
"(",
"event",
")",
">=",
"2",
"and",
"not",
"isinstance",
"(",
"event",
"[",
"1",
"]",
",",
"Gdk",
".",
"ModifierType",
")",
"and",
"event",
"[",
"0",
"]",
"... | Condition check if key string represent the key value of handed event and whether the event is of right type
The function checks for constructed event tuple that are generated by the rafcon.gui.shortcut_manager.ShortcutManager.
:param tuple event: Event tuple generated by the ShortcutManager
:param str key... | [
"Condition",
"check",
"if",
"key",
"string",
"represent",
"the",
"key",
"value",
"of",
"handed",
"event",
"and",
"whether",
"the",
"event",
"is",
"of",
"right",
"type"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/label.py#L338-L345 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/top_tool_bar.py | TopToolBarController.register_view | def register_view(self, view):
"""Called when the View was registered"""
super(TopToolBarController, self).register_view(view)
view['maximize_button'].connect('clicked', self.on_maximize_button_clicked)
self.update_maximize_button() | python | def register_view(self, view):
"""Called when the View was registered"""
super(TopToolBarController, self).register_view(view)
view['maximize_button'].connect('clicked', self.on_maximize_button_clicked)
self.update_maximize_button() | [
"def",
"register_view",
"(",
"self",
",",
"view",
")",
":",
"super",
"(",
"TopToolBarController",
",",
"self",
")",
".",
"register_view",
"(",
"view",
")",
"view",
"[",
"'maximize_button'",
"]",
".",
"connect",
"(",
"'clicked'",
",",
"self",
".",
"on_maxim... | Called when the View was registered | [
"Called",
"when",
"the",
"View",
"was",
"registered"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/top_tool_bar.py#L51-L55 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/top_tool_bar.py | TopToolBarUndockedWindowController.register_view | def register_view(self, view):
"""Called when the View was registered"""
super(TopToolBarUndockedWindowController, self).register_view(view)
view['redock_button'].connect('clicked', self.on_redock_button_clicked) | python | def register_view(self, view):
"""Called when the View was registered"""
super(TopToolBarUndockedWindowController, self).register_view(view)
view['redock_button'].connect('clicked', self.on_redock_button_clicked) | [
"def",
"register_view",
"(",
"self",
",",
"view",
")",
":",
"super",
"(",
"TopToolBarUndockedWindowController",
",",
"self",
")",
".",
"register_view",
"(",
"view",
")",
"view",
"[",
"'redock_button'",
"]",
".",
"connect",
"(",
"'clicked'",
",",
"self",
".",... | Called when the View was registered | [
"Called",
"when",
"the",
"View",
"was",
"registered"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/top_tool_bar.py#L90-L93 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/utils/single_widget_window.py | SingleWidgetWindowController.register_view | def register_view(self, view):
"""Called when the View was registered
Can be used e.g. to connect signals. Here, the destroy signal is connected to close the application
"""
super(SingleWidgetWindowController, self).register_view(view)
self.shortcut_manager = ShortcutManager(sel... | python | def register_view(self, view):
"""Called when the View was registered
Can be used e.g. to connect signals. Here, the destroy signal is connected to close the application
"""
super(SingleWidgetWindowController, self).register_view(view)
self.shortcut_manager = ShortcutManager(sel... | [
"def",
"register_view",
"(",
"self",
",",
"view",
")",
":",
"super",
"(",
"SingleWidgetWindowController",
",",
"self",
")",
".",
"register_view",
"(",
"view",
")",
"self",
".",
"shortcut_manager",
"=",
"ShortcutManager",
"(",
"self",
".",
"view",
"[",
"'main... | Called when the View was registered
Can be used e.g. to connect signals. Here, the destroy signal is connected to close the application | [
"Called",
"when",
"the",
"View",
"was",
"registered"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/single_widget_window.py#L36-L45 |
DLR-RM/RAFCON | source/rafcon/utils/decorators.py | avoid_parallel_execution | def avoid_parallel_execution(func):
"""A decorator to avoid the parallel execution of a function.
If the function is currently called, the second call is just skipped.
:param func: The function to decorate
:return:
"""
def func_wrapper(*args, **kwargs):
if not getattr(func, "currently_... | python | def avoid_parallel_execution(func):
"""A decorator to avoid the parallel execution of a function.
If the function is currently called, the second call is just skipped.
:param func: The function to decorate
:return:
"""
def func_wrapper(*args, **kwargs):
if not getattr(func, "currently_... | [
"def",
"avoid_parallel_execution",
"(",
"func",
")",
":",
"def",
"func_wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"getattr",
"(",
"func",
",",
"\"currently_executing\"",
",",
"False",
")",
":",
"func",
".",
"currently_execu... | A decorator to avoid the parallel execution of a function.
If the function is currently called, the second call is just skipped.
:param func: The function to decorate
:return: | [
"A",
"decorator",
"to",
"avoid",
"the",
"parallel",
"execution",
"of",
"a",
"function",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/decorators.py#L21-L38 |
DLR-RM/RAFCON | source/rafcon/core/states/library_state.py | LibraryState.run | def run(self):
""" This defines the sequence of actions that are taken when the library state is executed
It basically just calls the run method of the container state
:return:
"""
self.state_execution_status = StateExecutionStatus.ACTIVE
logger.debug("Entering library s... | python | def run(self):
""" This defines the sequence of actions that are taken when the library state is executed
It basically just calls the run method of the container state
:return:
"""
self.state_execution_status = StateExecutionStatus.ACTIVE
logger.debug("Entering library s... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"state_execution_status",
"=",
"StateExecutionStatus",
".",
"ACTIVE",
"logger",
".",
"debug",
"(",
"\"Entering library state '{0}' with name '{1}'\"",
".",
"format",
"(",
"self",
".",
"library_name",
",",
"self",
"... | This defines the sequence of actions that are taken when the library state is executed
It basically just calls the run method of the container state
:return: | [
"This",
"defines",
"the",
"sequence",
"of",
"actions",
"that",
"are",
"taken",
"when",
"the",
"library",
"state",
"is",
"executed"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/library_state.py#L210-L227 |
DLR-RM/RAFCON | source/rafcon/core/states/library_state.py | LibraryState.remove_outcome | def remove_outcome(self, outcome_id, force=False, destroy=True):
"""Overwrites the remove_outcome method of the State class. Prevents user from removing a
outcome from the library state.
For further documentation, look at the State class.
:raises exceptions.NotImplementedError: in any ... | python | def remove_outcome(self, outcome_id, force=False, destroy=True):
"""Overwrites the remove_outcome method of the State class. Prevents user from removing a
outcome from the library state.
For further documentation, look at the State class.
:raises exceptions.NotImplementedError: in any ... | [
"def",
"remove_outcome",
"(",
"self",
",",
"outcome_id",
",",
"force",
"=",
"False",
",",
"destroy",
"=",
"True",
")",
":",
"if",
"force",
":",
"return",
"State",
".",
"remove_outcome",
"(",
"self",
",",
"outcome_id",
",",
"force",
",",
"destroy",
")",
... | Overwrites the remove_outcome method of the State class. Prevents user from removing a
outcome from the library state.
For further documentation, look at the State class.
:raises exceptions.NotImplementedError: in any case | [
"Overwrites",
"the",
"remove_outcome",
"method",
"of",
"the",
"State",
"class",
".",
"Prevents",
"user",
"from",
"removing",
"a",
"outcome",
"from",
"the",
"library",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/library_state.py#L259-L270 |
DLR-RM/RAFCON | source/rafcon/core/states/library_state.py | LibraryState.remove_output_data_port | def remove_output_data_port(self, data_port_id, force=False, destroy=True):
"""Overwrites the remove_output_data_port method of the State class. Prevents user from removing a
output data port from the library state.
For further documentation, look at the State class.
:param bool force: ... | python | def remove_output_data_port(self, data_port_id, force=False, destroy=True):
"""Overwrites the remove_output_data_port method of the State class. Prevents user from removing a
output data port from the library state.
For further documentation, look at the State class.
:param bool force: ... | [
"def",
"remove_output_data_port",
"(",
"self",
",",
"data_port_id",
",",
"force",
"=",
"False",
",",
"destroy",
"=",
"True",
")",
":",
"if",
"force",
":",
"return",
"State",
".",
"remove_output_data_port",
"(",
"self",
",",
"data_port_id",
",",
"force",
",",... | Overwrites the remove_output_data_port method of the State class. Prevents user from removing a
output data port from the library state.
For further documentation, look at the State class.
:param bool force: True if the removal should be forced
:raises exceptions.NotImplementedError: in... | [
"Overwrites",
"the",
"remove_output_data_port",
"method",
"of",
"the",
"State",
"class",
".",
"Prevents",
"user",
"from",
"removing",
"a",
"output",
"data",
"port",
"from",
"the",
"library",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/library_state.py#L309-L320 |
DLR-RM/RAFCON | source/rafcon/core/states/library_state.py | LibraryState.library_hierarchy_depth | def library_hierarchy_depth(self):
""" Calculates the library hierarchy depth
Counting starts at the current library state. So if the there is no upper library state the depth is one.
:return: library hierarchy depth
:rtype: int
"""
current_library_hierarchy_dep... | python | def library_hierarchy_depth(self):
""" Calculates the library hierarchy depth
Counting starts at the current library state. So if the there is no upper library state the depth is one.
:return: library hierarchy depth
:rtype: int
"""
current_library_hierarchy_dep... | [
"def",
"library_hierarchy_depth",
"(",
"self",
")",
":",
"current_library_hierarchy_depth",
"=",
"1",
"library_root_state",
"=",
"self",
".",
"get_next_upper_library_root_state",
"(",
")",
"while",
"library_root_state",
"is",
"not",
"None",
":",
"current_library_hierarchy... | Calculates the library hierarchy depth
Counting starts at the current library state. So if the there is no upper library state the depth is one.
:return: library hierarchy depth
:rtype: int | [
"Calculates",
"the",
"library",
"hierarchy",
"depth"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/library_state.py#L567-L580 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.