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 |
|---|---|---|---|---|---|---|---|---|---|---|
openego/eTraGo | etrago/cluster/snapshot.py | update_data_frames | def update_data_frames(network, cluster_weights, dates, hours):
""" Updates the snapshots, snapshots weights and the dataframes based on
the original data in the network and the medoids created by clustering
these original data.
Parameters
-----------
network : pyPSA network object
cluster_... | python | def update_data_frames(network, cluster_weights, dates, hours):
""" Updates the snapshots, snapshots weights and the dataframes based on
the original data in the network and the medoids created by clustering
these original data.
Parameters
-----------
network : pyPSA network object
cluster_... | [
"def",
"update_data_frames",
"(",
"network",
",",
"cluster_weights",
",",
"dates",
",",
"hours",
")",
":",
"network",
".",
"snapshot_weightings",
"=",
"network",
".",
"snapshot_weightings",
".",
"loc",
"[",
"dates",
"]",
"network",
".",
"snapshots",
"=",
"netw... | Updates the snapshots, snapshots weights and the dataframes based on
the original data in the network and the medoids created by clustering
these original data.
Parameters
-----------
network : pyPSA network object
cluster_weights: dictionary
dates: Datetimeindex
Returns
-------
... | [
"Updates",
"the",
"snapshots",
"snapshots",
"weights",
"and",
"the",
"dataframes",
"based",
"on",
"the",
"original",
"data",
"in",
"the",
"network",
"and",
"the",
"medoids",
"created",
"by",
"clustering",
"these",
"original",
"data",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/cluster/snapshot.py#L145-L179 |
openego/eTraGo | etrago/cluster/snapshot.py | daily_bounds | def daily_bounds(network, snapshots):
""" This will bound the storage level to 0.5 max_level every 24th hour.
"""
sus = network.storage_units
# take every first hour of the clustered days
network.model.period_starts = network.snapshot_weightings.index[0::24]
network.model.storages = sus.index
... | python | def daily_bounds(network, snapshots):
""" This will bound the storage level to 0.5 max_level every 24th hour.
"""
sus = network.storage_units
# take every first hour of the clustered days
network.model.period_starts = network.snapshot_weightings.index[0::24]
network.model.storages = sus.index
... | [
"def",
"daily_bounds",
"(",
"network",
",",
"snapshots",
")",
":",
"sus",
"=",
"network",
".",
"storage_units",
"# take every first hour of the clustered days",
"network",
".",
"model",
".",
"period_starts",
"=",
"network",
".",
"snapshot_weightings",
".",
"index",
... | This will bound the storage level to 0.5 max_level every 24th hour. | [
"This",
"will",
"bound",
"the",
"storage",
"level",
"to",
"0",
".",
"5",
"max_level",
"every",
"24th",
"hour",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/cluster/snapshot.py#L182-L202 |
DLR-RM/RAFCON | source/rafcon/gui/start.py | setup_installation | def setup_installation():
"""Install necessary GUI resources
By default, RAFCON should be installed via `setup.py` (`pip install rafcon`). Thereby, all resources are being
installed. However, if this is not the case, one can set the `RAFCON_CHECK_INSTALLATION` env variable to `True`.
Then, the in... | python | def setup_installation():
"""Install necessary GUI resources
By default, RAFCON should be installed via `setup.py` (`pip install rafcon`). Thereby, all resources are being
installed. However, if this is not the case, one can set the `RAFCON_CHECK_INSTALLATION` env variable to `True`.
Then, the in... | [
"def",
"setup_installation",
"(",
")",
":",
"if",
"os",
".",
"environ",
".",
"get",
"(",
"\"RAFCON_CHECK_INSTALLATION\"",
",",
"False",
")",
"==",
"\"True\"",
":",
"rafcon_root",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"rafcon",
".",
"__file__",
")",
... | Install necessary GUI resources
By default, RAFCON should be installed via `setup.py` (`pip install rafcon`). Thereby, all resources are being
installed. However, if this is not the case, one can set the `RAFCON_CHECK_INSTALLATION` env variable to `True`.
Then, the installation will be performed befo... | [
"Install",
"necessary",
"GUI",
"resources",
"By",
"default",
"RAFCON",
"should",
"be",
"installed",
"via",
"setup",
".",
"py",
"(",
"pip",
"install",
"rafcon",
")",
".",
"Thereby",
"all",
"resources",
"are",
"being",
"installed",
".",
"However",
"if",
"this"... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/start.py#L60-L73 |
DLR-RM/RAFCON | source/rafcon/gui/start.py | setup_argument_parser | def setup_argument_parser():
"""Sets up teh parser with the required arguments
:return: The parser object
"""
default_config_path = filesystem.get_default_config_path()
filesystem.create_path(default_config_path)
parser = core_singletons.argument_parser
parser.add_argument('-n', '--new', a... | python | def setup_argument_parser():
"""Sets up teh parser with the required arguments
:return: The parser object
"""
default_config_path = filesystem.get_default_config_path()
filesystem.create_path(default_config_path)
parser = core_singletons.argument_parser
parser.add_argument('-n', '--new', a... | [
"def",
"setup_argument_parser",
"(",
")",
":",
"default_config_path",
"=",
"filesystem",
".",
"get_default_config_path",
"(",
")",
"filesystem",
".",
"create_path",
"(",
"default_config_path",
")",
"parser",
"=",
"core_singletons",
".",
"argument_parser",
"parser",
".... | Sets up teh parser with the required arguments
:return: The parser object | [
"Sets",
"up",
"teh",
"parser",
"with",
"the",
"required",
"arguments"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/start.py#L136-L168 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/scoped_variable_list.py | ScopedVariableListController.register_view | def register_view(self, view):
"""Called when the View was registered"""
super(ScopedVariableListController, self).register_view(view)
view['name_col'].add_attribute(view['name_text'], 'text', self.NAME_STORAGE_ID)
if not isinstance(self.model.state, LibraryState) and self.model.state.g... | python | def register_view(self, view):
"""Called when the View was registered"""
super(ScopedVariableListController, self).register_view(view)
view['name_col'].add_attribute(view['name_text'], 'text', self.NAME_STORAGE_ID)
if not isinstance(self.model.state, LibraryState) and self.model.state.g... | [
"def",
"register_view",
"(",
"self",
",",
"view",
")",
":",
"super",
"(",
"ScopedVariableListController",
",",
"self",
")",
".",
"register_view",
"(",
"view",
")",
"view",
"[",
"'name_col'",
"]",
".",
"add_attribute",
"(",
"view",
"[",
"'name_text'",
"]",
... | 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/state_editor/scoped_variable_list.py#L73-L94 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/scoped_variable_list.py | ScopedVariableListController.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",
"(",
"\"delete\"",
",",
"self",
".",
"remove_action_callback",
")",
"shortcut_manager",
".",
"add_callback_for_action",
"(",
"\"add\"",
",",
... | 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/scoped_variable_list.py#L96-L106 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/scoped_variable_list.py | ScopedVariableListController.paste_action_callback | def paste_action_callback(self, *event):
"""Callback method for paste action
The method trigger the clipboard paste of the list of scoped variables in the clipboard or in case this list is
empty and there are other port types selected in the clipboard it will trigger the paste with convert fl... | python | def paste_action_callback(self, *event):
"""Callback method for paste action
The method trigger the clipboard paste of the list of scoped variables in the clipboard or in case this list is
empty and there are other port types selected in the clipboard it will trigger the paste with convert fl... | [
"def",
"paste_action_callback",
"(",
"self",
",",
"*",
"event",
")",
":",
"if",
"react_to_event",
"(",
"self",
".",
"view",
",",
"self",
".",
"tree_view",
",",
"event",
")",
"and",
"self",
".",
"active_entry_widget",
"is",
"None",
":",
"if",
"not",
"glob... | Callback method for paste action
The method trigger the clipboard paste of the list of scoped variables in the clipboard or in case this list is
empty and there are other port types selected in the clipboard it will trigger the paste with convert flag.
The convert flag will cause the inserti... | [
"Callback",
"method",
"for",
"paste",
"action"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/scoped_variable_list.py#L108-L123 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/scoped_variable_list.py | ScopedVariableListController.on_add | def on_add(self, widget, data=None):
"""Create a new scoped variable with default values"""
if isinstance(self.model, ContainerStateModel):
try:
scoped_var_ids = gui_helper_state_machine.add_scoped_variable_to_selected_states(selected_states=[self.model])
if s... | python | def on_add(self, widget, data=None):
"""Create a new scoped variable with default values"""
if isinstance(self.model, ContainerStateModel):
try:
scoped_var_ids = gui_helper_state_machine.add_scoped_variable_to_selected_states(selected_states=[self.model])
if s... | [
"def",
"on_add",
"(",
"self",
",",
"widget",
",",
"data",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"model",
",",
"ContainerStateModel",
")",
":",
"try",
":",
"scoped_var_ids",
"=",
"gui_helper_state_machine",
".",
"add_scoped_variable_to_se... | Create a new scoped variable with default values | [
"Create",
"a",
"new",
"scoped",
"variable",
"with",
"default",
"values"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/scoped_variable_list.py#L137-L148 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/scoped_variable_list.py | ScopedVariableListController.remove_core_element | def remove_core_element(self, model):
"""Remove respective core element of handed scoped variable model
:param ScopedVariableModel model: Scoped variable model which core element should be removed
:return:
"""
assert model.scoped_variable.parent is self.model.state
gui_h... | python | def remove_core_element(self, model):
"""Remove respective core element of handed scoped variable model
:param ScopedVariableModel model: Scoped variable model which core element should be removed
:return:
"""
assert model.scoped_variable.parent is self.model.state
gui_h... | [
"def",
"remove_core_element",
"(",
"self",
",",
"model",
")",
":",
"assert",
"model",
".",
"scoped_variable",
".",
"parent",
"is",
"self",
".",
"model",
".",
"state",
"gui_helper_state_machine",
".",
"delete_core_element_of_model",
"(",
"model",
")"
] | Remove respective core element of handed scoped variable model
:param ScopedVariableModel model: Scoped variable model which core element should be removed
:return: | [
"Remove",
"respective",
"core",
"element",
"of",
"handed",
"scoped",
"variable",
"model"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/scoped_variable_list.py#L150-L157 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/scoped_variable_list.py | ScopedVariableListController.apply_new_scoped_variable_name | def apply_new_scoped_variable_name(self, path, new_name):
"""Applies the new name of the scoped variable defined by path
:param str path: The path identifying the edited variable
:param str new_name: New name
"""
data_port_id = self.list_store[path][self.ID_STORAGE_ID]
t... | python | def apply_new_scoped_variable_name(self, path, new_name):
"""Applies the new name of the scoped variable defined by path
:param str path: The path identifying the edited variable
:param str new_name: New name
"""
data_port_id = self.list_store[path][self.ID_STORAGE_ID]
t... | [
"def",
"apply_new_scoped_variable_name",
"(",
"self",
",",
"path",
",",
"new_name",
")",
":",
"data_port_id",
"=",
"self",
".",
"list_store",
"[",
"path",
"]",
"[",
"self",
".",
"ID_STORAGE_ID",
"]",
"try",
":",
"if",
"self",
".",
"model",
".",
"state",
... | Applies the new name of the scoped variable defined by path
:param str path: The path identifying the edited variable
:param str new_name: New name | [
"Applies",
"the",
"new",
"name",
"of",
"the",
"scoped",
"variable",
"defined",
"by",
"path"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/scoped_variable_list.py#L159-L170 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/scoped_variable_list.py | ScopedVariableListController.apply_new_scoped_variable_type | def apply_new_scoped_variable_type(self, path, new_variable_type_str):
"""Applies the new data type of the scoped variable defined by path
:param str path: The path identifying the edited variable
:param str new_variable_type_str: New data type as str
"""
data_port_id = self.lis... | python | def apply_new_scoped_variable_type(self, path, new_variable_type_str):
"""Applies the new data type of the scoped variable defined by path
:param str path: The path identifying the edited variable
:param str new_variable_type_str: New data type as str
"""
data_port_id = self.lis... | [
"def",
"apply_new_scoped_variable_type",
"(",
"self",
",",
"path",
",",
"new_variable_type_str",
")",
":",
"data_port_id",
"=",
"self",
".",
"list_store",
"[",
"path",
"]",
"[",
"self",
".",
"ID_STORAGE_ID",
"]",
"try",
":",
"if",
"self",
".",
"model",
".",
... | Applies the new data type of the scoped variable defined by path
:param str path: The path identifying the edited variable
:param str new_variable_type_str: New data type as str | [
"Applies",
"the",
"new",
"data",
"type",
"of",
"the",
"scoped",
"variable",
"defined",
"by",
"path"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/scoped_variable_list.py#L172-L183 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/scoped_variable_list.py | ScopedVariableListController.apply_new_scoped_variable_default_value | def apply_new_scoped_variable_default_value(self, path, new_default_value_str):
"""Applies the new default value of the scoped variable defined by path
:param str path: The path identifying the edited variable
:param str new_default_value_str: New default value as string
"""
dat... | python | def apply_new_scoped_variable_default_value(self, path, new_default_value_str):
"""Applies the new default value of the scoped variable defined by path
:param str path: The path identifying the edited variable
:param str new_default_value_str: New default value as string
"""
dat... | [
"def",
"apply_new_scoped_variable_default_value",
"(",
"self",
",",
"path",
",",
"new_default_value_str",
")",
":",
"data_port_id",
"=",
"self",
".",
"get_list_store_row_from_cursor_selection",
"(",
")",
"[",
"self",
".",
"ID_STORAGE_ID",
"]",
"try",
":",
"if",
"str... | Applies the new default value of the scoped variable defined by path
:param str path: The path identifying the edited variable
:param str new_default_value_str: New default value as string | [
"Applies",
"the",
"new",
"default",
"value",
"of",
"the",
"scoped",
"variable",
"defined",
"by",
"path"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/scoped_variable_list.py#L185-L196 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/scoped_variable_list.py | ScopedVariableListController.reload_scoped_variables_list_store | def reload_scoped_variables_list_store(self):
"""Reloads the scoped variable list store from the data port models"""
if isinstance(self.model, ContainerStateModel):
tmp = self.get_new_list_store()
for sv_model in self.model.scoped_variables:
data_type = sv_model.... | python | def reload_scoped_variables_list_store(self):
"""Reloads the scoped variable list store from the data port models"""
if isinstance(self.model, ContainerStateModel):
tmp = self.get_new_list_store()
for sv_model in self.model.scoped_variables:
data_type = sv_model.... | [
"def",
"reload_scoped_variables_list_store",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"model",
",",
"ContainerStateModel",
")",
":",
"tmp",
"=",
"self",
".",
"get_new_list_store",
"(",
")",
"for",
"sv_model",
"in",
"self",
".",
"model",
"... | Reloads the scoped variable list store from the data port models | [
"Reloads",
"the",
"scoped",
"variable",
"list",
"store",
"from",
"the",
"data",
"port",
"models"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/scoped_variable_list.py#L201-L228 |
DLR-RM/RAFCON | source/rafcon/gui/backup/session.py | store_session | def store_session():
""" Stores reference backup information for all open tabs into runtime config
The backup of never stored tabs (state machines) and not stored state machine changes will be triggered a last
time to secure data lose.
"""
from rafcon.gui.singleton import state_machine_manager_mode... | python | def store_session():
""" Stores reference backup information for all open tabs into runtime config
The backup of never stored tabs (state machines) and not stored state machine changes will be triggered a last
time to secure data lose.
"""
from rafcon.gui.singleton import state_machine_manager_mode... | [
"def",
"store_session",
"(",
")",
":",
"from",
"rafcon",
".",
"gui",
".",
"singleton",
"import",
"state_machine_manager_model",
",",
"global_runtime_config",
"from",
"rafcon",
".",
"gui",
".",
"models",
".",
"auto_backup",
"import",
"AutoBackupModel",
"from",
"raf... | Stores reference backup information for all open tabs into runtime config
The backup of never stored tabs (state machines) and not stored state machine changes will be triggered a last
time to secure data lose. | [
"Stores",
"reference",
"backup",
"information",
"for",
"all",
"open",
"tabs",
"into",
"runtime",
"config"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/backup/session.py#L24-L66 |
DLR-RM/RAFCON | source/rafcon/gui/backup/session.py | restore_session_from_runtime_config | def restore_session_from_runtime_config():
""" Restore stored tabs from runtime config
The method checks if the last status of a state machine is in the backup or in tis original path and loads it
from there. The original path of these state machines are also insert into the recently opened state machines
... | python | def restore_session_from_runtime_config():
""" Restore stored tabs from runtime config
The method checks if the last status of a state machine is in the backup or in tis original path and loads it
from there. The original path of these state machines are also insert into the recently opened state machines
... | [
"def",
"restore_session_from_runtime_config",
"(",
")",
":",
"# TODO add a dirty lock for a crashed rafcon instance also into backup session feature",
"# TODO in case a dialog is needed to give the user control",
"# TODO combine this and auto-backup in one structure/controller/observer",
"from",
"... | Restore stored tabs from runtime config
The method checks if the last status of a state machine is in the backup or in tis original path and loads it
from there. The original path of these state machines are also insert into the recently opened state machines
list. | [
"Restore",
"stored",
"tabs",
"from",
"runtime",
"config"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/backup/session.py#L76-L186 |
DLR-RM/RAFCON | source/rafcon/utils/log.py | add_logging_level | def add_logging_level(level_name, level_num, method_name=None):
"""Add new logging level
Comprehensively adds a new logging level to the `logging` module and the currently configured logging class.
`method_name` becomes a convenience method for both `logging` itself and the class returned by
`logging.... | python | def add_logging_level(level_name, level_num, method_name=None):
"""Add new logging level
Comprehensively adds a new logging level to the `logging` module and the currently configured logging class.
`method_name` becomes a convenience method for both `logging` itself and the class returned by
`logging.... | [
"def",
"add_logging_level",
"(",
"level_name",
",",
"level_num",
",",
"method_name",
"=",
"None",
")",
":",
"if",
"not",
"method_name",
":",
"method_name",
"=",
"level_name",
".",
"lower",
"(",
")",
"if",
"hasattr",
"(",
"logging",
",",
"level_name",
")",
... | Add new logging level
Comprehensively adds a new logging level to the `logging` module and the currently configured logging class.
`method_name` becomes a convenience method for both `logging` itself and the class returned by
`logging.getLoggerClass()` (usually just `logging.Logger`). If `method_name` is ... | [
"Add",
"new",
"logging",
"level"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/log.py#L37-L83 |
DLR-RM/RAFCON | source/rafcon/utils/log.py | get_logger | def get_logger(name):
"""Returns a logger for the given name
The function is basically a wrapper for logging.getLogger and only ensures that the namespace is within "rafcon."
and that the propagation is enabled.
:param str name: The namespace of the new logger
:return: Logger object with given nam... | python | def get_logger(name):
"""Returns a logger for the given name
The function is basically a wrapper for logging.getLogger and only ensures that the namespace is within "rafcon."
and that the propagation is enabled.
:param str name: The namespace of the new logger
:return: Logger object with given nam... | [
"def",
"get_logger",
"(",
"name",
")",
":",
"if",
"name",
"in",
"existing_loggers",
":",
"return",
"existing_loggers",
"[",
"name",
"]",
"# Ensure that all logger are within the RAFCON root namespace",
"namespace",
"=",
"name",
"if",
"name",
".",
"startswith",
"(",
... | Returns a logger for the given name
The function is basically a wrapper for logging.getLogger and only ensures that the namespace is within "rafcon."
and that the propagation is enabled.
:param str name: The namespace of the new logger
:return: Logger object with given namespace
:rtype: logging.Lo... | [
"Returns",
"a",
"logger",
"for",
"the",
"given",
"name"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/log.py#L100-L119 |
openego/eTraGo | etrago/appl.py | etrago | def etrago(args):
"""The etrago function works with following arguments:
Parameters
----------
db : str
``'oedb'``,
Name of Database session setting stored in *config.ini* of *.egoio*
gridversion : NoneType or str
``'v0.2.11'``,
Name of the data version number of ... | python | def etrago(args):
"""The etrago function works with following arguments:
Parameters
----------
db : str
``'oedb'``,
Name of Database session setting stored in *config.ini* of *.egoio*
gridversion : NoneType or str
``'v0.2.11'``,
Name of the data version number of ... | [
"def",
"etrago",
"(",
"args",
")",
":",
"conn",
"=",
"db",
".",
"connection",
"(",
"section",
"=",
"args",
"[",
"'db'",
"]",
")",
"Session",
"=",
"sessionmaker",
"(",
"bind",
"=",
"conn",
")",
"session",
"=",
"Session",
"(",
")",
"# additional argument... | The etrago function works with following arguments:
Parameters
----------
db : str
``'oedb'``,
Name of Database session setting stored in *config.ini* of *.egoio*
gridversion : NoneType or str
``'v0.2.11'``,
Name of the data version number of oedb: state ``'None'`` fo... | [
"The",
"etrago",
"function",
"works",
"with",
"following",
"arguments",
":"
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/appl.py#L151-L634 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | open_state_machine | def open_state_machine(path=None, recent_opened_notification=False):
""" Open a state machine from respective file system path
:param str path: file system path to the state machine
:param bool recent_opened_notification: flags that indicates that this call also should update recently open
:rtype rafc... | python | def open_state_machine(path=None, recent_opened_notification=False):
""" Open a state machine from respective file system path
:param str path: file system path to the state machine
:param bool recent_opened_notification: flags that indicates that this call also should update recently open
:rtype rafc... | [
"def",
"open_state_machine",
"(",
"path",
"=",
"None",
",",
"recent_opened_notification",
"=",
"False",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"if",
"path",
"is",
"None",
":",
"if",
"interface",
".",
"open_folder_func",
"is",
"None",
"... | Open a state machine from respective file system path
:param str path: file system path to the state machine
:param bool recent_opened_notification: flags that indicates that this call also should update recently open
:rtype rafcon.core.state_machine.StateMachine
:return: opened state machine | [
"Open",
"a",
"state",
"machine",
"from",
"respective",
"file",
"system",
"path"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L82-L120 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | save_state_machine | def save_state_machine(delete_old_state_machine=False, recent_opened_notification=False, as_copy=False, copy_path=None):
""" Save selected state machine
The function checks if states of the state machine has not stored script data abd triggers dialog windows to
take user input how to continue (ignoring o... | python | def save_state_machine(delete_old_state_machine=False, recent_opened_notification=False, as_copy=False, copy_path=None):
""" Save selected state machine
The function checks if states of the state machine has not stored script data abd triggers dialog windows to
take user input how to continue (ignoring o... | [
"def",
"save_state_machine",
"(",
"delete_old_state_machine",
"=",
"False",
",",
"recent_opened_notification",
"=",
"False",
",",
"as_copy",
"=",
"False",
",",
"copy_path",
"=",
"None",
")",
":",
"state_machine_manager_model",
"=",
"rafcon",
".",
"gui",
".",
"sing... | Save selected state machine
The function checks if states of the state machine has not stored script data abd triggers dialog windows to
take user input how to continue (ignoring or storing this script changes).
If the state machine file_system_path is None function save_state_machine_as is used to coll... | [
"Save",
"selected",
"state",
"machine"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L145-L220 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | save_state_machine_as | def save_state_machine_as(path=None, recent_opened_notification=False, as_copy=False):
""" Store selected state machine to path
If there is no handed path the interface dialog "create folder" is used to collect one. The state machine finally
is stored by the save_state_machine function.
:param str p... | python | def save_state_machine_as(path=None, recent_opened_notification=False, as_copy=False):
""" Store selected state machine to path
If there is no handed path the interface dialog "create folder" is used to collect one. The state machine finally
is stored by the save_state_machine function.
:param str p... | [
"def",
"save_state_machine_as",
"(",
"path",
"=",
"None",
",",
"recent_opened_notification",
"=",
"False",
",",
"as_copy",
"=",
"False",
")",
":",
"state_machine_manager_model",
"=",
"rafcon",
".",
"gui",
".",
"singleton",
".",
"state_machine_manager_model",
"select... | Store selected state machine to path
If there is no handed path the interface dialog "create folder" is used to collect one. The state machine finally
is stored by the save_state_machine function.
:param str path: Path of state machine folder where selected state machine should be stored
:param bool... | [
"Store",
"selected",
"state",
"machine",
"to",
"path"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L223-L264 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | save_selected_state_as | def save_selected_state_as():
"""Save selected state as separate state machine
:return True if successfully stored, False if the storing process was canceled or stopped by condition fail
:rtype bool:
:raises exceptions.ValueError: If dialog response ids are out of bounds
"""
state_machine_mana... | python | def save_selected_state_as():
"""Save selected state as separate state machine
:return True if successfully stored, False if the storing process was canceled or stopped by condition fail
:rtype bool:
:raises exceptions.ValueError: If dialog response ids are out of bounds
"""
state_machine_mana... | [
"def",
"save_selected_state_as",
"(",
")",
":",
"state_machine_manager_model",
"=",
"rafcon",
".",
"gui",
".",
"singleton",
".",
"state_machine_manager_model",
"selection",
"=",
"state_machine_manager_model",
".",
"get_selected_state_machine_model",
"(",
")",
".",
"select... | Save selected state as separate state machine
:return True if successfully stored, False if the storing process was canceled or stopped by condition fail
:rtype bool:
:raises exceptions.ValueError: If dialog response ids are out of bounds | [
"Save",
"selected",
"state",
"as",
"separate",
"state",
"machine"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L267-L371 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | is_state_machine_stopped_to_proceed | def is_state_machine_stopped_to_proceed(selected_sm_id=None, root_window=None):
""" Check if state machine is stopped and in case request user by dialog how to proceed
The function checks if a specific state machine or by default all state machines have stopped or finished
execution. If a state machine i... | python | def is_state_machine_stopped_to_proceed(selected_sm_id=None, root_window=None):
""" Check if state machine is stopped and in case request user by dialog how to proceed
The function checks if a specific state machine or by default all state machines have stopped or finished
execution. If a state machine i... | [
"def",
"is_state_machine_stopped_to_proceed",
"(",
"selected_sm_id",
"=",
"None",
",",
"root_window",
"=",
"None",
")",
":",
"# check if the/a state machine is still running",
"if",
"not",
"state_machine_execution_engine",
".",
"finished_or_stopped",
"(",
")",
":",
"if",
... | Check if state machine is stopped and in case request user by dialog how to proceed
The function checks if a specific state machine or by default all state machines have stopped or finished
execution. If a state machine is still running the user is ask by dialog window if those should be stopped or not.
... | [
"Check",
"if",
"state",
"machine",
"is",
"stopped",
"and",
"in",
"case",
"request",
"user",
"by",
"dialog",
"how",
"to",
"proceed"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L374-L404 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | refresh_selected_state_machine | def refresh_selected_state_machine():
"""Reloads the selected state machine.
"""
selected_sm_id = rafcon.gui.singleton.state_machine_manager_model.selected_state_machine_id
selected_sm = state_machine_manager.state_machines[selected_sm_id]
state_machines_editor_ctrl = rafcon.gui.singleton.main_wind... | python | def refresh_selected_state_machine():
"""Reloads the selected state machine.
"""
selected_sm_id = rafcon.gui.singleton.state_machine_manager_model.selected_state_machine_id
selected_sm = state_machine_manager.state_machines[selected_sm_id]
state_machines_editor_ctrl = rafcon.gui.singleton.main_wind... | [
"def",
"refresh_selected_state_machine",
"(",
")",
":",
"selected_sm_id",
"=",
"rafcon",
".",
"gui",
".",
"singleton",
".",
"state_machine_manager_model",
".",
"selected_state_machine_id",
"selected_sm",
"=",
"state_machine_manager",
".",
"state_machines",
"[",
"selected_... | Reloads the selected state machine. | [
"Reloads",
"the",
"selected",
"state",
"machine",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L508-L549 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | refresh_all | def refresh_all(force=False):
"""Remove/close all libraries and state machines and reloads them freshly from the file system
:param bool force: Force flag to avoid any checks
"""
state_machines_editor_ctrl = rafcon.gui.singleton.main_window_controller.get_controller('state_machines_editor_ctrl')
st... | python | def refresh_all(force=False):
"""Remove/close all libraries and state machines and reloads them freshly from the file system
:param bool force: Force flag to avoid any checks
"""
state_machines_editor_ctrl = rafcon.gui.singleton.main_window_controller.get_controller('state_machines_editor_ctrl')
st... | [
"def",
"refresh_all",
"(",
"force",
"=",
"False",
")",
":",
"state_machines_editor_ctrl",
"=",
"rafcon",
".",
"gui",
".",
"singleton",
".",
"main_window_controller",
".",
"get_controller",
"(",
"'state_machines_editor_ctrl'",
")",
"states_editor_ctrl",
"=",
"rafcon",
... | Remove/close all libraries and state machines and reloads them freshly from the file system
:param bool force: Force flag to avoid any checks | [
"Remove",
"/",
"close",
"all",
"libraries",
"and",
"state",
"machines",
"and",
"reloads",
"them",
"freshly",
"from",
"the",
"file",
"system"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L552-L598 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | delete_core_element_of_model | def delete_core_element_of_model(model, raise_exceptions=False, recursive=True, destroy=True, force=False):
"""Deletes respective core element of handed model of its state machine
If the model is one of state, data flow or transition, it is tried to delete that model together with its
data from the corresp... | python | def delete_core_element_of_model(model, raise_exceptions=False, recursive=True, destroy=True, force=False):
"""Deletes respective core element of handed model of its state machine
If the model is one of state, data flow or transition, it is tried to delete that model together with its
data from the corresp... | [
"def",
"delete_core_element_of_model",
"(",
"model",
",",
"raise_exceptions",
"=",
"False",
",",
"recursive",
"=",
"True",
",",
"destroy",
"=",
"True",
",",
"force",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"model",
",",
"AbstractStateModel",
")",
"a... | Deletes respective core element of handed model of its state machine
If the model is one of state, data flow or transition, it is tried to delete that model together with its
data from the corresponding state machine.
:param model: The model of respective core element to delete
:param bool raise_excep... | [
"Deletes",
"respective",
"core",
"element",
"of",
"handed",
"model",
"of",
"its",
"state",
"machine"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L601-L639 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | delete_core_elements_of_models | def delete_core_elements_of_models(models, raise_exceptions=True, recursive=True, destroy=True, force=False):
"""Deletes all respective core elements for the given models
Calls the :func:`delete_core_element_of_model` for all given models.
:param models: A single model or a list of models of respective co... | python | def delete_core_elements_of_models(models, raise_exceptions=True, recursive=True, destroy=True, force=False):
"""Deletes all respective core elements for the given models
Calls the :func:`delete_core_element_of_model` for all given models.
:param models: A single model or a list of models of respective co... | [
"def",
"delete_core_elements_of_models",
"(",
"models",
",",
"raise_exceptions",
"=",
"True",
",",
"recursive",
"=",
"True",
",",
"destroy",
"=",
"True",
",",
"force",
"=",
"False",
")",
":",
"# If only one model is given, make a list out of it",
"if",
"not",
"hasat... | Deletes all respective core elements for the given models
Calls the :func:`delete_core_element_of_model` for all given models.
:param models: A single model or a list of models of respective core element to be deleted
:param bool raise_exceptions: Whether to raise exceptions or log error messages in case ... | [
"Deletes",
"all",
"respective",
"core",
"elements",
"for",
"the",
"given",
"models"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L642-L656 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | is_selection_inside_of_library_state | def is_selection_inside_of_library_state(state_machine_m=None, selected_elements=None):
""" Check if handed or selected elements are inside of library state
If no state machine model or selected_elements are handed the method is searching for the selected state machine and
its selected elements. If selecte... | python | def is_selection_inside_of_library_state(state_machine_m=None, selected_elements=None):
""" Check if handed or selected elements are inside of library state
If no state machine model or selected_elements are handed the method is searching for the selected state machine and
its selected elements. If selecte... | [
"def",
"is_selection_inside_of_library_state",
"(",
"state_machine_m",
"=",
"None",
",",
"selected_elements",
"=",
"None",
")",
":",
"if",
"state_machine_m",
"is",
"None",
":",
"state_machine_m",
"=",
"rafcon",
".",
"gui",
".",
"singleton",
".",
"state_machine_manag... | Check if handed or selected elements are inside of library state
If no state machine model or selected_elements are handed the method is searching for the selected state machine and
its selected elements. If selected_elements list is handed handed state machine model is ignored.
:param rafcon.gui.models.s... | [
"Check",
"if",
"handed",
"or",
"selected",
"elements",
"are",
"inside",
"of",
"library",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L659-L684 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | add_new_state | def add_new_state(state_machine_m, state_type):
"""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 parent state (selected state) is a container state, and if the graphical editor or
the state machine tree are in focus.
... | python | def add_new_state(state_machine_m, state_type):
"""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 parent state (selected state) is a container state, and if the graphical editor or
the state machine tree are in focus.
... | [
"def",
"add_new_state",
"(",
"state_machine_m",
",",
"state_type",
")",
":",
"assert",
"isinstance",
"(",
"state_machine_m",
",",
"StateMachineModel",
")",
"if",
"state_type",
"not",
"in",
"list",
"(",
"StateType",
")",
":",
"state_type",
"=",
"StateType",
".",
... | 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 parent state (selected state) is a container state, and if the graphical editor or
the state machine tree are 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/helpers/state_machine.py#L736-L764 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | insert_state_into_selected_state | def insert_state_into_selected_state(state, as_template=False):
"""Adds a State to the selected state
:param state: the state which is inserted
:param as_template: If a state is a library state can be insert as template
:return: boolean: success of the insertion
"""
smm_m = rafcon.gui.singleton... | python | def insert_state_into_selected_state(state, as_template=False):
"""Adds a State to the selected state
:param state: the state which is inserted
:param as_template: If a state is a library state can be insert as template
:return: boolean: success of the insertion
"""
smm_m = rafcon.gui.singleton... | [
"def",
"insert_state_into_selected_state",
"(",
"state",
",",
"as_template",
"=",
"False",
")",
":",
"smm_m",
"=",
"rafcon",
".",
"gui",
".",
"singleton",
".",
"state_machine_manager_model",
"if",
"not",
"isinstance",
"(",
"state",
",",
"State",
")",
":",
"log... | Adds a State to the selected state
:param state: the state which is inserted
:param as_template: If a state is a library state can be insert as template
:return: boolean: success of the insertion | [
"Adds",
"a",
"State",
"to",
"the",
"selected",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L781-L813 |
DLR-RM/RAFCON | source/rafcon/gui/helpers/state_machine.py | substitute_selected_state | def substitute_selected_state(state, as_template=False, keep_name=False):
""" Substitute the selected state with the handed state
:param rafcon.core.states.state.State state: A state of any functional type that derives from State
:param bool as_template: The flag determines if a handed the state of type Li... | python | def substitute_selected_state(state, as_template=False, keep_name=False):
""" Substitute the selected state with the handed state
:param rafcon.core.states.state.State state: A state of any functional type that derives from State
:param bool as_template: The flag determines if a handed the state of type Li... | [
"def",
"substitute_selected_state",
"(",
"state",
",",
"as_template",
"=",
"False",
",",
"keep_name",
"=",
"False",
")",
":",
"# print(\"substitute_selected_state\", state, as_template)",
"assert",
"isinstance",
"(",
"state",
",",
"State",
")",
"from",
"rafcon",
".",
... | Substitute the selected state with the handed state
:param rafcon.core.states.state.State state: A state of any functional type that derives from State
:param bool as_template: The flag determines if a handed the state of type LibraryState is insert as template
:return: | [
"Substitute",
"the",
"selected",
"state",
"with",
"the",
"handed",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state_machine.py#L947-L976 |
openego/eTraGo | etrago/cluster/disaggregation.py | Disaggregation.construct_partial_network | def construct_partial_network(self, cluster, scenario):
"""
Compute the partial network that has been merged into a single cluster.
The resulting network retains the external cluster buses that
share some line with the cluster identified by `cluster`.
These external buses will be... | python | def construct_partial_network(self, cluster, scenario):
"""
Compute the partial network that has been merged into a single cluster.
The resulting network retains the external cluster buses that
share some line with the cluster identified by `cluster`.
These external buses will be... | [
"def",
"construct_partial_network",
"(",
"self",
",",
"cluster",
",",
"scenario",
")",
":",
"#Create an empty network",
"partial_network",
"=",
"Network",
"(",
")",
"# find all lines that have at least one bus inside the cluster",
"busflags",
"=",
"(",
"self",
".",
"buses... | Compute the partial network that has been merged into a single cluster.
The resulting network retains the external cluster buses that
share some line with the cluster identified by `cluster`.
These external buses will be prefixed by self.id_prefix in order to
prevent name clashes with bu... | [
"Compute",
"the",
"partial",
"network",
"that",
"has",
"been",
"merged",
"into",
"a",
"single",
"cluster",
".",
"The",
"resulting",
"network",
"retains",
"the",
"external",
"cluster",
"buses",
"that",
"share",
"some",
"line",
"with",
"the",
"cluster",
"identif... | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/cluster/disaggregation.py#L55-L211 |
openego/eTraGo | etrago/cluster/disaggregation.py | Disaggregation.solve | def solve(self, scenario, solver):
"""
Decompose each cluster into separate units and try to optimize them
separately
:param scenario:
:param solver: Solver that may be used to optimize partial networks
"""
clusters = set(self.clustering.busmap.values)
n =... | python | def solve(self, scenario, solver):
"""
Decompose each cluster into separate units and try to optimize them
separately
:param scenario:
:param solver: Solver that may be used to optimize partial networks
"""
clusters = set(self.clustering.busmap.values)
n =... | [
"def",
"solve",
"(",
"self",
",",
"scenario",
",",
"solver",
")",
":",
"clusters",
"=",
"set",
"(",
"self",
".",
"clustering",
".",
"busmap",
".",
"values",
")",
"n",
"=",
"len",
"(",
"clusters",
")",
"self",
".",
"stats",
"=",
"{",
"'clusters'",
"... | Decompose each cluster into separate units and try to optimize them
separately
:param scenario:
:param solver: Solver that may be used to optimize partial networks | [
"Decompose",
"each",
"cluster",
"into",
"separate",
"units",
"and",
"try",
"to",
"optimize",
"them",
"separately",
":",
"param",
"scenario",
":",
":",
"param",
"solver",
":",
"Solver",
"that",
"may",
"be",
"used",
"to",
"optimize",
"partial",
"networks"
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/cluster/disaggregation.py#L216-L282 |
DLR-RM/RAFCON | source/rafcon/core/state_elements/transition.py | Transition.modify_origin | def modify_origin(self, from_state, from_outcome):
"""Set both from_state and from_outcome at the same time to modify transition origin
:param str from_state: State id of the origin state
:param int from_outcome: Outcome id of the origin port
:raises exceptions.ValueError: If parameters... | python | def modify_origin(self, from_state, from_outcome):
"""Set both from_state and from_outcome at the same time to modify transition origin
:param str from_state: State id of the origin state
:param int from_outcome: Outcome id of the origin port
:raises exceptions.ValueError: If parameters... | [
"def",
"modify_origin",
"(",
"self",
",",
"from_state",
",",
"from_outcome",
")",
":",
"if",
"not",
"(",
"from_state",
"is",
"None",
"and",
"from_outcome",
"is",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"from_state",
",",
"string_types",
")",
":",... | Set both from_state and from_outcome at the same time to modify transition origin
:param str from_state: State id of the origin state
:param int from_outcome: Outcome id of the origin port
:raises exceptions.ValueError: If parameters have wrong types or the new transition is not valid | [
"Set",
"both",
"from_state",
"and",
"from_outcome",
"at",
"the",
"same",
"time",
"to",
"modify",
"transition",
"origin"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/state_elements/transition.py#L112-L134 |
DLR-RM/RAFCON | source/rafcon/core/state_elements/transition.py | Transition.modify_target | def modify_target(self, to_state, to_outcome=None):
"""Set both to_state and to_outcome at the same time to modify transition target
:param str to_state: State id of the target state
:param int to_outcome: Outcome id of the target port
:raises exceptions.ValueError: If parameters have w... | python | def modify_target(self, to_state, to_outcome=None):
"""Set both to_state and to_outcome at the same time to modify transition target
:param str to_state: State id of the target state
:param int to_outcome: Outcome id of the target port
:raises exceptions.ValueError: If parameters have w... | [
"def",
"modify_target",
"(",
"self",
",",
"to_state",
",",
"to_outcome",
"=",
"None",
")",
":",
"if",
"not",
"(",
"to_state",
"is",
"None",
"and",
"(",
"to_outcome",
"is",
"not",
"int",
"and",
"to_outcome",
"is",
"not",
"None",
")",
")",
":",
"if",
"... | Set both to_state and to_outcome at the same time to modify transition target
:param str to_state: State id of the target state
:param int to_outcome: Outcome id of the target port
:raises exceptions.ValueError: If parameters have wrong types or the new transition is not valid | [
"Set",
"both",
"to_state",
"and",
"to_outcome",
"at",
"the",
"same",
"time",
"to",
"modify",
"transition",
"target"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/state_elements/transition.py#L138-L161 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/global_variable_manager.py | GlobalVariableManagerController.register_view | def register_view(self, view):
"""Called when the View was registered"""
ExtendedController.register_view(self, view) # no super to avoid sm based selection initialization
view['name_text'].set_property('editable', True)
view['value_text'].set_property('editable', True)
view['ty... | python | def register_view(self, view):
"""Called when the View was registered"""
ExtendedController.register_view(self, view) # no super to avoid sm based selection initialization
view['name_text'].set_property('editable', True)
view['value_text'].set_property('editable', True)
view['ty... | [
"def",
"register_view",
"(",
"self",
",",
"view",
")",
":",
"ExtendedController",
".",
"register_view",
"(",
"self",
",",
"view",
")",
"# no super to avoid sm based selection initialization",
"view",
"[",
"'name_text'",
"]",
".",
"set_property",
"(",
"'editable'",
"... | 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/global_variable_manager.py#L70-L85 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/global_variable_manager.py | GlobalVariableManagerController.global_variable_is_editable | def global_variable_is_editable(self, gv_name, intro_message='edit'):
"""Check whether global variable is locked
:param str gv_name: Name of global variable to be checked
:param str intro_message: Message which is used form a useful logger error message if needed
:return:
"""
... | python | def global_variable_is_editable(self, gv_name, intro_message='edit'):
"""Check whether global variable is locked
:param str gv_name: Name of global variable to be checked
:param str intro_message: Message which is used form a useful logger error message if needed
:return:
"""
... | [
"def",
"global_variable_is_editable",
"(",
"self",
",",
"gv_name",
",",
"intro_message",
"=",
"'edit'",
")",
":",
"if",
"self",
".",
"model",
".",
"global_variable_manager",
".",
"is_locked",
"(",
"gv_name",
")",
":",
"logger",
".",
"error",
"(",
"\"{1} of glo... | Check whether global variable is locked
:param str gv_name: Name of global variable to be checked
:param str intro_message: Message which is used form a useful logger error message if needed
:return: | [
"Check",
"whether",
"global",
"variable",
"is",
"locked"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/global_variable_manager.py#L96-L106 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/global_variable_manager.py | GlobalVariableManagerController.on_add | def on_add(self, widget, data=None):
"""Create a global variable with default value and select its row
Triggered when the add button in the global variables tab is clicked.
"""
gv_name = "new_global_%s" % self.global_variable_counter
self.global_variable_counter += 1
try... | python | def on_add(self, widget, data=None):
"""Create a global variable with default value and select its row
Triggered when the add button in the global variables tab is clicked.
"""
gv_name = "new_global_%s" % self.global_variable_counter
self.global_variable_counter += 1
try... | [
"def",
"on_add",
"(",
"self",
",",
"widget",
",",
"data",
"=",
"None",
")",
":",
"gv_name",
"=",
"\"new_global_%s\"",
"%",
"self",
".",
"global_variable_counter",
"self",
".",
"global_variable_counter",
"+=",
"1",
"try",
":",
"self",
".",
"model",
".",
"gl... | Create a global variable with default value and select its row
Triggered when the add button in the global variables tab is clicked. | [
"Create",
"a",
"global",
"variable",
"with",
"default",
"value",
"and",
"select",
"its",
"row"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/global_variable_manager.py#L108-L120 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/global_variable_manager.py | GlobalVariableManagerController.on_lock | def on_lock(self, widget, data=None):
"""Locks respective selected core element"""
path_list = None
if self.view is not None:
model, path_list = self.tree_view.get_selection().get_selected_rows()
models = [self.list_store[path][self.MODEL_STORAGE_ID] for path in path_list] if... | python | def on_lock(self, widget, data=None):
"""Locks respective selected core element"""
path_list = None
if self.view is not None:
model, path_list = self.tree_view.get_selection().get_selected_rows()
models = [self.list_store[path][self.MODEL_STORAGE_ID] for path in path_list] if... | [
"def",
"on_lock",
"(",
"self",
",",
"widget",
",",
"data",
"=",
"None",
")",
":",
"path_list",
"=",
"None",
"if",
"self",
".",
"view",
"is",
"not",
"None",
":",
"model",
",",
"path_list",
"=",
"self",
".",
"tree_view",
".",
"get_selection",
"(",
")",... | Locks respective selected core element | [
"Locks",
"respective",
"selected",
"core",
"element"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/global_variable_manager.py#L122-L138 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/global_variable_manager.py | GlobalVariableManagerController.remove_core_element | def remove_core_element(self, model):
"""Remove respective core element of handed global variable name
:param str model: String that is the key/gv_name of core element which should be removed
:return:
"""
gv_name = model
if self.global_variable_is_editable(gv_name, "Dele... | python | def remove_core_element(self, model):
"""Remove respective core element of handed global variable name
:param str model: String that is the key/gv_name of core element which should be removed
:return:
"""
gv_name = model
if self.global_variable_is_editable(gv_name, "Dele... | [
"def",
"remove_core_element",
"(",
"self",
",",
"model",
")",
":",
"gv_name",
"=",
"model",
"if",
"self",
".",
"global_variable_is_editable",
"(",
"gv_name",
",",
"\"Deletion\"",
")",
":",
"try",
":",
"self",
".",
"model",
".",
"global_variable_manager",
".",
... | Remove respective core element of handed global variable name
:param str model: String that is the key/gv_name of core element which should be removed
:return: | [
"Remove",
"respective",
"core",
"element",
"of",
"handed",
"global",
"variable",
"name"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/global_variable_manager.py#L158-L170 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/global_variable_manager.py | GlobalVariableManagerController.apply_new_global_variable_name | def apply_new_global_variable_name(self, path, new_gv_name):
"""Change global variable name/key according handed string
Updates the global variable name only if different and already in list store.
:param path: The path identifying the edited global variable tree view row, can be str, int or t... | python | def apply_new_global_variable_name(self, path, new_gv_name):
"""Change global variable name/key according handed string
Updates the global variable name only if different and already in list store.
:param path: The path identifying the edited global variable tree view row, can be str, int or t... | [
"def",
"apply_new_global_variable_name",
"(",
"self",
",",
"path",
",",
"new_gv_name",
")",
":",
"gv_name",
"=",
"self",
".",
"list_store",
"[",
"path",
"]",
"[",
"self",
".",
"NAME_STORAGE_ID",
"]",
"if",
"gv_name",
"==",
"new_gv_name",
"or",
"not",
"self",... | Change global variable name/key according handed string
Updates the global variable name only if different and already in list store.
:param path: The path identifying the edited global variable tree view row, can be str, int or tuple.
:param str new_gv_name: New global variable name | [
"Change",
"global",
"variable",
"name",
"/",
"key",
"according",
"handed",
"string"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/global_variable_manager.py#L172-L198 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/global_variable_manager.py | GlobalVariableManagerController.apply_new_global_variable_value | def apply_new_global_variable_value(self, path, new_value_as_string):
"""Change global variable value according handed string
Updates the global variable value only if new value string is different to old representation.
:param path: The path identifying the edited global variable tree view ro... | python | def apply_new_global_variable_value(self, path, new_value_as_string):
"""Change global variable value according handed string
Updates the global variable value only if new value string is different to old representation.
:param path: The path identifying the edited global variable tree view ro... | [
"def",
"apply_new_global_variable_value",
"(",
"self",
",",
"path",
",",
"new_value_as_string",
")",
":",
"if",
"self",
".",
"list_store",
"[",
"path",
"]",
"[",
"self",
".",
"DATA_TYPE_AS_STRING_STORAGE_ID",
"]",
"==",
"new_value_as_string",
":",
"return",
"gv_na... | Change global variable value according handed string
Updates the global variable value only if new value string is different to old representation.
:param path: The path identifying the edited global variable tree view row, can be str, int or tuple.
:param str new_value_as_string: New global v... | [
"Change",
"global",
"variable",
"value",
"according",
"handed",
"string"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/global_variable_manager.py#L200-L242 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/global_variable_manager.py | GlobalVariableManagerController.apply_new_global_variable_type | def apply_new_global_variable_type(self, path, new_data_type_as_string):
"""Change global variable value according handed string
Updates the global variable data type only if different.
:param path: The path identifying the edited global variable tree view row, can be str, int or tuple.
... | python | def apply_new_global_variable_type(self, path, new_data_type_as_string):
"""Change global variable value according handed string
Updates the global variable data type only if different.
:param path: The path identifying the edited global variable tree view row, can be str, int or tuple.
... | [
"def",
"apply_new_global_variable_type",
"(",
"self",
",",
"path",
",",
"new_data_type_as_string",
")",
":",
"if",
"self",
".",
"list_store",
"[",
"path",
"]",
"[",
"self",
".",
"DATA_TYPE_AS_STRING_STORAGE_ID",
"]",
"==",
"new_data_type_as_string",
":",
"return",
... | Change global variable value according handed string
Updates the global variable data type only if different.
:param path: The path identifying the edited global variable tree view row, can be str, int or tuple.
:param str new_data_type_as_string: New global variable data type as string | [
"Change",
"global",
"variable",
"value",
"according",
"handed",
"string"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/global_variable_manager.py#L244-L283 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/global_variable_manager.py | GlobalVariableManagerController.assign_notification_from_gvm | def assign_notification_from_gvm(self, model, prop_name, info):
"""Handles gtkmvc3 notification from global variable manager
Calls update of whole list store in case new variable was added. Avoids to run updates without reasonable change.
Holds tree store and updates row elements if is-locked o... | python | def assign_notification_from_gvm(self, model, prop_name, info):
"""Handles gtkmvc3 notification from global variable manager
Calls update of whole list store in case new variable was added. Avoids to run updates without reasonable change.
Holds tree store and updates row elements if is-locked o... | [
"def",
"assign_notification_from_gvm",
"(",
"self",
",",
"model",
",",
"prop_name",
",",
"info",
")",
":",
"if",
"info",
"[",
"'method_name'",
"]",
"in",
"[",
"'set_locked_variable'",
"]",
"or",
"info",
"[",
"'result'",
"]",
"is",
"Exception",
":",
"return",... | Handles gtkmvc3 notification from global variable manager
Calls update of whole list store in case new variable was added. Avoids to run updates without reasonable change.
Holds tree store and updates row elements if is-locked or global variable value changes. | [
"Handles",
"gtkmvc3",
"notification",
"from",
"global",
"variable",
"manager"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/global_variable_manager.py#L286-L314 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/global_variable_manager.py | GlobalVariableManagerController.update_global_variables_list_store | def update_global_variables_list_store(self):
"""Updates the global variable list store
Triggered after creation or deletion of a variable has taken place.
"""
# logger.info("update")
self.list_store_iterators = {}
self.list_store.clear()
keys = self.model.global... | python | def update_global_variables_list_store(self):
"""Updates the global variable list store
Triggered after creation or deletion of a variable has taken place.
"""
# logger.info("update")
self.list_store_iterators = {}
self.list_store.clear()
keys = self.model.global... | [
"def",
"update_global_variables_list_store",
"(",
"self",
")",
":",
"# logger.info(\"update\")",
"self",
".",
"list_store_iterators",
"=",
"{",
"}",
"self",
".",
"list_store",
".",
"clear",
"(",
")",
"keys",
"=",
"self",
".",
"model",
".",
"global_variable_manager... | Updates the global variable list store
Triggered after creation or deletion of a variable has taken place. | [
"Updates",
"the",
"global",
"variable",
"list",
"store"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/global_variable_manager.py#L316-L332 |
DLR-RM/RAFCON | source/rafcon/gui/resave_state_machines.py | convert_libraries_in_path | def convert_libraries_in_path(config_path, lib_path, target_path=None):
"""
This function resaves all libraries found at the spcified path
:param lib_path: the path to look for libraries
:return:
"""
for lib in os.listdir(lib_path):
if os.path.isdir(os.path.join(lib_path, lib)) and not '... | python | def convert_libraries_in_path(config_path, lib_path, target_path=None):
"""
This function resaves all libraries found at the spcified path
:param lib_path: the path to look for libraries
:return:
"""
for lib in os.listdir(lib_path):
if os.path.isdir(os.path.join(lib_path, lib)) and not '... | [
"def",
"convert_libraries_in_path",
"(",
"config_path",
",",
"lib_path",
",",
"target_path",
"=",
"None",
")",
":",
"for",
"lib",
"in",
"os",
".",
"listdir",
"(",
"lib_path",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",... | This function resaves all libraries found at the spcified path
:param lib_path: the path to look for libraries
:return: | [
"This",
"function",
"resaves",
"all",
"libraries",
"found",
"at",
"the",
"spcified",
"path",
":",
"param",
"lib_path",
":",
"the",
"path",
"to",
"look",
"for",
"libraries",
":",
"return",
":"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/resave_state_machines.py#L147-L169 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/canvas.py | MyCanvas.get_view_for_id | def get_view_for_id(self, view_class, element_id, parent_item=None):
"""Searches and returns the View for the given id and type
:param view_class: The view type to search for
:param element_id: The id of element of the searched view
:param gaphas.item.Item parent_item: Restrict the sear... | python | def get_view_for_id(self, view_class, element_id, parent_item=None):
"""Searches and returns the View for the given id and type
:param view_class: The view type to search for
:param element_id: The id of element of the searched view
:param gaphas.item.Item parent_item: Restrict the sear... | [
"def",
"get_view_for_id",
"(",
"self",
",",
"view_class",
",",
"element_id",
",",
"parent_item",
"=",
"None",
")",
":",
"from",
"rafcon",
".",
"gui",
".",
"mygaphas",
".",
"items",
".",
"state",
"import",
"StateView",
"from",
"rafcon",
".",
"gui",
".",
"... | Searches and returns the View for the given id and type
:param view_class: The view type to search for
:param element_id: The id of element of the searched view
:param gaphas.item.Item parent_item: Restrict the search to this parent item
:return: The view for the given id or None if not... | [
"Searches",
"and",
"returns",
"the",
"View",
"for",
"the",
"given",
"id",
"and",
"type"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/canvas.py#L121-L144 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/canvas.py | MyCanvas.wait_for_update | def wait_for_update(self, trigger_update=False):
"""Update canvas and handle all events in the gtk queue
:param bool trigger_update: Whether to call update_now() or not
"""
if trigger_update:
self.update_now()
from gi.repository import Gtk
from gi.repository... | python | def wait_for_update(self, trigger_update=False):
"""Update canvas and handle all events in the gtk queue
:param bool trigger_update: Whether to call update_now() or not
"""
if trigger_update:
self.update_now()
from gi.repository import Gtk
from gi.repository... | [
"def",
"wait_for_update",
"(",
"self",
",",
"trigger_update",
"=",
"False",
")",
":",
"if",
"trigger_update",
":",
"self",
".",
"update_now",
"(",
")",
"from",
"gi",
".",
"repository",
"import",
"Gtk",
"from",
"gi",
".",
"repository",
"import",
"GLib",
"fr... | Update canvas and handle all events in the gtk queue
:param bool trigger_update: Whether to call update_now() or not | [
"Update",
"canvas",
"and",
"handle",
"all",
"events",
"in",
"the",
"gtk",
"queue"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/canvas.py#L146-L168 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/canvas.py | ItemProjection._get_value | def _get_value(self):
"""
Return two delegating variables. Each variable should contain
a value attribute with the real value.
"""
x, y = self._point.x, self._point.y
self._px, self._py = self._item_point.canvas.get_matrix_i2i(self._item_point,
... | python | def _get_value(self):
"""
Return two delegating variables. Each variable should contain
a value attribute with the real value.
"""
x, y = self._point.x, self._point.y
self._px, self._py = self._item_point.canvas.get_matrix_i2i(self._item_point,
... | [
"def",
"_get_value",
"(",
"self",
")",
":",
"x",
",",
"y",
"=",
"self",
".",
"_point",
".",
"x",
",",
"self",
".",
"_point",
".",
"y",
"self",
".",
"_px",
",",
"self",
".",
"_py",
"=",
"self",
".",
"_item_point",
".",
"canvas",
".",
"get_matrix_i... | Return two delegating variables. Each variable should contain
a value attribute with the real value. | [
"Return",
"two",
"delegating",
"variables",
".",
"Each",
"variable",
"should",
"contain",
"a",
"value",
"attribute",
"with",
"the",
"real",
"value",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/canvas.py#L211-L219 |
DLR-RM/RAFCON | source/rafcon/utils/type_helpers.py | convert_string_to_type | def convert_string_to_type(string_value):
"""Converts a string into a type or class
:param string_value: the string to be converted, e.g. "int"
:return: The type derived from string_value, e.g. int
"""
# If the parameter is already a type, return it
if string_value in ['None', type(None).__name... | python | def convert_string_to_type(string_value):
"""Converts a string into a type or class
:param string_value: the string to be converted, e.g. "int"
:return: The type derived from string_value, e.g. int
"""
# If the parameter is already a type, return it
if string_value in ['None', type(None).__name... | [
"def",
"convert_string_to_type",
"(",
"string_value",
")",
":",
"# If the parameter is already a type, return it",
"if",
"string_value",
"in",
"[",
"'None'",
",",
"type",
"(",
"None",
")",
".",
"__name__",
"]",
":",
"return",
"type",
"(",
"None",
")",
"if",
"isi... | Converts a string into a type or class
:param string_value: the string to be converted, e.g. "int"
:return: The type derived from string_value, e.g. int | [
"Converts",
"a",
"string",
"into",
"a",
"type",
"or",
"class"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/type_helpers.py#L33-L70 |
DLR-RM/RAFCON | source/rafcon/utils/type_helpers.py | convert_string_value_to_type_value | def convert_string_value_to_type_value(string_value, data_type):
"""Helper function to convert a given string to a given data type
:param str string_value: the string to convert
:param type data_type: the target data type
:return: the converted value
"""
from ast import literal_eval
try:
... | python | def convert_string_value_to_type_value(string_value, data_type):
"""Helper function to convert a given string to a given data type
:param str string_value: the string to convert
:param type data_type: the target data type
:return: the converted value
"""
from ast import literal_eval
try:
... | [
"def",
"convert_string_value_to_type_value",
"(",
"string_value",
",",
"data_type",
")",
":",
"from",
"ast",
"import",
"literal_eval",
"try",
":",
"if",
"data_type",
"in",
"(",
"str",
",",
"type",
"(",
"None",
")",
")",
":",
"converted_value",
"=",
"str",
"(... | Helper function to convert a given string to a given data type
:param str string_value: the string to convert
:param type data_type: the target data type
:return: the converted value | [
"Helper",
"function",
"to",
"convert",
"a",
"given",
"string",
"to",
"a",
"given",
"data",
"type"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/type_helpers.py#L73-L109 |
DLR-RM/RAFCON | source/rafcon/utils/type_helpers.py | type_inherits_of_type | def type_inherits_of_type(inheriting_type, base_type):
"""Checks whether inheriting_type inherits from base_type
:param str inheriting_type:
:param str base_type:
:return: True is base_type is base of inheriting_type
"""
assert isinstance(inheriting_type, type) or isclass(inheriting_type)
a... | python | def type_inherits_of_type(inheriting_type, base_type):
"""Checks whether inheriting_type inherits from base_type
:param str inheriting_type:
:param str base_type:
:return: True is base_type is base of inheriting_type
"""
assert isinstance(inheriting_type, type) or isclass(inheriting_type)
a... | [
"def",
"type_inherits_of_type",
"(",
"inheriting_type",
",",
"base_type",
")",
":",
"assert",
"isinstance",
"(",
"inheriting_type",
",",
"type",
")",
"or",
"isclass",
"(",
"inheriting_type",
")",
"assert",
"isinstance",
"(",
"base_type",
",",
"type",
")",
"or",
... | Checks whether inheriting_type inherits from base_type
:param str inheriting_type:
:param str base_type:
:return: True is base_type is base of inheriting_type | [
"Checks",
"whether",
"inheriting_type",
"inherits",
"from",
"base_type"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/type_helpers.py#L112-L127 |
openego/eTraGo | etrago/tools/io.py | clear_results_db | def clear_results_db(session):
'''Used to clear the result tables in the OEDB. Caution!
This deletes EVERY RESULT SET!'''
from egoio.db_tables.model_draft import EgoGridPfHvResultBus as BusResult,\
EgoGridPfHvResultBusT as BusTResult,\
EgoGridPfHvResultStorage as StorageResult,\
... | python | def clear_results_db(session):
'''Used to clear the result tables in the OEDB. Caution!
This deletes EVERY RESULT SET!'''
from egoio.db_tables.model_draft import EgoGridPfHvResultBus as BusResult,\
EgoGridPfHvResultBusT as BusTResult,\
EgoGridPfHvResultStorage as StorageResult,\
... | [
"def",
"clear_results_db",
"(",
"session",
")",
":",
"from",
"egoio",
".",
"db_tables",
".",
"model_draft",
"import",
"EgoGridPfHvResultBus",
"as",
"BusResult",
",",
"EgoGridPfHvResultBusT",
"as",
"BusTResult",
",",
"EgoGridPfHvResultStorage",
"as",
"StorageResult",
"... | Used to clear the result tables in the OEDB. Caution!
This deletes EVERY RESULT SET! | [
"Used",
"to",
"clear",
"the",
"result",
"tables",
"in",
"the",
"OEDB",
".",
"Caution!",
"This",
"deletes",
"EVERY",
"RESULT",
"SET!"
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L407-L452 |
openego/eTraGo | etrago/tools/io.py | results_to_oedb | def results_to_oedb(session, network, args, grid='hv', safe_results=False):
"""Return results obtained from PyPSA to oedb
Parameters
----------
session:
network : PyPSA network container
Holds topology of grid including results from powerflow analysis
args: dict
Settings from a... | python | def results_to_oedb(session, network, args, grid='hv', safe_results=False):
"""Return results obtained from PyPSA to oedb
Parameters
----------
session:
network : PyPSA network container
Holds topology of grid including results from powerflow analysis
args: dict
Settings from a... | [
"def",
"results_to_oedb",
"(",
"session",
",",
"network",
",",
"args",
",",
"grid",
"=",
"'hv'",
",",
"safe_results",
"=",
"False",
")",
":",
"# Update generator_ids when k_means clustering to get integer ids",
"if",
"args",
"[",
"'network_clustering_kmeans'",
"]",
"!... | Return results obtained from PyPSA to oedb
Parameters
----------
session:
network : PyPSA network container
Holds topology of grid including results from powerflow analysis
args: dict
Settings from appl.py
grid: str
Choose voltage-level, currently only 'hv' implemented
... | [
"Return",
"results",
"obtained",
"from",
"PyPSA",
"to",
"oedb"
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L455-L690 |
openego/eTraGo | etrago/tools/io.py | run_sql_script | def run_sql_script(conn, scriptname='results_md2grid.sql'):
"""This function runs .sql scripts in the folder 'sql_scripts' """
script_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__), 'sql_scripts'))
script_str = open(os.path.join(script_dir, scriptname)).read()
conn.execution_opti... | python | def run_sql_script(conn, scriptname='results_md2grid.sql'):
"""This function runs .sql scripts in the folder 'sql_scripts' """
script_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__), 'sql_scripts'))
script_str = open(os.path.join(script_dir, scriptname)).read()
conn.execution_opti... | [
"def",
"run_sql_script",
"(",
"conn",
",",
"scriptname",
"=",
"'results_md2grid.sql'",
")",
":",
"script_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",... | This function runs .sql scripts in the folder 'sql_scripts' | [
"This",
"function",
"runs",
".",
"sql",
"scripts",
"in",
"the",
"folder",
"sql_scripts"
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L693-L701 |
openego/eTraGo | etrago/tools/io.py | extension | def extension (network, session, version, scn_extension, start_snapshot,
end_snapshot, **kwargs):
"""
Function that adds an additional network to the existing network container.
The new network can include every PyPSA-component (e.g. buses, lines, links).
To connect it to the existing ... | python | def extension (network, session, version, scn_extension, start_snapshot,
end_snapshot, **kwargs):
"""
Function that adds an additional network to the existing network container.
The new network can include every PyPSA-component (e.g. buses, lines, links).
To connect it to the existing ... | [
"def",
"extension",
"(",
"network",
",",
"session",
",",
"version",
",",
"scn_extension",
",",
"start_snapshot",
",",
"end_snapshot",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"version",
"is",
"None",
":",
"ormcls_prefix",
"=",
"'EgoGridPfHvExtension'",
"else",... | Function that adds an additional network to the existing network container.
The new network can include every PyPSA-component (e.g. buses, lines, links).
To connect it to the existing network, transformers are needed.
All components and its timeseries of the additional scenario need to be insert... | [
"Function",
"that",
"adds",
"an",
"additional",
"network",
"to",
"the",
"existing",
"network",
"container",
".",
"The",
"new",
"network",
"can",
"include",
"every",
"PyPSA",
"-",
"component",
"(",
"e",
".",
"g",
".",
"buses",
"lines",
"links",
")",
".",
... | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L705-L764 |
openego/eTraGo | etrago/tools/io.py | decommissioning | def decommissioning(network, session, args, **kwargs):
"""
Function that removes components in a decommissioning-scenario from
the existing network container.
Currently, only lines can be decommissioned.
All components of the decommissioning scenario need to be inserted in
the fi... | python | def decommissioning(network, session, args, **kwargs):
"""
Function that removes components in a decommissioning-scenario from
the existing network container.
Currently, only lines can be decommissioned.
All components of the decommissioning scenario need to be inserted in
the fi... | [
"def",
"decommissioning",
"(",
"network",
",",
"session",
",",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
"[",
"'gridversion'",
"]",
"==",
"None",
":",
"ormclass",
"=",
"getattr",
"(",
"import_module",
"(",
"'egoio.db_tables.model_draft'",
")",... | Function that removes components in a decommissioning-scenario from
the existing network container.
Currently, only lines can be decommissioned.
All components of the decommissioning scenario need to be inserted in
the fitting 'model_draft.ego_grid_pf_hv_extension_' table.
The scn_n... | [
"Function",
"that",
"removes",
"components",
"in",
"a",
"decommissioning",
"-",
"scenario",
"from",
"the",
"existing",
"network",
"container",
".",
"Currently",
"only",
"lines",
"can",
"be",
"decommissioned",
".",
"All",
"components",
"of",
"the",
"decommissioning... | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L766-L828 |
openego/eTraGo | etrago/tools/io.py | distance | def distance(x0, x1, y0, y1):
"""
Function that calculates the square of the distance between two points.
Parameters
-----
x0: x - coordinate of point 0
x1: x - coordinate of point 1
y0: y - coordinate of point 0
y1: y - coordinate of point 1
Returns
-----... | python | def distance(x0, x1, y0, y1):
"""
Function that calculates the square of the distance between two points.
Parameters
-----
x0: x - coordinate of point 0
x1: x - coordinate of point 1
y0: y - coordinate of point 0
y1: y - coordinate of point 1
Returns
-----... | [
"def",
"distance",
"(",
"x0",
",",
"x1",
",",
"y0",
",",
"y1",
")",
":",
"# Calculate square of the distance between two points (Pythagoras)",
"distance",
"=",
"(",
"x1",
".",
"values",
"-",
"x0",
".",
"values",
")",
"*",
"(",
"x1",
".",
"values",
"-",
"x0... | Function that calculates the square of the distance between two points.
Parameters
-----
x0: x - coordinate of point 0
x1: x - coordinate of point 1
y0: y - coordinate of point 0
y1: y - coordinate of point 1
Returns
------
distance : float
square ... | [
"Function",
"that",
"calculates",
"the",
"square",
"of",
"the",
"distance",
"between",
"two",
"points",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L831-L853 |
openego/eTraGo | etrago/tools/io.py | calc_nearest_point | def calc_nearest_point(bus1, network):
"""
Function that finds the geographical nearest point in a network from a given bus.
Parameters
-----
bus1: float
id of bus
network: Pypsa network container
network including the comparable buses
Returns
------
... | python | def calc_nearest_point(bus1, network):
"""
Function that finds the geographical nearest point in a network from a given bus.
Parameters
-----
bus1: float
id of bus
network: Pypsa network container
network including the comparable buses
Returns
------
... | [
"def",
"calc_nearest_point",
"(",
"bus1",
",",
"network",
")",
":",
"bus1_index",
"=",
"network",
".",
"buses",
".",
"index",
"[",
"network",
".",
"buses",
".",
"index",
"==",
"bus1",
"]",
"forbidden_buses",
"=",
"np",
".",
"append",
"(",
"bus1_index",
"... | Function that finds the geographical nearest point in a network from a given bus.
Parameters
-----
bus1: float
id of bus
network: Pypsa network container
network including the comparable buses
Returns
------
bus0 : float
bus_id of nearest point | [
"Function",
"that",
"finds",
"the",
"geographical",
"nearest",
"point",
"in",
"a",
"network",
"from",
"a",
"given",
"bus",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L856-L912 |
openego/eTraGo | etrago/tools/io.py | ScenarioBase.map_ormclass | def map_ormclass(self, name):
""" Populate _mapped attribute with orm class
Parameters
----------
name : str
Component part of orm class name. Concatenated with _prefix.
"""
try:
self._mapped[name] = getattr(self._pkg, self._prefix + name)
... | python | def map_ormclass(self, name):
""" Populate _mapped attribute with orm class
Parameters
----------
name : str
Component part of orm class name. Concatenated with _prefix.
"""
try:
self._mapped[name] = getattr(self._pkg, self._prefix + name)
... | [
"def",
"map_ormclass",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"self",
".",
"_mapped",
"[",
"name",
"]",
"=",
"getattr",
"(",
"self",
".",
"_pkg",
",",
"self",
".",
"_prefix",
"+",
"name",
")",
"except",
"AttributeError",
":",
"print",
"(",
... | Populate _mapped attribute with orm class
Parameters
----------
name : str
Component part of orm class name. Concatenated with _prefix. | [
"Populate",
"_mapped",
"attribute",
"with",
"orm",
"class"
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L127-L140 |
openego/eTraGo | etrago/tools/io.py | NetworkScenario.configure_timeindex | def configure_timeindex(self):
""" Construct a DateTimeIndex with the queried temporal resolution,
start- and end_snapshot. """
try:
ormclass = self._mapped['TempResolution']
if self.version:
tr = self.session.query(ormclass).filter(
... | python | def configure_timeindex(self):
""" Construct a DateTimeIndex with the queried temporal resolution,
start- and end_snapshot. """
try:
ormclass = self._mapped['TempResolution']
if self.version:
tr = self.session.query(ormclass).filter(
... | [
"def",
"configure_timeindex",
"(",
"self",
")",
":",
"try",
":",
"ormclass",
"=",
"self",
".",
"_mapped",
"[",
"'TempResolution'",
"]",
"if",
"self",
".",
"version",
":",
"tr",
"=",
"self",
".",
"session",
".",
"query",
"(",
"ormclass",
")",
".",
"filt... | Construct a DateTimeIndex with the queried temporal resolution,
start- and end_snapshot. | [
"Construct",
"a",
"DateTimeIndex",
"with",
"the",
"queried",
"temporal",
"resolution",
"start",
"-",
"and",
"end_snapshot",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L186-L210 |
openego/eTraGo | etrago/tools/io.py | NetworkScenario.fetch_by_relname | def fetch_by_relname(self, name):
""" Construct DataFrame with component data from filtered table data.
Parameters
----------
name : str
Component name.
Returns
-------
pd.DataFrame
Component data.
"""
ormclass = self._ma... | python | def fetch_by_relname(self, name):
""" Construct DataFrame with component data from filtered table data.
Parameters
----------
name : str
Component name.
Returns
-------
pd.DataFrame
Component data.
"""
ormclass = self._ma... | [
"def",
"fetch_by_relname",
"(",
"self",
",",
"name",
")",
":",
"ormclass",
"=",
"self",
".",
"_mapped",
"[",
"name",
"]",
"query",
"=",
"self",
".",
"session",
".",
"query",
"(",
"ormclass",
")",
"if",
"name",
"!=",
"carr_ormclass",
":",
"query",
"=",
... | Construct DataFrame with component data from filtered table data.
Parameters
----------
name : str
Component name.
Returns
-------
pd.DataFrame
Component data. | [
"Construct",
"DataFrame",
"with",
"component",
"data",
"from",
"filtered",
"table",
"data",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L223-L262 |
openego/eTraGo | etrago/tools/io.py | NetworkScenario.series_fetch_by_relname | def series_fetch_by_relname(self, name, column):
""" Construct DataFrame with component timeseries data from filtered
table data.
Parameters
----------
name : str
Component name.
column : str
Component field with timevarying data.
Returns... | python | def series_fetch_by_relname(self, name, column):
""" Construct DataFrame with component timeseries data from filtered
table data.
Parameters
----------
name : str
Component name.
column : str
Component field with timevarying data.
Returns... | [
"def",
"series_fetch_by_relname",
"(",
"self",
",",
"name",
",",
"column",
")",
":",
"ormclass",
"=",
"self",
".",
"_mapped",
"[",
"name",
"]",
"# TODO: This is implemented in a not very robust way.",
"id_column",
"=",
"re",
".",
"findall",
"(",
"r'[A-Z][^A-Z]*'",
... | Construct DataFrame with component timeseries data from filtered
table data.
Parameters
----------
name : str
Component name.
column : str
Component field with timevarying data.
Returns
-------
pd.DataFrame
Component d... | [
"Construct",
"DataFrame",
"with",
"component",
"timeseries",
"data",
"from",
"filtered",
"table",
"data",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L264-L313 |
openego/eTraGo | etrago/tools/io.py | NetworkScenario.build_network | def build_network(self, network=None, *args, **kwargs):
""" Core method to construct PyPSA Network object.
"""
# TODO: build_network takes care of divergences in database design and
# future PyPSA changes from PyPSA's v0.6 on. This concept should be
# replaced, when the oedb has... | python | def build_network(self, network=None, *args, **kwargs):
""" Core method to construct PyPSA Network object.
"""
# TODO: build_network takes care of divergences in database design and
# future PyPSA changes from PyPSA's v0.6 on. This concept should be
# replaced, when the oedb has... | [
"def",
"build_network",
"(",
"self",
",",
"network",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: build_network takes care of divergences in database design and",
"# future PyPSA changes from PyPSA's v0.6 on. This concept should be",
"# replaced, w... | Core method to construct PyPSA Network object. | [
"Core",
"method",
"to",
"construct",
"PyPSA",
"Network",
"object",
"."
] | train | https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L315-L404 |
DLR-RM/RAFCON | source/rafcon/core/states/preemptive_concurrency_state.py | PreemptiveConcurrencyState.run | def run(self):
""" This defines the sequence of actions that are taken when the preemptive concurrency state is executed
:return:
"""
logger.debug("Starting execution of {0}{1}".format(self, " (backwards)" if self.backward_execution else ""))
self.setup_run()
try:
... | python | def run(self):
""" This defines the sequence of actions that are taken when the preemptive concurrency state is executed
:return:
"""
logger.debug("Starting execution of {0}{1}".format(self, " (backwards)" if self.backward_execution else ""))
self.setup_run()
try:
... | [
"def",
"run",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Starting execution of {0}{1}\"",
".",
"format",
"(",
"self",
",",
"\" (backwards)\"",
"if",
"self",
".",
"backward_execution",
"else",
"\"\"",
")",
")",
"self",
".",
"setup_run",
"(",
")",
... | This defines the sequence of actions that are taken when the preemptive concurrency state is executed
:return: | [
"This",
"defines",
"the",
"sequence",
"of",
"actions",
"that",
"are",
"taken",
"when",
"the",
"preemptive",
"concurrency",
"state",
"is",
"executed"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/preemptive_concurrency_state.py#L45-L108 |
DLR-RM/RAFCON | source/rafcon/core/states/preemptive_concurrency_state.py | PreemptiveConcurrencyState._check_transition_validity | def _check_transition_validity(self, check_transition):
""" Transition of BarrierConcurrencyStates must least fulfill the condition of a ContainerState.
Start transitions are forbidden in the ConcurrencyState
:param check_transition: the transition to check for validity
:return:
... | python | def _check_transition_validity(self, check_transition):
""" Transition of BarrierConcurrencyStates must least fulfill the condition of a ContainerState.
Start transitions are forbidden in the ConcurrencyState
:param check_transition: the transition to check for validity
:return:
... | [
"def",
"_check_transition_validity",
"(",
"self",
",",
"check_transition",
")",
":",
"valid",
",",
"message",
"=",
"super",
"(",
"PreemptiveConcurrencyState",
",",
"self",
")",
".",
"_check_transition_validity",
"(",
"check_transition",
")",
"if",
"not",
"valid",
... | Transition of BarrierConcurrencyStates must least fulfill the condition of a ContainerState.
Start transitions are forbidden in the ConcurrencyState
:param check_transition: the transition to check for validity
:return: | [
"Transition",
"of",
"BarrierConcurrencyStates",
"must",
"least",
"fulfill",
"the",
"condition",
"of",
"a",
"ContainerState",
".",
"Start",
"transitions",
"are",
"forbidden",
"in",
"the",
"ConcurrencyState"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/preemptive_concurrency_state.py#L110-L126 |
DLR-RM/RAFCON | source/rafcon/gui/models/modification_history.py | ModificationsHistoryModel.prepare_destruction | def prepare_destruction(self):
"""Prepares the model for destruction
Un-registers itself as observer from the state machine and the root state
"""
try:
self.relieve_model(self.state_machine_model)
assert self.__buffered_root_state_model is self.state_machine_mode... | python | def prepare_destruction(self):
"""Prepares the model for destruction
Un-registers itself as observer from the state machine and the root state
"""
try:
self.relieve_model(self.state_machine_model)
assert self.__buffered_root_state_model is self.state_machine_mode... | [
"def",
"prepare_destruction",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"relieve_model",
"(",
"self",
".",
"state_machine_model",
")",
"assert",
"self",
".",
"__buffered_root_state_model",
"is",
"self",
".",
"state_machine_model",
".",
"root_state",
"self",
... | Prepares the model for destruction
Un-registers itself as observer from the state machine and the root state | [
"Prepares",
"the",
"model",
"for",
"destruction"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/models/modification_history.py#L121-L141 |
DLR-RM/RAFCON | source/rafcon/gui/models/modification_history.py | ModificationsHistoryModel.recover_specific_version | def recover_specific_version(self, pointer_on_version_to_recover):
""" Recovers a specific version of the all_time_history element by doing several undos and redos.
:param pointer_on_version_to_recover: the id of the list element which is to recover
:return:
"""
# search for tra... | python | def recover_specific_version(self, pointer_on_version_to_recover):
""" Recovers a specific version of the all_time_history element by doing several undos and redos.
:param pointer_on_version_to_recover: the id of the list element which is to recover
:return:
"""
# search for tra... | [
"def",
"recover_specific_version",
"(",
"self",
",",
"pointer_on_version_to_recover",
")",
":",
"# search for traceable path -> list of action to undo and list of action to redo",
"logger",
".",
"info",
"(",
"\"Going to history status #{0}\"",
".",
"format",
"(",
"pointer_on_versio... | Recovers a specific version of the all_time_history element by doing several undos and redos.
:param pointer_on_version_to_recover: the id of the list element which is to recover
:return: | [
"Recovers",
"a",
"specific",
"version",
"of",
"the",
"all_time_history",
"element",
"by",
"doing",
"several",
"undos",
"and",
"redos",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/models/modification_history.py#L153-L178 |
DLR-RM/RAFCON | source/rafcon/gui/models/modification_history.py | ModificationsHistoryModel.assign_notification_states_after | def assign_notification_states_after(self, model, prop_name, info):
"""
This method is called, when any state, transition, data flow, etc. within the state machine modifications. This
then typically requires a redraw of the graphical editor, to display these modifications immediately.
:p... | python | def assign_notification_states_after(self, model, prop_name, info):
"""
This method is called, when any state, transition, data flow, etc. within the state machine modifications. This
then typically requires a redraw of the graphical editor, to display these modifications immediately.
:p... | [
"def",
"assign_notification_states_after",
"(",
"self",
",",
"model",
",",
"prop_name",
",",
"info",
")",
":",
"# logger.verbose(\"states_after: \" + str(NotificationOverview(info, False, self.__class__.__name__)))",
"if",
"self",
".",
"busy",
"or",
"info",
".",
"method_name"... | This method is called, when any state, transition, data flow, etc. within the state machine modifications. This
then typically requires a redraw of the graphical editor, to display these modifications immediately.
:param model: The state machine model
:param prop_name: The property that was chan... | [
"This",
"method",
"is",
"called",
"when",
"any",
"state",
"transition",
"data",
"flow",
"etc",
".",
"within",
"the",
"state",
"machine",
"modifications",
".",
"This",
"then",
"typically",
"requires",
"a",
"redraw",
"of",
"the",
"graphical",
"editor",
"to",
"... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/models/modification_history.py#L684-L727 |
DLR-RM/RAFCON | source/rafcon/gui/models/modification_history.py | ModificationsHistory.get_undo_redo_list_from_active_trail_history_item_to_version_id | def get_undo_redo_list_from_active_trail_history_item_to_version_id(self, version_id):
"""Perform fast search from currently active branch to specific version_id and collect all recovery steps.
"""
all_trail_action = [a.version_id for a in self.single_trail_history() if a is not None]
al... | python | def get_undo_redo_list_from_active_trail_history_item_to_version_id(self, version_id):
"""Perform fast search from currently active branch to specific version_id and collect all recovery steps.
"""
all_trail_action = [a.version_id for a in self.single_trail_history() if a is not None]
al... | [
"def",
"get_undo_redo_list_from_active_trail_history_item_to_version_id",
"(",
"self",
",",
"version_id",
")",
":",
"all_trail_action",
"=",
"[",
"a",
".",
"version_id",
"for",
"a",
"in",
"self",
".",
"single_trail_history",
"(",
")",
"if",
"a",
"is",
"not",
"None... | Perform fast search from currently active branch to specific version_id and collect all recovery steps. | [
"Perform",
"fast",
"search",
"from",
"currently",
"active",
"branch",
"to",
"specific",
"version_id",
"and",
"collect",
"all",
"recovery",
"steps",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/models/modification_history.py#L1019-L1067 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/main_window.py | MainWindowController.set_pane_position | def set_pane_position(self, config_id):
"""Adjusts the position of a GTK Pane to a value stored in the runtime config file. If there was no value
stored, the pane's position is set to a default value.
:param config_id: The pane identifier saved in the runtime config file
"""
def... | python | def set_pane_position(self, config_id):
"""Adjusts the position of a GTK Pane to a value stored in the runtime config file. If there was no value
stored, the pane's position is set to a default value.
:param config_id: The pane identifier saved in the runtime config file
"""
def... | [
"def",
"set_pane_position",
"(",
"self",
",",
"config_id",
")",
":",
"default_pos",
"=",
"constants",
".",
"DEFAULT_PANE_POS",
"[",
"config_id",
"]",
"position",
"=",
"global_runtime_config",
".",
"get_config_value",
"(",
"config_id",
",",
"default_pos",
")",
"pan... | Adjusts the position of a GTK Pane to a value stored in the runtime config file. If there was no value
stored, the pane's position is set to a default value.
:param config_id: The pane identifier saved in the runtime config file | [
"Adjusts",
"the",
"position",
"of",
"a",
"GTK",
"Pane",
"to",
"a",
"value",
"stored",
"in",
"the",
"runtime",
"config",
"file",
".",
"If",
"there",
"was",
"no",
"value",
"stored",
"the",
"pane",
"s",
"position",
"is",
"set",
"to",
"a",
"default",
"valu... | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/main_window.py#L350-L359 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/main_window.py | MainWindowController.model_changed | def model_changed(self, model, prop_name, info):
""" Highlight buttons according actual execution status. Furthermore it triggers the label redraw of the active
state machine.
"""
# TODO: find nice solution
# this in only required if the GUI is terminated via Ctrl+C signal
... | python | def model_changed(self, model, prop_name, info):
""" Highlight buttons according actual execution status. Furthermore it triggers the label redraw of the active
state machine.
"""
# TODO: find nice solution
# this in only required if the GUI is terminated via Ctrl+C signal
... | [
"def",
"model_changed",
"(",
"self",
",",
"model",
",",
"prop_name",
",",
"info",
")",
":",
"# TODO: find nice solution",
"# this in only required if the GUI is terminated via Ctrl+C signal",
"if",
"not",
"self",
".",
"view",
":",
"# this means that the main window is current... | Highlight buttons according actual execution status. Furthermore it triggers the label redraw of the active
state machine. | [
"Highlight",
"buttons",
"according",
"actual",
"execution",
"status",
".",
"Furthermore",
"it",
"triggers",
"the",
"label",
"redraw",
"of",
"the",
"active",
"state",
"machine",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/main_window.py#L362-L390 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/main_window.py | MainWindowController.focus_notebook_page_of_controller | def focus_notebook_page_of_controller(self, controller):
"""Puts the focus on the given child controller
The method implements focus request of the notebooks in left side-bar of the main window. Thereby it is the
master-function of focus pattern of the notebooks in left side-bar.
Actua... | python | def focus_notebook_page_of_controller(self, controller):
"""Puts the focus on the given child controller
The method implements focus request of the notebooks in left side-bar of the main window. Thereby it is the
master-function of focus pattern of the notebooks in left side-bar.
Actua... | [
"def",
"focus_notebook_page_of_controller",
"(",
"self",
",",
"controller",
")",
":",
"# TODO think about to may substitute Controller- by View-objects it is may the better design",
"if",
"controller",
"not",
"in",
"self",
".",
"get_child_controllers",
"(",
")",
":",
"return",
... | Puts the focus on the given child controller
The method implements focus request of the notebooks in left side-bar of the main window. Thereby it is the
master-function of focus pattern of the notebooks in left side-bar.
Actual pattern is:
* Execution-History is put to focus any time r... | [
"Puts",
"the",
"focus",
"on",
"the",
"given",
"child",
"controller"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/main_window.py#L408-L432 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/main_window.py | MainWindowController.undock_sidebar | def undock_sidebar(self, window_key, widget=None, event=None):
"""Undock/separate sidebar into independent window
The sidebar is undocked and put into a separate new window. The sidebar is hidden in the main-window by
triggering the method on_[widget_name]_hide_clicked(). Triggering this method... | python | def undock_sidebar(self, window_key, widget=None, event=None):
"""Undock/separate sidebar into independent window
The sidebar is undocked and put into a separate new window. The sidebar is hidden in the main-window by
triggering the method on_[widget_name]_hide_clicked(). Triggering this method... | [
"def",
"undock_sidebar",
"(",
"self",
",",
"window_key",
",",
"widget",
"=",
"None",
",",
"event",
"=",
"None",
")",
":",
"undocked_window_name",
"=",
"window_key",
".",
"lower",
"(",
")",
"+",
"'_window'",
"widget_name",
"=",
"window_key",
".",
"lower",
"... | Undock/separate sidebar into independent window
The sidebar is undocked and put into a separate new window. The sidebar is hidden in the main-window by
triggering the method on_[widget_name]_hide_clicked(). Triggering this method shows the
[widget_name]_return_button in the main-window, which d... | [
"Undock",
"/",
"separate",
"sidebar",
"into",
"independent",
"window"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/main_window.py#L470-L499 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/main_window.py | MainWindowController.redock_sidebar | def redock_sidebar(self, window_key, sidebar_name, controller_name, widget, event=None):
"""Redock/embed sidebar into main window
The size & position of the open window are saved to the runtime_config file, the sidebar is redocked back
to the main-window, and the left-bar window is hidden. The ... | python | def redock_sidebar(self, window_key, sidebar_name, controller_name, widget, event=None):
"""Redock/embed sidebar into main window
The size & position of the open window are saved to the runtime_config file, the sidebar is redocked back
to the main-window, and the left-bar window is hidden. The ... | [
"def",
"redock_sidebar",
"(",
"self",
",",
"window_key",
",",
"sidebar_name",
",",
"controller_name",
",",
"widget",
",",
"event",
"=",
"None",
")",
":",
"config_parameter_undocked",
"=",
"window_key",
"+",
"'_WINDOW_UNDOCKED'",
"config_id_for_pane_position",
"=",
"... | Redock/embed sidebar into main window
The size & position of the open window are saved to the runtime_config file, the sidebar is redocked back
to the main-window, and the left-bar window is hidden. The undock button of the bar is made visible again. | [
"Redock",
"/",
"embed",
"sidebar",
"into",
"main",
"window"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/main_window.py#L501-L526 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/main_window.py | MainWindowController.on_notebook_tab_switch | def on_notebook_tab_switch(self, notebook, page, page_num, title_label, window, notebook_identifier):
"""Triggered whenever a left-bar notebook tab is changed.
Updates the title of the corresponding notebook and updates the title of the left-bar window in case un-docked.
:param notebook: The G... | python | def on_notebook_tab_switch(self, notebook, page, page_num, title_label, window, notebook_identifier):
"""Triggered whenever a left-bar notebook tab is changed.
Updates the title of the corresponding notebook and updates the title of the left-bar window in case un-docked.
:param notebook: The G... | [
"def",
"on_notebook_tab_switch",
"(",
"self",
",",
"notebook",
",",
"page",
",",
"page_num",
",",
"title_label",
",",
"window",
",",
"notebook_identifier",
")",
":",
"title",
"=",
"gui_helper_label",
".",
"set_notebook_title",
"(",
"notebook",
",",
"page_num",
"... | Triggered whenever a left-bar notebook tab is changed.
Updates the title of the corresponding notebook and updates the title of the left-bar window in case un-docked.
:param notebook: The GTK notebook where a tab-change occurred
:param page_num: The page number of the currently-selected tab
... | [
"Triggered",
"whenever",
"a",
"left",
"-",
"bar",
"notebook",
"tab",
"is",
"changed",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/main_window.py#L575-L588 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/main_window.py | MainWindowController._on_key_press | def _on_key_press(self, widget, event):
"""Updates the currently pressed keys
In addition, the sidebars are toggled if <Ctrl><Tab> is pressed.
:param Gtk.Widget widget: The main window
:param Gdk.Event event: The key press event
"""
self.currently_pressed_keys.add(event... | python | def _on_key_press(self, widget, event):
"""Updates the currently pressed keys
In addition, the sidebars are toggled if <Ctrl><Tab> is pressed.
:param Gtk.Widget widget: The main window
:param Gdk.Event event: The key press event
"""
self.currently_pressed_keys.add(event... | [
"def",
"_on_key_press",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"self",
".",
"currently_pressed_keys",
".",
"add",
"(",
"event",
".",
"keyval",
")",
"if",
"event",
".",
"keyval",
"in",
"[",
"Gdk",
".",
"KEY_Tab",
",",
"Gdk",
".",
"KEY_ISO_L... | Updates the currently pressed keys
In addition, the sidebars are toggled if <Ctrl><Tab> is pressed.
:param Gtk.Widget widget: The main window
:param Gdk.Event event: The key press event | [
"Updates",
"the",
"currently",
"pressed",
"keys"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/main_window.py#L627-L637 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/main_window.py | MainWindowController.prepare_destruction | def prepare_destruction(self):
"""Saves current configuration of windows and panes to the runtime config file, before RAFCON is closed."""
plugins.run_hook("pre_destruction")
logger.debug("Saving runtime config to {0}".format(global_runtime_config.config_file_path))
# store pane last p... | python | def prepare_destruction(self):
"""Saves current configuration of windows and panes to the runtime config file, before RAFCON is closed."""
plugins.run_hook("pre_destruction")
logger.debug("Saving runtime config to {0}".format(global_runtime_config.config_file_path))
# store pane last p... | [
"def",
"prepare_destruction",
"(",
"self",
")",
":",
"plugins",
".",
"run_hook",
"(",
"\"pre_destruction\"",
")",
"logger",
".",
"debug",
"(",
"\"Saving runtime config to {0}\"",
".",
"format",
"(",
"global_runtime_config",
".",
"config_file_path",
")",
")",
"# stor... | Saves current configuration of windows and panes to the runtime config file, before RAFCON is closed. | [
"Saves",
"current",
"configuration",
"of",
"windows",
"and",
"panes",
"to",
"the",
"runtime",
"config",
"file",
"before",
"RAFCON",
"is",
"closed",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/main_window.py#L647-L688 |
DLR-RM/RAFCON | source/rafcon/core/states/concurrency_state.py | ConcurrencyState.setup_forward_or_backward_execution | def setup_forward_or_backward_execution(self):
""" Sets up the execution of the concurrency states dependent on if the state is executed forward of backward.
:return:
"""
if self.backward_execution:
# pop the return item of this concurrency state to get the correct scoped da... | python | def setup_forward_or_backward_execution(self):
""" Sets up the execution of the concurrency states dependent on if the state is executed forward of backward.
:return:
"""
if self.backward_execution:
# pop the return item of this concurrency state to get the correct scoped da... | [
"def",
"setup_forward_or_backward_execution",
"(",
"self",
")",
":",
"if",
"self",
".",
"backward_execution",
":",
"# pop the return item of this concurrency state to get the correct scoped data",
"last_history_item",
"=",
"self",
".",
"execution_history",
".",
"pop_last_item",
... | Sets up the execution of the concurrency states dependent on if the state is executed forward of backward.
:return: | [
"Sets",
"up",
"the",
"execution",
"of",
"the",
"concurrency",
"states",
"dependent",
"on",
"if",
"the",
"state",
"is",
"executed",
"forward",
"of",
"backward",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/concurrency_state.py#L61-L78 |
DLR-RM/RAFCON | source/rafcon/core/states/concurrency_state.py | ConcurrencyState.start_child_states | def start_child_states(self, concurrency_history_item, do_not_start_state=None):
""" Utility function to start all child states of the concurrency state.
:param concurrency_history_item: each concurrent child branch gets an execution history stack of this
concurr... | python | def start_child_states(self, concurrency_history_item, do_not_start_state=None):
""" Utility function to start all child states of the concurrency state.
:param concurrency_history_item: each concurrent child branch gets an execution history stack of this
concurr... | [
"def",
"start_child_states",
"(",
"self",
",",
"concurrency_history_item",
",",
"do_not_start_state",
"=",
"None",
")",
":",
"self",
".",
"state_execution_status",
"=",
"StateExecutionStatus",
".",
"EXECUTE_CHILDREN",
"# actually the queue is not needed in the barrier concurren... | Utility function to start all child states of the concurrency state.
:param concurrency_history_item: each concurrent child branch gets an execution history stack of this
concurrency history item
:param do_not_start_state: optionally the id of a state can be pass... | [
"Utility",
"function",
"to",
"start",
"all",
"child",
"states",
"of",
"the",
"concurrency",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/concurrency_state.py#L80-L112 |
DLR-RM/RAFCON | source/rafcon/core/states/concurrency_state.py | ConcurrencyState.join_state | def join_state(self, state, history_index, concurrency_history_item):
""" a utility function to join a state
:param state: the state to join
:param history_index: the index of the execution history stack in the concurrency history item
for the given state
... | python | def join_state(self, state, history_index, concurrency_history_item):
""" a utility function to join a state
:param state: the state to join
:param history_index: the index of the execution history stack in the concurrency history item
for the given state
... | [
"def",
"join_state",
"(",
"self",
",",
"state",
",",
"history_index",
",",
"concurrency_history_item",
")",
":",
"state",
".",
"join",
"(",
")",
"if",
"state",
".",
"backward_execution",
":",
"self",
".",
"backward_execution",
"=",
"True",
"state",
".",
"sta... | a utility function to join a state
:param state: the state to join
:param history_index: the index of the execution history stack in the concurrency history item
for the given state
:param concurrency_history_item: the concurrency history item that stores the exe... | [
"a",
"utility",
"function",
"to",
"join",
"a",
"state"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/concurrency_state.py#L114-L136 |
DLR-RM/RAFCON | source/rafcon/core/states/concurrency_state.py | ConcurrencyState.finalize_backward_execution | def finalize_backward_execution(self):
""" Utility function to finalize the backward execution of the concurrency state.
:return:
"""
# backward_execution needs to be True to signal the parent container state the backward execution
self.backward_execution = True
# pop th... | python | def finalize_backward_execution(self):
""" Utility function to finalize the backward execution of the concurrency state.
:return:
"""
# backward_execution needs to be True to signal the parent container state the backward execution
self.backward_execution = True
# pop th... | [
"def",
"finalize_backward_execution",
"(",
"self",
")",
":",
"# backward_execution needs to be True to signal the parent container state the backward execution",
"self",
".",
"backward_execution",
"=",
"True",
"# pop the ConcurrencyItem as we are leaving the barrier concurrency state",
"la... | Utility function to finalize the backward execution of the concurrency state.
:return: | [
"Utility",
"function",
"to",
"finalize",
"the",
"backward",
"execution",
"of",
"the",
"concurrency",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/concurrency_state.py#L138-L154 |
DLR-RM/RAFCON | source/rafcon/core/states/concurrency_state.py | ConcurrencyState.finalize_concurrency_state | def finalize_concurrency_state(self, outcome):
""" Utility function to finalize the forward execution of the concurrency state.
:param outcome:
:return:
"""
final_outcome = outcome
self.write_output_data()
self.check_output_data_type()
self.execution_hist... | python | def finalize_concurrency_state(self, outcome):
""" Utility function to finalize the forward execution of the concurrency state.
:param outcome:
:return:
"""
final_outcome = outcome
self.write_output_data()
self.check_output_data_type()
self.execution_hist... | [
"def",
"finalize_concurrency_state",
"(",
"self",
",",
"outcome",
")",
":",
"final_outcome",
"=",
"outcome",
"self",
".",
"write_output_data",
"(",
")",
"self",
".",
"check_output_data_type",
"(",
")",
"self",
".",
"execution_history",
".",
"push_return_history_item... | Utility function to finalize the forward execution of the concurrency state.
:param outcome:
:return: | [
"Utility",
"function",
"to",
"finalize",
"the",
"forward",
"execution",
"of",
"the",
"concurrency",
"state",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/concurrency_state.py#L156-L172 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/items/line.py | PerpLine._head_length | def _head_length(self, port):
"""Distance from the center of the port to the perpendicular waypoint"""
if not port:
return 0.
parent_state_v = self.get_parent_state_v()
if parent_state_v is port.parent: # port of connection's parent state
return port.port_size[1]... | python | def _head_length(self, port):
"""Distance from the center of the port to the perpendicular waypoint"""
if not port:
return 0.
parent_state_v = self.get_parent_state_v()
if parent_state_v is port.parent: # port of connection's parent state
return port.port_size[1]... | [
"def",
"_head_length",
"(",
"self",
",",
"port",
")",
":",
"if",
"not",
"port",
":",
"return",
"0.",
"parent_state_v",
"=",
"self",
".",
"get_parent_state_v",
"(",
")",
"if",
"parent_state_v",
"is",
"port",
".",
"parent",
":",
"# port of connection's parent st... | Distance from the center of the port to the perpendicular waypoint | [
"Distance",
"from",
"the",
"center",
"of",
"the",
"port",
"to",
"the",
"perpendicular",
"waypoint"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/items/line.py#L309-L316 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/io_data_port_list.py | DataPortListController.register_view | def register_view(self, view):
"""Called when the View was registered"""
super(DataPortListController, self).register_view(view)
view['name_col'].add_attribute(view['name_text'], 'text', self.NAME_STORAGE_ID)
view['data_type_col'].add_attribute(view['data_type_text'], 'text', self.DATA_... | python | def register_view(self, view):
"""Called when the View was registered"""
super(DataPortListController, self).register_view(view)
view['name_col'].add_attribute(view['name_text'], 'text', self.NAME_STORAGE_ID)
view['data_type_col'].add_attribute(view['data_type_text'], 'text', self.DATA_... | [
"def",
"register_view",
"(",
"self",
",",
"view",
")",
":",
"super",
"(",
"DataPortListController",
",",
"self",
")",
".",
"register_view",
"(",
"view",
")",
"view",
"[",
"'name_col'",
"]",
".",
"add_attribute",
"(",
"view",
"[",
"'name_text'",
"]",
",",
... | 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/state_editor/io_data_port_list.py#L66-L102 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/io_data_port_list.py | DataPortListController.on_use_runtime_value_toggled | def on_use_runtime_value_toggled(self, widget, path):
"""Try to set the use runtime value flag to the newly entered one
"""
try:
data_port_id = self.list_store[path][self.ID_STORAGE_ID]
self.toggle_runtime_value_usage(data_port_id)
except TypeError as e:
... | python | def on_use_runtime_value_toggled(self, widget, path):
"""Try to set the use runtime value flag to the newly entered one
"""
try:
data_port_id = self.list_store[path][self.ID_STORAGE_ID]
self.toggle_runtime_value_usage(data_port_id)
except TypeError as e:
... | [
"def",
"on_use_runtime_value_toggled",
"(",
"self",
",",
"widget",
",",
"path",
")",
":",
"try",
":",
"data_port_id",
"=",
"self",
".",
"list_store",
"[",
"path",
"]",
"[",
"self",
".",
"ID_STORAGE_ID",
"]",
"self",
".",
"toggle_runtime_value_usage",
"(",
"d... | Try to set the use runtime value flag to the newly entered one | [
"Try",
"to",
"set",
"the",
"use",
"runtime",
"value",
"flag",
"to",
"the",
"newly",
"entered",
"one"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/io_data_port_list.py#L124-L131 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/io_data_port_list.py | DataPortListController._default_value_cell_data_func | def _default_value_cell_data_func(self, tree_view_column, cell, model, iter, data=None):
"""Function set renderer properties for every single cell independently
The function controls the editable and color scheme for every cell in the default value column according
the use_runtime_value flag an... | python | def _default_value_cell_data_func(self, tree_view_column, cell, model, iter, data=None):
"""Function set renderer properties for every single cell independently
The function controls the editable and color scheme for every cell in the default value column according
the use_runtime_value flag an... | [
"def",
"_default_value_cell_data_func",
"(",
"self",
",",
"tree_view_column",
",",
"cell",
",",
"model",
",",
"iter",
",",
"data",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"model",
".",
"state",
",",
"LibraryState",
")",
":",
"use_runti... | Function set renderer properties for every single cell independently
The function controls the editable and color scheme for every cell in the default value column according
the use_runtime_value flag and whether the state is a library state.
:param tree_view_column: the Gtk.TreeViewColumn to ... | [
"Function",
"set",
"renderer",
"properties",
"for",
"every",
"single",
"cell",
"independently"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/io_data_port_list.py#L178-L201 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/io_data_port_list.py | DataPortListController._reload_data_port_list_store | def _reload_data_port_list_store(self):
"""Reloads the input data port list store from the data port models"""
tmp = self._get_new_list_store()
for data_port_m in self.data_port_model_list:
data_port_id = data_port_m.data_port.data_port_id
data_type = data_port_m.data_po... | python | def _reload_data_port_list_store(self):
"""Reloads the input data port list store from the data port models"""
tmp = self._get_new_list_store()
for data_port_m in self.data_port_model_list:
data_port_id = data_port_m.data_port.data_port_id
data_type = data_port_m.data_po... | [
"def",
"_reload_data_port_list_store",
"(",
"self",
")",
":",
"tmp",
"=",
"self",
".",
"_get_new_list_store",
"(",
")",
"for",
"data_port_m",
"in",
"self",
".",
"data_port_model_list",
":",
"data_port_id",
"=",
"data_port_m",
".",
"data_port",
".",
"data_port_id",... | Reloads the input data port list store from the data port models | [
"Reloads",
"the",
"input",
"data",
"port",
"list",
"store",
"from",
"the",
"data",
"port",
"models"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/io_data_port_list.py#L203-L243 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/io_data_port_list.py | DataPortListController._apply_new_data_port_name | def _apply_new_data_port_name(self, path, new_name):
"""Applies the new name of the data port defined by path
:param str path: The path identifying the edited data port
:param str new_name: New name
"""
try:
data_port_id = self.list_store[path][self.ID_STORAGE_ID]
... | python | def _apply_new_data_port_name(self, path, new_name):
"""Applies the new name of the data port defined by path
:param str path: The path identifying the edited data port
:param str new_name: New name
"""
try:
data_port_id = self.list_store[path][self.ID_STORAGE_ID]
... | [
"def",
"_apply_new_data_port_name",
"(",
"self",
",",
"path",
",",
"new_name",
")",
":",
"try",
":",
"data_port_id",
"=",
"self",
".",
"list_store",
"[",
"path",
"]",
"[",
"self",
".",
"ID_STORAGE_ID",
"]",
"if",
"self",
".",
"state_data_port_dict",
"[",
"... | Applies the new name of the data port defined by path
:param str path: The path identifying the edited data port
:param str new_name: New name | [
"Applies",
"the",
"new",
"name",
"of",
"the",
"data",
"port",
"defined",
"by",
"path"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/io_data_port_list.py#L245-L256 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/io_data_port_list.py | DataPortListController._apply_new_data_port_type | def _apply_new_data_port_type(self, path, new_data_type_str):
"""Applies the new data type of the data port defined by path
:param str path: The path identifying the edited data port
:param str new_data_type_str: New data type as str
"""
try:
data_port_id = self.list... | python | def _apply_new_data_port_type(self, path, new_data_type_str):
"""Applies the new data type of the data port defined by path
:param str path: The path identifying the edited data port
:param str new_data_type_str: New data type as str
"""
try:
data_port_id = self.list... | [
"def",
"_apply_new_data_port_type",
"(",
"self",
",",
"path",
",",
"new_data_type_str",
")",
":",
"try",
":",
"data_port_id",
"=",
"self",
".",
"list_store",
"[",
"path",
"]",
"[",
"self",
".",
"ID_STORAGE_ID",
"]",
"if",
"self",
".",
"state_data_port_dict",
... | Applies the new data type of the data port defined by path
:param str path: The path identifying the edited data port
:param str new_data_type_str: New data type as str | [
"Applies",
"the",
"new",
"data",
"type",
"of",
"the",
"data",
"port",
"defined",
"by",
"path"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/io_data_port_list.py#L258-L269 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/io_data_port_list.py | DataPortListController._apply_new_data_port_default_value | def _apply_new_data_port_default_value(self, path, new_default_value_str):
"""Applies the new default value of the data port defined by path
:param str path: The path identifying the edited variable
:param str new_default_value_str: New default value as string
"""
try:
... | python | def _apply_new_data_port_default_value(self, path, new_default_value_str):
"""Applies the new default value of the data port defined by path
:param str path: The path identifying the edited variable
:param str new_default_value_str: New default value as string
"""
try:
... | [
"def",
"_apply_new_data_port_default_value",
"(",
"self",
",",
"path",
",",
"new_default_value_str",
")",
":",
"try",
":",
"data_port_id",
"=",
"self",
".",
"list_store",
"[",
"path",
"]",
"[",
"self",
".",
"ID_STORAGE_ID",
"]",
"if",
"isinstance",
"(",
"self"... | Applies the new default value of the data port defined by path
:param str path: The path identifying the edited variable
:param str new_default_value_str: New default value as string | [
"Applies",
"the",
"new",
"default",
"value",
"of",
"the",
"data",
"port",
"defined",
"by",
"path"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/io_data_port_list.py#L271-L288 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/io_data_port_list.py | DataPortListController._data_ports_changed | def _data_ports_changed(self, model):
"""Reload list store and reminds selection when the model was changed"""
if not isinstance(model, AbstractStateModel):
return
# store port selection
path_list = None
if self.view is not None:
model, path_list = self.tr... | python | def _data_ports_changed(self, model):
"""Reload list store and reminds selection when the model was changed"""
if not isinstance(model, AbstractStateModel):
return
# store port selection
path_list = None
if self.view is not None:
model, path_list = self.tr... | [
"def",
"_data_ports_changed",
"(",
"self",
",",
"model",
")",
":",
"if",
"not",
"isinstance",
"(",
"model",
",",
"AbstractStateModel",
")",
":",
"return",
"# store port selection",
"path_list",
"=",
"None",
"if",
"self",
".",
"view",
"is",
"not",
"None",
":"... | Reload list store and reminds selection when the model was changed | [
"Reload",
"list",
"store",
"and",
"reminds",
"selection",
"when",
"the",
"model",
"was",
"changed"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/io_data_port_list.py#L290-L302 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/io_data_port_list.py | InputPortListController.runtime_values_changed | def runtime_values_changed(self, model, prop_name, info):
"""Handle cases for the library runtime values"""
if ("_input_runtime_value" in info.method_name or
info.method_name in ['use_runtime_value_input_data_ports',
'input_data_port_runtime_values'])... | python | def runtime_values_changed(self, model, prop_name, info):
"""Handle cases for the library runtime values"""
if ("_input_runtime_value" in info.method_name or
info.method_name in ['use_runtime_value_input_data_ports',
'input_data_port_runtime_values'])... | [
"def",
"runtime_values_changed",
"(",
"self",
",",
"model",
",",
"prop_name",
",",
"info",
")",
":",
"if",
"(",
"\"_input_runtime_value\"",
"in",
"info",
".",
"method_name",
"or",
"info",
".",
"method_name",
"in",
"[",
"'use_runtime_value_input_data_ports'",
",",
... | Handle cases for the library runtime values | [
"Handle",
"cases",
"for",
"the",
"library",
"runtime",
"values"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/io_data_port_list.py#L325-L331 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/io_data_port_list.py | OutputPortListController.add_new_data_port | def add_new_data_port(self):
"""Add a new port with default values and select it"""
try:
new_data_port_ids = gui_helper_state_machine.add_data_port_to_selected_states('OUTPUT', int, [self.model])
if new_data_port_ids:
self.select_entry(new_data_port_ids[self.model... | python | def add_new_data_port(self):
"""Add a new port with default values and select it"""
try:
new_data_port_ids = gui_helper_state_machine.add_data_port_to_selected_states('OUTPUT', int, [self.model])
if new_data_port_ids:
self.select_entry(new_data_port_ids[self.model... | [
"def",
"add_new_data_port",
"(",
"self",
")",
":",
"try",
":",
"new_data_port_ids",
"=",
"gui_helper_state_machine",
".",
"add_data_port_to_selected_states",
"(",
"'OUTPUT'",
",",
"int",
",",
"[",
"self",
".",
"model",
"]",
")",
"if",
"new_data_port_ids",
":",
"... | Add a new port with default values and select it | [
"Add",
"a",
"new",
"port",
"with",
"default",
"values",
"and",
"select",
"it"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/io_data_port_list.py#L420-L427 |
DLR-RM/RAFCON | source/rafcon/gui/shortcut_manager.py | ShortcutManager.add_callback_for_action | def add_callback_for_action(self, action, callback):
"""Adds a callback function to an action
The method checks whether both action and callback are valid. If so, the callback is added to the list of
functions called when the action is triggered.
:param str action: An action like 'add'... | python | def add_callback_for_action(self, action, callback):
"""Adds a callback function to an action
The method checks whether both action and callback are valid. If so, the callback is added to the list of
functions called when the action is triggered.
:param str action: An action like 'add'... | [
"def",
"add_callback_for_action",
"(",
"self",
",",
"action",
",",
"callback",
")",
":",
"if",
"hasattr",
"(",
"callback",
",",
"'__call__'",
")",
":",
"# Is the callback really a function?",
"if",
"action",
"not",
"in",
"self",
".",
"__action_to_callbacks",
":",
... | Adds a callback function to an action
The method checks whether both action and callback are valid. If so, the callback is added to the list of
functions called when the action is triggered.
:param str action: An action like 'add', 'copy', 'info'
:param callback: A callback function, w... | [
"Adds",
"a",
"callback",
"function",
"to",
"an",
"action"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/shortcut_manager.py#L72-L106 |
DLR-RM/RAFCON | source/rafcon/gui/shortcut_manager.py | ShortcutManager.remove_callback_for_action | def remove_callback_for_action(self, action, callback):
""" Remove a callback for a specific action
This is mainly for cleanup purposes or a plugin that replaces a GUI widget.
:param str action: the cation of which the callback is going to be remove
:param callback: the callback to be ... | python | def remove_callback_for_action(self, action, callback):
""" Remove a callback for a specific action
This is mainly for cleanup purposes or a plugin that replaces a GUI widget.
:param str action: the cation of which the callback is going to be remove
:param callback: the callback to be ... | [
"def",
"remove_callback_for_action",
"(",
"self",
",",
"action",
",",
"callback",
")",
":",
"if",
"action",
"in",
"self",
".",
"__action_to_callbacks",
":",
"if",
"callback",
"in",
"self",
".",
"__action_to_callbacks",
"[",
"action",
"]",
":",
"self",
".",
"... | Remove a callback for a specific action
This is mainly for cleanup purposes or a plugin that replaces a GUI widget.
:param str action: the cation of which the callback is going to be remove
:param callback: the callback to be removed | [
"Remove",
"a",
"callback",
"for",
"a",
"specific",
"action"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/shortcut_manager.py#L108-L118 |
DLR-RM/RAFCON | source/rafcon/gui/shortcut_manager.py | ShortcutManager.trigger_action | def trigger_action(self, action, key_value, modifier_mask):
"""Calls the appropriate callback function(s) for the given action
:param str action: The name of the action that was triggered
:param key_value: The key value of the shortcut that caused the trigger
:param modifier_mask: The m... | python | def trigger_action(self, action, key_value, modifier_mask):
"""Calls the appropriate callback function(s) for the given action
:param str action: The name of the action that was triggered
:param key_value: The key value of the shortcut that caused the trigger
:param modifier_mask: The m... | [
"def",
"trigger_action",
"(",
"self",
",",
"action",
",",
"key_value",
",",
"modifier_mask",
")",
":",
"res",
"=",
"False",
"if",
"action",
"in",
"self",
".",
"__action_to_callbacks",
":",
"for",
"callback_function",
"in",
"self",
".",
"__action_to_callbacks",
... | Calls the appropriate callback function(s) for the given action
:param str action: The name of the action that was triggered
:param key_value: The key value of the shortcut that caused the trigger
:param modifier_mask: The modifier mask of the shortcut that caused the trigger
:return: W... | [
"Calls",
"the",
"appropriate",
"callback",
"function",
"(",
"s",
")",
"for",
"the",
"given",
"action"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/shortcut_manager.py#L138-L156 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/linkage_list.py | LinkageListController.check_info_on_no_update_flags | def check_info_on_no_update_flags(self, info):
"""Stop updates while multi-actions"""
# TODO that could need a second clean up
# avoid updates because of state destruction
if 'before' in info and info['method_name'] == "remove_state":
if info.instance is self.model.state:
... | python | def check_info_on_no_update_flags(self, info):
"""Stop updates while multi-actions"""
# TODO that could need a second clean up
# avoid updates because of state destruction
if 'before' in info and info['method_name'] == "remove_state":
if info.instance is self.model.state:
... | [
"def",
"check_info_on_no_update_flags",
"(",
"self",
",",
"info",
")",
":",
"# TODO that could need a second clean up",
"# avoid updates because of state destruction",
"if",
"'before'",
"in",
"info",
"and",
"info",
"[",
"'method_name'",
"]",
"==",
"\"remove_state\"",
":",
... | Stop updates while multi-actions | [
"Stop",
"updates",
"while",
"multi",
"-",
"actions"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/linkage_list.py#L82-L127 |
DLR-RM/RAFCON | source/rafcon/gui/controllers/state_editor/linkage_list.py | LinkageListController.before_notification_state_machine_observation_control | def before_notification_state_machine_observation_control(self, model, prop_name, info):
"""Check for multi-actions and set respective no update flags. """
if is_execution_status_update_notification_from_state_machine_model(prop_name, info):
return
# do not update while multi-actions... | python | def before_notification_state_machine_observation_control(self, model, prop_name, info):
"""Check for multi-actions and set respective no update flags. """
if is_execution_status_update_notification_from_state_machine_model(prop_name, info):
return
# do not update while multi-actions... | [
"def",
"before_notification_state_machine_observation_control",
"(",
"self",
",",
"model",
",",
"prop_name",
",",
"info",
")",
":",
"if",
"is_execution_status_update_notification_from_state_machine_model",
"(",
"prop_name",
",",
"info",
")",
":",
"return",
"# do not update ... | Check for multi-actions and set respective no update flags. | [
"Check",
"for",
"multi",
"-",
"actions",
"and",
"set",
"respective",
"no",
"update",
"flags",
"."
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/linkage_list.py#L155-L160 |
DLR-RM/RAFCON | source/rafcon/gui/mygaphas/utils/cache/value_cache.py | ValueCache.store_value | def store_value(self, name, value, parameters=None):
"""Stores the value of a certain variable
The value of a variable with name 'name' is stored together with the parameters that were used for the
calculation.
:param str name: The name of the variable
:param value: The value t... | python | def store_value(self, name, value, parameters=None):
"""Stores the value of a certain variable
The value of a variable with name 'name' is stored together with the parameters that were used for the
calculation.
:param str name: The name of the variable
:param value: The value t... | [
"def",
"store_value",
"(",
"self",
",",
"name",
",",
"value",
",",
"parameters",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"parameters",
",",
"dict",
")",
":",
"raise",
"TypeError",
"(",
"\"parameters must be a dict\"",
")",
"hash",
"=",
"self... | Stores the value of a certain variable
The value of a variable with name 'name' is stored together with the parameters that were used for the
calculation.
:param str name: The name of the variable
:param value: The value to be cached
:param dict parameters: The parameters on wh... | [
"Stores",
"the",
"value",
"of",
"a",
"certain",
"variable"
] | train | https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/cache/value_cache.py#L42-L57 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.