repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens listlengths 20 707 | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value | idx int64 0 252k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
inasafe/inasafe | safe/plugin.py | Plugin._create_keywords_wizard_action | def _create_keywords_wizard_action(self):
"""Create action for keywords creation wizard."""
icon = resources_path('img', 'icons', 'show-keyword-wizard.svg')
self.action_keywords_wizard = QAction(
QIcon(icon),
self.tr('Keywords Creation Wizard'),
self.iface.mai... | python | def _create_keywords_wizard_action(self):
"""Create action for keywords creation wizard."""
icon = resources_path('img', 'icons', 'show-keyword-wizard.svg')
self.action_keywords_wizard = QAction(
QIcon(icon),
self.tr('Keywords Creation Wizard'),
self.iface.mai... | [
"def",
"_create_keywords_wizard_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'show-keyword-wizard.svg'",
")",
"self",
".",
"action_keywords_wizard",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
",",
"self"... | Create action for keywords creation wizard. | [
"Create",
"action",
"for",
"keywords",
"creation",
"wizard",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L191-L205 | train | 26,700 |
inasafe/inasafe | safe/plugin.py | Plugin._create_analysis_wizard_action | def _create_analysis_wizard_action(self):
"""Create action for IF-centric wizard."""
icon = resources_path('img', 'icons', 'show-wizard.svg')
self.action_function_centric_wizard = QAction(
QIcon(icon),
self.tr('Impact Function Centric Wizard'),
self.iface.main... | python | def _create_analysis_wizard_action(self):
"""Create action for IF-centric wizard."""
icon = resources_path('img', 'icons', 'show-wizard.svg')
self.action_function_centric_wizard = QAction(
QIcon(icon),
self.tr('Impact Function Centric Wizard'),
self.iface.main... | [
"def",
"_create_analysis_wizard_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'show-wizard.svg'",
")",
"self",
".",
"action_function_centric_wizard",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
",",
"self"... | Create action for IF-centric wizard. | [
"Create",
"action",
"for",
"IF",
"-",
"centric",
"wizard",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L207-L221 | train | 26,701 |
inasafe/inasafe | safe/plugin.py | Plugin._create_options_dialog_action | def _create_options_dialog_action(self):
"""Create action for options dialog."""
icon = resources_path('img', 'icons', 'configure-inasafe.svg')
self.action_options = QAction(
QIcon(icon),
self.tr('Options'), self.iface.mainWindow())
self.action_options.setStatusTi... | python | def _create_options_dialog_action(self):
"""Create action for options dialog."""
icon = resources_path('img', 'icons', 'configure-inasafe.svg')
self.action_options = QAction(
QIcon(icon),
self.tr('Options'), self.iface.mainWindow())
self.action_options.setStatusTi... | [
"def",
"_create_options_dialog_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'configure-inasafe.svg'",
")",
"self",
".",
"action_options",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
",",
"self",
".",
... | Create action for options dialog. | [
"Create",
"action",
"for",
"options",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L223-L234 | train | 26,702 |
inasafe/inasafe | safe/plugin.py | Plugin._create_minimum_needs_action | def _create_minimum_needs_action(self):
"""Create action for minimum needs dialog."""
icon = resources_path('img', 'icons', 'show-minimum-needs.svg')
self.action_minimum_needs = QAction(
QIcon(icon),
self.tr('Minimum Needs Calculator'), self.iface.mainWindow())
se... | python | def _create_minimum_needs_action(self):
"""Create action for minimum needs dialog."""
icon = resources_path('img', 'icons', 'show-minimum-needs.svg')
self.action_minimum_needs = QAction(
QIcon(icon),
self.tr('Minimum Needs Calculator'), self.iface.mainWindow())
se... | [
"def",
"_create_minimum_needs_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'show-minimum-needs.svg'",
")",
"self",
".",
"action_minimum_needs",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
",",
"self",
"... | Create action for minimum needs dialog. | [
"Create",
"action",
"for",
"minimum",
"needs",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L236-L248 | train | 26,703 |
inasafe/inasafe | safe/plugin.py | Plugin._create_multi_buffer_action | def _create_multi_buffer_action(self):
"""Create action for multi buffer dialog."""
icon = resources_path('img', 'icons', 'show-multi-buffer.svg')
self.action_multi_buffer = QAction(
QIcon(icon),
self.tr('Multi Buffer'), self.iface.mainWindow())
self.action_multi_... | python | def _create_multi_buffer_action(self):
"""Create action for multi buffer dialog."""
icon = resources_path('img', 'icons', 'show-multi-buffer.svg')
self.action_multi_buffer = QAction(
QIcon(icon),
self.tr('Multi Buffer'), self.iface.mainWindow())
self.action_multi_... | [
"def",
"_create_multi_buffer_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'show-multi-buffer.svg'",
")",
"self",
".",
"action_multi_buffer",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
",",
"self",
".",... | Create action for multi buffer dialog. | [
"Create",
"action",
"for",
"multi",
"buffer",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L250-L263 | train | 26,704 |
inasafe/inasafe | safe/plugin.py | Plugin._create_minimum_needs_options_action | def _create_minimum_needs_options_action(self):
"""Create action for global minimum needs dialog."""
icon = resources_path('img', 'icons', 'show-global-minimum-needs.svg')
self.action_minimum_needs_config = QAction(
QIcon(icon),
self.tr('Minimum Needs Configuration'),
... | python | def _create_minimum_needs_options_action(self):
"""Create action for global minimum needs dialog."""
icon = resources_path('img', 'icons', 'show-global-minimum-needs.svg')
self.action_minimum_needs_config = QAction(
QIcon(icon),
self.tr('Minimum Needs Configuration'),
... | [
"def",
"_create_minimum_needs_options_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'show-global-minimum-needs.svg'",
")",
"self",
".",
"action_minimum_needs_config",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")"... | Create action for global minimum needs dialog. | [
"Create",
"action",
"for",
"global",
"minimum",
"needs",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L265-L279 | train | 26,705 |
inasafe/inasafe | safe/plugin.py | Plugin._create_shakemap_converter_action | def _create_shakemap_converter_action(self):
"""Create action for converter dialog."""
icon = resources_path('img', 'icons', 'show-converter-tool.svg')
self.action_shake_converter = QAction(
QIcon(icon),
self.tr('Shakemap Converter'), self.iface.mainWindow())
self... | python | def _create_shakemap_converter_action(self):
"""Create action for converter dialog."""
icon = resources_path('img', 'icons', 'show-converter-tool.svg')
self.action_shake_converter = QAction(
QIcon(icon),
self.tr('Shakemap Converter'), self.iface.mainWindow())
self... | [
"def",
"_create_shakemap_converter_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'show-converter-tool.svg'",
")",
"self",
".",
"action_shake_converter",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
",",
"se... | Create action for converter dialog. | [
"Create",
"action",
"for",
"converter",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L281-L294 | train | 26,706 |
inasafe/inasafe | safe/plugin.py | Plugin._create_batch_runner_action | def _create_batch_runner_action(self):
"""Create action for batch runner dialog."""
icon = resources_path('img', 'icons', 'show-batch-runner.svg')
self.action_batch_runner = QAction(
QIcon(icon),
self.tr('Batch Runner'), self.iface.mainWindow())
self.action_batch_... | python | def _create_batch_runner_action(self):
"""Create action for batch runner dialog."""
icon = resources_path('img', 'icons', 'show-batch-runner.svg')
self.action_batch_runner = QAction(
QIcon(icon),
self.tr('Batch Runner'), self.iface.mainWindow())
self.action_batch_... | [
"def",
"_create_batch_runner_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'show-batch-runner.svg'",
")",
"self",
".",
"action_batch_runner",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
",",
"self",
".",... | Create action for batch runner dialog. | [
"Create",
"action",
"for",
"batch",
"runner",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L296-L308 | train | 26,707 |
inasafe/inasafe | safe/plugin.py | Plugin._create_save_scenario_action | def _create_save_scenario_action(self):
"""Create action for save scenario dialog."""
icon = resources_path('img', 'icons', 'save-as-scenario.svg')
self.action_save_scenario = QAction(
QIcon(icon),
self.tr('Save Current Scenario'), self.iface.mainWindow())
message... | python | def _create_save_scenario_action(self):
"""Create action for save scenario dialog."""
icon = resources_path('img', 'icons', 'save-as-scenario.svg')
self.action_save_scenario = QAction(
QIcon(icon),
self.tr('Save Current Scenario'), self.iface.mainWindow())
message... | [
"def",
"_create_save_scenario_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'save-as-scenario.svg'",
")",
"self",
".",
"action_save_scenario",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
",",
"self",
"."... | Create action for save scenario dialog. | [
"Create",
"action",
"for",
"save",
"scenario",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L310-L322 | train | 26,708 |
inasafe/inasafe | safe/plugin.py | Plugin._create_geonode_uploader_action | def _create_geonode_uploader_action(self):
"""Create action for Geonode uploader dialog."""
icon = resources_path('img', 'icons', 'geonode.png')
label = tr('Geonode Uploader')
self.action_geonode = QAction(
QIcon(icon), label, self.iface.mainWindow())
self.action_geon... | python | def _create_geonode_uploader_action(self):
"""Create action for Geonode uploader dialog."""
icon = resources_path('img', 'icons', 'geonode.png')
label = tr('Geonode Uploader')
self.action_geonode = QAction(
QIcon(icon), label, self.iface.mainWindow())
self.action_geon... | [
"def",
"_create_geonode_uploader_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'geonode.png'",
")",
"label",
"=",
"tr",
"(",
"'Geonode Uploader'",
")",
"self",
".",
"action_geonode",
"=",
"QAction",
"(",
"QI... | Create action for Geonode uploader dialog. | [
"Create",
"action",
"for",
"Geonode",
"uploader",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L338-L347 | train | 26,709 |
inasafe/inasafe | safe/plugin.py | Plugin._create_metadata_converter_action | def _create_metadata_converter_action(self):
"""Create action for showing metadata converter dialog."""
icon = resources_path('img', 'icons', 'show-metadata-converter.svg')
self.action_metadata_converter = QAction(
QIcon(icon),
self.tr('InaSAFE Metadata Converter'),
... | python | def _create_metadata_converter_action(self):
"""Create action for showing metadata converter dialog."""
icon = resources_path('img', 'icons', 'show-metadata-converter.svg')
self.action_metadata_converter = QAction(
QIcon(icon),
self.tr('InaSAFE Metadata Converter'),
... | [
"def",
"_create_metadata_converter_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'show-metadata-converter.svg'",
")",
"self",
".",
"action_metadata_converter",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
","... | Create action for showing metadata converter dialog. | [
"Create",
"action",
"for",
"showing",
"metadata",
"converter",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L381-L395 | train | 26,710 |
inasafe/inasafe | safe/plugin.py | Plugin._create_field_mapping_action | def _create_field_mapping_action(self):
"""Create action for showing field mapping dialog."""
icon = resources_path('img', 'icons', 'show-mapping-tool.svg')
self.action_field_mapping = QAction(
QIcon(icon),
self.tr('InaSAFE Field Mapping Tool'),
self.iface.mai... | python | def _create_field_mapping_action(self):
"""Create action for showing field mapping dialog."""
icon = resources_path('img', 'icons', 'show-mapping-tool.svg')
self.action_field_mapping = QAction(
QIcon(icon),
self.tr('InaSAFE Field Mapping Tool'),
self.iface.mai... | [
"def",
"_create_field_mapping_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'show-mapping-tool.svg'",
")",
"self",
".",
"action_field_mapping",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
",",
"self",
".... | Create action for showing field mapping dialog. | [
"Create",
"action",
"for",
"showing",
"field",
"mapping",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L397-L411 | train | 26,711 |
inasafe/inasafe | safe/plugin.py | Plugin._create_multi_exposure_action | def _create_multi_exposure_action(self):
"""Create action for showing the multi exposure tool."""
self.action_multi_exposure = QAction(
QIcon(resources_path('img', 'icons', 'show-multi-exposure.svg')),
self.tr('InaSAFE Multi Exposure Tool'),
self.iface.mainWindow())
... | python | def _create_multi_exposure_action(self):
"""Create action for showing the multi exposure tool."""
self.action_multi_exposure = QAction(
QIcon(resources_path('img', 'icons', 'show-multi-exposure.svg')),
self.tr('InaSAFE Multi Exposure Tool'),
self.iface.mainWindow())
... | [
"def",
"_create_multi_exposure_action",
"(",
"self",
")",
":",
"self",
".",
"action_multi_exposure",
"=",
"QAction",
"(",
"QIcon",
"(",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'show-multi-exposure.svg'",
")",
")",
",",
"self",
".",
"tr",
"(",
"'I... | Create action for showing the multi exposure tool. | [
"Create",
"action",
"for",
"showing",
"the",
"multi",
"exposure",
"tool",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L413-L426 | train | 26,712 |
inasafe/inasafe | safe/plugin.py | Plugin._create_rubber_bands_action | def _create_rubber_bands_action(self):
"""Create action for toggling rubber bands."""
icon = resources_path('img', 'icons', 'toggle-rubber-bands.svg')
self.action_toggle_rubberbands = QAction(
QIcon(icon),
self.tr('Toggle Scenario Outlines'), self.iface.mainWindow())
... | python | def _create_rubber_bands_action(self):
"""Create action for toggling rubber bands."""
icon = resources_path('img', 'icons', 'toggle-rubber-bands.svg')
self.action_toggle_rubberbands = QAction(
QIcon(icon),
self.tr('Toggle Scenario Outlines'), self.iface.mainWindow())
... | [
"def",
"_create_rubber_bands_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'toggle-rubber-bands.svg'",
")",
"self",
".",
"action_toggle_rubberbands",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
",",
"self"... | Create action for toggling rubber bands. | [
"Create",
"action",
"for",
"toggling",
"rubber",
"bands",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L446-L462 | train | 26,713 |
inasafe/inasafe | safe/plugin.py | Plugin._create_analysis_extent_action | def _create_analysis_extent_action(self):
"""Create action for analysis extent dialog."""
icon = resources_path('img', 'icons', 'set-extents-tool.svg')
self.action_extent_selector = QAction(
QIcon(icon),
self.tr('Set Analysis Area'),
self.iface.mainWindow())
... | python | def _create_analysis_extent_action(self):
"""Create action for analysis extent dialog."""
icon = resources_path('img', 'icons', 'set-extents-tool.svg')
self.action_extent_selector = QAction(
QIcon(icon),
self.tr('Set Analysis Area'),
self.iface.mainWindow())
... | [
"def",
"_create_analysis_extent_action",
"(",
"self",
")",
":",
"icon",
"=",
"resources_path",
"(",
"'img'",
",",
"'icons'",
",",
"'set-extents-tool.svg'",
")",
"self",
".",
"action_extent_selector",
"=",
"QAction",
"(",
"QIcon",
"(",
"icon",
")",
",",
"self",
... | Create action for analysis extent dialog. | [
"Create",
"action",
"for",
"analysis",
"extent",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L464-L477 | train | 26,714 |
inasafe/inasafe | safe/plugin.py | Plugin._create_dock | def _create_dock(self):
"""Create dockwidget and tabify it with the legend."""
# Import dock here as it needs to be imported AFTER i18n is set up
from safe.gui.widgets.dock import Dock
self.dock_widget = Dock(self.iface)
self.dock_widget.setObjectName('InaSAFE-Dock')
self... | python | def _create_dock(self):
"""Create dockwidget and tabify it with the legend."""
# Import dock here as it needs to be imported AFTER i18n is set up
from safe.gui.widgets.dock import Dock
self.dock_widget = Dock(self.iface)
self.dock_widget.setObjectName('InaSAFE-Dock')
self... | [
"def",
"_create_dock",
"(",
"self",
")",
":",
"# Import dock here as it needs to be imported AFTER i18n is set up",
"from",
"safe",
".",
"gui",
".",
"widgets",
".",
"dock",
"import",
"Dock",
"self",
".",
"dock_widget",
"=",
"Dock",
"(",
"self",
".",
"iface",
")",
... | Create dockwidget and tabify it with the legend. | [
"Create",
"dockwidget",
"and",
"tabify",
"it",
"with",
"the",
"legend",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L535-L546 | train | 26,715 |
inasafe/inasafe | safe/plugin.py | Plugin._add_spacer_to_menu | def _add_spacer_to_menu(self):
"""Create a spacer to the menu to separate action groups."""
separator = QAction(self.iface.mainWindow())
separator.setSeparator(True)
self.iface.addPluginToMenu(self.tr('InaSAFE'), separator) | python | def _add_spacer_to_menu(self):
"""Create a spacer to the menu to separate action groups."""
separator = QAction(self.iface.mainWindow())
separator.setSeparator(True)
self.iface.addPluginToMenu(self.tr('InaSAFE'), separator) | [
"def",
"_add_spacer_to_menu",
"(",
"self",
")",
":",
"separator",
"=",
"QAction",
"(",
"self",
".",
"iface",
".",
"mainWindow",
"(",
")",
")",
"separator",
".",
"setSeparator",
"(",
"True",
")",
"self",
".",
"iface",
".",
"addPluginToMenu",
"(",
"self",
... | Create a spacer to the menu to separate action groups. | [
"Create",
"a",
"spacer",
"to",
"the",
"menu",
"to",
"separate",
"action",
"groups",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L605-L609 | train | 26,716 |
inasafe/inasafe | safe/plugin.py | Plugin.clear_modules | def clear_modules():
"""Unload inasafe functions and try to return QGIS to before InaSAFE.
.. todo:: I think this function can be removed. TS.
"""
# next lets force remove any inasafe related modules
modules = []
for module in sys.modules:
if 'inasafe' in mod... | python | def clear_modules():
"""Unload inasafe functions and try to return QGIS to before InaSAFE.
.. todo:: I think this function can be removed. TS.
"""
# next lets force remove any inasafe related modules
modules = []
for module in sys.modules:
if 'inasafe' in mod... | [
"def",
"clear_modules",
"(",
")",
":",
"# next lets force remove any inasafe related modules",
"modules",
"=",
"[",
"]",
"for",
"module",
"in",
"sys",
".",
"modules",
":",
"if",
"'inasafe'",
"in",
"module",
":",
"# Check if it is really one of our modules i.e. exists in t... | Unload inasafe functions and try to return QGIS to before InaSAFE.
.. todo:: I think this function can be removed. TS. | [
"Unload",
"inasafe",
"functions",
"and",
"try",
"to",
"return",
"QGIS",
"to",
"before",
"InaSAFE",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L612-L646 | train | 26,717 |
inasafe/inasafe | safe/plugin.py | Plugin.toggle_dock_visibility | def toggle_dock_visibility(self):
"""Show or hide the dock widget."""
if self.dock_widget.isVisible():
self.dock_widget.setVisible(False)
else:
self.dock_widget.setVisible(True)
self.dock_widget.raise_() | python | def toggle_dock_visibility(self):
"""Show or hide the dock widget."""
if self.dock_widget.isVisible():
self.dock_widget.setVisible(False)
else:
self.dock_widget.setVisible(True)
self.dock_widget.raise_() | [
"def",
"toggle_dock_visibility",
"(",
"self",
")",
":",
"if",
"self",
".",
"dock_widget",
".",
"isVisible",
"(",
")",
":",
"self",
".",
"dock_widget",
".",
"setVisible",
"(",
"False",
")",
"else",
":",
"self",
".",
"dock_widget",
".",
"setVisible",
"(",
... | Show or hide the dock widget. | [
"Show",
"or",
"hide",
"the",
"dock",
"widget",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L685-L691 | train | 26,718 |
inasafe/inasafe | safe/plugin.py | Plugin.show_extent_selector | def show_extent_selector(self):
"""Show the extent selector widget for defining analysis extents."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.extent_selector_dialog import ExtentSelectorDialog
widget = ExtentSelectorDialog(
self.iface,
... | python | def show_extent_selector(self):
"""Show the extent selector widget for defining analysis extents."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.extent_selector_dialog import ExtentSelectorDialog
widget = ExtentSelectorDialog(
self.iface,
... | [
"def",
"show_extent_selector",
"(",
"self",
")",
":",
"# import here only so that it is AFTER i18n set up",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"extent_selector_dialog",
"import",
"ExtentSelectorDialog",
"widget",
"=",
"ExtentSelectorDialog",
"(",
"self",
".",
... | Show the extent selector widget for defining analysis extents. | [
"Show",
"the",
"extent",
"selector",
"widget",
"for",
"defining",
"analysis",
"extents",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L740-L757 | train | 26,719 |
inasafe/inasafe | safe/plugin.py | Plugin.show_options | def show_options(self):
"""Show the options dialog."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.options_dialog import OptionsDialog
dialog = OptionsDialog(
iface=self.iface,
parent=self.iface.mainWindow())
dialog.show_option_... | python | def show_options(self):
"""Show the options dialog."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.options_dialog import OptionsDialog
dialog = OptionsDialog(
iface=self.iface,
parent=self.iface.mainWindow())
dialog.show_option_... | [
"def",
"show_options",
"(",
"self",
")",
":",
"# import here only so that it is AFTER i18n set up",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"options_dialog",
"import",
"OptionsDialog",
"dialog",
"=",
"OptionsDialog",
"(",
"iface",
"=",
"self",
".",
"iface",
... | Show the options dialog. | [
"Show",
"the",
"options",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L780-L795 | train | 26,720 |
inasafe/inasafe | safe/plugin.py | Plugin.show_welcome_message | def show_welcome_message(self):
"""Show the welcome message."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.options_dialog import OptionsDialog
# Do not show by default
show_message = False
previous_version = StrictVersion(setting('previous_ve... | python | def show_welcome_message(self):
"""Show the welcome message."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.options_dialog import OptionsDialog
# Do not show by default
show_message = False
previous_version = StrictVersion(setting('previous_ve... | [
"def",
"show_welcome_message",
"(",
"self",
")",
":",
"# import here only so that it is AFTER i18n set up",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"options_dialog",
"import",
"OptionsDialog",
"# Do not show by default",
"show_message",
"=",
"False",
"previous_versio... | Show the welcome message. | [
"Show",
"the",
"welcome",
"message",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L797-L828 | train | 26,721 |
inasafe/inasafe | safe/plugin.py | Plugin.show_keywords_wizard | def show_keywords_wizard(self):
"""Show the keywords creation wizard."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.wizard.wizard_dialog import WizardDialog
if self.iface.activeLayer() is None:
return
# Don't break an existing wizard sess... | python | def show_keywords_wizard(self):
"""Show the keywords creation wizard."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.wizard.wizard_dialog import WizardDialog
if self.iface.activeLayer() is None:
return
# Don't break an existing wizard sess... | [
"def",
"show_keywords_wizard",
"(",
"self",
")",
":",
"# import here only so that it is AFTER i18n set up",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"wizard",
".",
"wizard_dialog",
"import",
"WizardDialog",
"if",
"self",
".",
"iface",
".",
"activeLayer",
"(",
... | Show the keywords creation wizard. | [
"Show",
"the",
"keywords",
"creation",
"wizard",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L830-L849 | train | 26,722 |
inasafe/inasafe | safe/plugin.py | Plugin.show_function_centric_wizard | def show_function_centric_wizard(self):
"""Show the function centric wizard."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.wizard.wizard_dialog import WizardDialog
# Don't break an existing wizard session if accidentally clicked
if self.wizard and sel... | python | def show_function_centric_wizard(self):
"""Show the function centric wizard."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.wizard.wizard_dialog import WizardDialog
# Don't break an existing wizard session if accidentally clicked
if self.wizard and sel... | [
"def",
"show_function_centric_wizard",
"(",
"self",
")",
":",
"# import here only so that it is AFTER i18n set up",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"wizard",
".",
"wizard_dialog",
"import",
"WizardDialog",
"# Don't break an existing wizard session if accidentally... | Show the function centric wizard. | [
"Show",
"the",
"function",
"centric",
"wizard",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L851-L868 | train | 26,723 |
inasafe/inasafe | safe/plugin.py | Plugin.show_shakemap_importer | def show_shakemap_importer(self):
"""Show the converter dialog."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.shake_grid.shakemap_converter_dialog import (
ShakemapConverterDialog)
dialog = ShakemapConverterDialog(
self.iface.mainWindo... | python | def show_shakemap_importer(self):
"""Show the converter dialog."""
# import here only so that it is AFTER i18n set up
from safe.gui.tools.shake_grid.shakemap_converter_dialog import (
ShakemapConverterDialog)
dialog = ShakemapConverterDialog(
self.iface.mainWindo... | [
"def",
"show_shakemap_importer",
"(",
"self",
")",
":",
"# import here only so that it is AFTER i18n set up",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"shake_grid",
".",
"shakemap_converter_dialog",
"import",
"(",
"ShakemapConverterDialog",
")",
"dialog",
"=",
"Sh... | Show the converter dialog. | [
"Show",
"the",
"converter",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L870-L878 | train | 26,724 |
inasafe/inasafe | safe/plugin.py | Plugin.show_multi_buffer | def show_multi_buffer(self):
"""Show the multi buffer tool."""
from safe.gui.tools.multi_buffer_dialog import (
MultiBufferDialog)
dialog = MultiBufferDialog(
self.iface.mainWindow(), self.iface, self.dock_widget)
dialog.exec_() | python | def show_multi_buffer(self):
"""Show the multi buffer tool."""
from safe.gui.tools.multi_buffer_dialog import (
MultiBufferDialog)
dialog = MultiBufferDialog(
self.iface.mainWindow(), self.iface, self.dock_widget)
dialog.exec_() | [
"def",
"show_multi_buffer",
"(",
"self",
")",
":",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"multi_buffer_dialog",
"import",
"(",
"MultiBufferDialog",
")",
"dialog",
"=",
"MultiBufferDialog",
"(",
"self",
".",
"iface",
".",
"mainWindow",
"(",
")",
",",... | Show the multi buffer tool. | [
"Show",
"the",
"multi",
"buffer",
"tool",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L880-L887 | train | 26,725 |
inasafe/inasafe | safe/plugin.py | Plugin.show_osm_downloader | def show_osm_downloader(self):
"""Show the OSM buildings downloader dialog."""
from safe.gui.tools.osm_downloader_dialog import OsmDownloaderDialog
dialog = OsmDownloaderDialog(self.iface.mainWindow(), self.iface)
# otherwise dialog is never deleted
dialog.setAttribute(Qt.WA_Del... | python | def show_osm_downloader(self):
"""Show the OSM buildings downloader dialog."""
from safe.gui.tools.osm_downloader_dialog import OsmDownloaderDialog
dialog = OsmDownloaderDialog(self.iface.mainWindow(), self.iface)
# otherwise dialog is never deleted
dialog.setAttribute(Qt.WA_Del... | [
"def",
"show_osm_downloader",
"(",
"self",
")",
":",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"osm_downloader_dialog",
"import",
"OsmDownloaderDialog",
"dialog",
"=",
"OsmDownloaderDialog",
"(",
"self",
".",
"iface",
".",
"mainWindow",
"(",
")",
",",
"se... | Show the OSM buildings downloader dialog. | [
"Show",
"the",
"OSM",
"buildings",
"downloader",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L889-L896 | train | 26,726 |
inasafe/inasafe | safe/plugin.py | Plugin.show_geonode_uploader | def show_geonode_uploader(self):
"""Show the Geonode uploader dialog."""
from safe.gui.tools.geonode_uploader import GeonodeUploaderDialog
dialog = GeonodeUploaderDialog(self.iface.mainWindow())
dialog.show() | python | def show_geonode_uploader(self):
"""Show the Geonode uploader dialog."""
from safe.gui.tools.geonode_uploader import GeonodeUploaderDialog
dialog = GeonodeUploaderDialog(self.iface.mainWindow())
dialog.show() | [
"def",
"show_geonode_uploader",
"(",
"self",
")",
":",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"geonode_uploader",
"import",
"GeonodeUploaderDialog",
"dialog",
"=",
"GeonodeUploaderDialog",
"(",
"self",
".",
"iface",
".",
"mainWindow",
"(",
")",
")",
"d... | Show the Geonode uploader dialog. | [
"Show",
"the",
"Geonode",
"uploader",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L898-L903 | train | 26,727 |
inasafe/inasafe | safe/plugin.py | Plugin.add_osm_layer | def add_osm_layer(self):
"""Add OSM tile layer to the map.
This uses a gdal wrapper around the OSM tile service - see the
WorldOSM.gdal file for how it is constructed.
"""
path = resources_path('osm', 'WorldOSM.gdal')
layer = QgsRasterLayer(path, self.tr('OpenStreetMap')... | python | def add_osm_layer(self):
"""Add OSM tile layer to the map.
This uses a gdal wrapper around the OSM tile service - see the
WorldOSM.gdal file for how it is constructed.
"""
path = resources_path('osm', 'WorldOSM.gdal')
layer = QgsRasterLayer(path, self.tr('OpenStreetMap')... | [
"def",
"add_osm_layer",
"(",
"self",
")",
":",
"path",
"=",
"resources_path",
"(",
"'osm'",
",",
"'WorldOSM.gdal'",
")",
"layer",
"=",
"QgsRasterLayer",
"(",
"path",
",",
"self",
".",
"tr",
"(",
"'OpenStreetMap'",
")",
")",
"project",
"=",
"QgsProject",
".... | Add OSM tile layer to the map.
This uses a gdal wrapper around the OSM tile service - see the
WorldOSM.gdal file for how it is constructed. | [
"Add",
"OSM",
"tile",
"layer",
"to",
"the",
"map",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L905-L923 | train | 26,728 |
inasafe/inasafe | safe/plugin.py | Plugin.show_field_mapping | def show_field_mapping(self):
"""Show InaSAFE Field Mapping."""
from safe.gui.tools.field_mapping_dialog import FieldMappingDialog
dialog = FieldMappingDialog(
parent=self.iface.mainWindow(),
iface=self.iface,)
if dialog.exec_(): # modal
LOGGER.debug(... | python | def show_field_mapping(self):
"""Show InaSAFE Field Mapping."""
from safe.gui.tools.field_mapping_dialog import FieldMappingDialog
dialog = FieldMappingDialog(
parent=self.iface.mainWindow(),
iface=self.iface,)
if dialog.exec_(): # modal
LOGGER.debug(... | [
"def",
"show_field_mapping",
"(",
"self",
")",
":",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"field_mapping_dialog",
"import",
"FieldMappingDialog",
"dialog",
"=",
"FieldMappingDialog",
"(",
"parent",
"=",
"self",
".",
"iface",
".",
"mainWindow",
"(",
")... | Show InaSAFE Field Mapping. | [
"Show",
"InaSAFE",
"Field",
"Mapping",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L931-L941 | train | 26,729 |
inasafe/inasafe | safe/plugin.py | Plugin.show_metadata_converter | def show_metadata_converter(self):
"""Show InaSAFE Metadata Converter."""
from safe.gui.tools.metadata_converter_dialog import (
MetadataConverterDialog)
dialog = MetadataConverterDialog(
parent=self.iface.mainWindow(),
iface=self.iface,
)
dial... | python | def show_metadata_converter(self):
"""Show InaSAFE Metadata Converter."""
from safe.gui.tools.metadata_converter_dialog import (
MetadataConverterDialog)
dialog = MetadataConverterDialog(
parent=self.iface.mainWindow(),
iface=self.iface,
)
dial... | [
"def",
"show_metadata_converter",
"(",
"self",
")",
":",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"metadata_converter_dialog",
"import",
"(",
"MetadataConverterDialog",
")",
"dialog",
"=",
"MetadataConverterDialog",
"(",
"parent",
"=",
"self",
".",
"iface",
... | Show InaSAFE Metadata Converter. | [
"Show",
"InaSAFE",
"Metadata",
"Converter",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L943-L951 | train | 26,730 |
inasafe/inasafe | safe/plugin.py | Plugin.show_multi_exposure | def show_multi_exposure(self):
"""Show InaSAFE Multi Exposure."""
from safe.gui.tools.multi_exposure_dialog import MultiExposureDialog
dialog = MultiExposureDialog(
self.iface.mainWindow(), self.iface)
dialog.exec_() | python | def show_multi_exposure(self):
"""Show InaSAFE Multi Exposure."""
from safe.gui.tools.multi_exposure_dialog import MultiExposureDialog
dialog = MultiExposureDialog(
self.iface.mainWindow(), self.iface)
dialog.exec_() | [
"def",
"show_multi_exposure",
"(",
"self",
")",
":",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"multi_exposure_dialog",
"import",
"MultiExposureDialog",
"dialog",
"=",
"MultiExposureDialog",
"(",
"self",
".",
"iface",
".",
"mainWindow",
"(",
")",
",",
"se... | Show InaSAFE Multi Exposure. | [
"Show",
"InaSAFE",
"Multi",
"Exposure",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L953-L958 | train | 26,731 |
inasafe/inasafe | safe/plugin.py | Plugin.add_petabencana_layer | def add_petabencana_layer(self):
"""Add petabencana layer to the map.
This uses the PetaBencana API to fetch the latest floods in JK. See
https://data.petabencana.id/floods
"""
from safe.gui.tools.peta_bencana_dialog import PetaBencanaDialog
dialog = PetaBencanaDialog(se... | python | def add_petabencana_layer(self):
"""Add petabencana layer to the map.
This uses the PetaBencana API to fetch the latest floods in JK. See
https://data.petabencana.id/floods
"""
from safe.gui.tools.peta_bencana_dialog import PetaBencanaDialog
dialog = PetaBencanaDialog(se... | [
"def",
"add_petabencana_layer",
"(",
"self",
")",
":",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"peta_bencana_dialog",
"import",
"PetaBencanaDialog",
"dialog",
"=",
"PetaBencanaDialog",
"(",
"self",
".",
"iface",
".",
"mainWindow",
"(",
")",
",",
"self",... | Add petabencana layer to the map.
This uses the PetaBencana API to fetch the latest floods in JK. See
https://data.petabencana.id/floods | [
"Add",
"petabencana",
"layer",
"to",
"the",
"map",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L960-L968 | train | 26,732 |
inasafe/inasafe | safe/plugin.py | Plugin.show_batch_runner | def show_batch_runner(self):
"""Show the batch runner dialog."""
from safe.gui.tools.batch.batch_dialog import BatchDialog
dialog = BatchDialog(
parent=self.iface.mainWindow(),
iface=self.iface,
dock=self.dock_widget)
dialog.exec_() | python | def show_batch_runner(self):
"""Show the batch runner dialog."""
from safe.gui.tools.batch.batch_dialog import BatchDialog
dialog = BatchDialog(
parent=self.iface.mainWindow(),
iface=self.iface,
dock=self.dock_widget)
dialog.exec_() | [
"def",
"show_batch_runner",
"(",
"self",
")",
":",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"batch",
".",
"batch_dialog",
"import",
"BatchDialog",
"dialog",
"=",
"BatchDialog",
"(",
"parent",
"=",
"self",
".",
"iface",
".",
"mainWindow",
"(",
")",
... | Show the batch runner dialog. | [
"Show",
"the",
"batch",
"runner",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L970-L978 | train | 26,733 |
inasafe/inasafe | safe/plugin.py | Plugin.save_scenario | def save_scenario(self):
"""Save current scenario to text file."""
from safe.gui.tools.save_scenario import SaveScenarioDialog
dialog = SaveScenarioDialog(
iface=self.iface,
dock=self.dock_widget)
dialog.save_scenario() | python | def save_scenario(self):
"""Save current scenario to text file."""
from safe.gui.tools.save_scenario import SaveScenarioDialog
dialog = SaveScenarioDialog(
iface=self.iface,
dock=self.dock_widget)
dialog.save_scenario() | [
"def",
"save_scenario",
"(",
"self",
")",
":",
"from",
"safe",
".",
"gui",
".",
"tools",
".",
"save_scenario",
"import",
"SaveScenarioDialog",
"dialog",
"=",
"SaveScenarioDialog",
"(",
"iface",
"=",
"self",
".",
"iface",
",",
"dock",
"=",
"self",
".",
"doc... | Save current scenario to text file. | [
"Save",
"current",
"scenario",
"to",
"text",
"file",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L980-L987 | train | 26,734 |
inasafe/inasafe | safe/plugin.py | Plugin.layer_changed | def layer_changed(self, layer):
"""Enable or disable keywords editor icon when active layer changes.
:param layer: The layer that is now active.
:type layer: QgsMapLayer
"""
if not layer:
enable_keyword_wizard = False
elif not hasattr(layer, 'providerType'):
... | python | def layer_changed(self, layer):
"""Enable or disable keywords editor icon when active layer changes.
:param layer: The layer that is now active.
:type layer: QgsMapLayer
"""
if not layer:
enable_keyword_wizard = False
elif not hasattr(layer, 'providerType'):
... | [
"def",
"layer_changed",
"(",
"self",
",",
"layer",
")",
":",
"if",
"not",
"layer",
":",
"enable_keyword_wizard",
"=",
"False",
"elif",
"not",
"hasattr",
"(",
"layer",
",",
"'providerType'",
")",
":",
"enable_keyword_wizard",
"=",
"False",
"elif",
"layer",
".... | Enable or disable keywords editor icon when active layer changes.
:param layer: The layer that is now active.
:type layer: QgsMapLayer | [
"Enable",
"or",
"disable",
"keywords",
"editor",
"icon",
"when",
"active",
"layer",
"changes",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L989-L1044 | train | 26,735 |
inasafe/inasafe | safe/gui/widgets/field_mapping_widget.py | FieldMappingWidget.populate_tabs | def populate_tabs(self):
"""Populating tabs based on layer metadata."""
self.delete_tabs()
layer_purpose = self.metadata.get('layer_purpose')
if not layer_purpose:
message = tr(
'Key layer_purpose is not found in the layer {layer_name}'
).format(la... | python | def populate_tabs(self):
"""Populating tabs based on layer metadata."""
self.delete_tabs()
layer_purpose = self.metadata.get('layer_purpose')
if not layer_purpose:
message = tr(
'Key layer_purpose is not found in the layer {layer_name}'
).format(la... | [
"def",
"populate_tabs",
"(",
"self",
")",
":",
"self",
".",
"delete_tabs",
"(",
")",
"layer_purpose",
"=",
"self",
".",
"metadata",
".",
"get",
"(",
"'layer_purpose'",
")",
"if",
"not",
"layer_purpose",
":",
"message",
"=",
"tr",
"(",
"'Key layer_purpose is ... | Populating tabs based on layer metadata. | [
"Populating",
"tabs",
"based",
"on",
"layer",
"metadata",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/field_mapping_widget.py#L60-L81 | train | 26,736 |
inasafe/inasafe | safe/impact_function/postprocessors.py | evaluate_formula | def evaluate_formula(formula, variables):
"""Very simple formula evaluator. Beware the security.
:param formula: A simple formula.
:type formula: str
:param variables: A collection of variable (key and value).
:type variables: dict
:returns: The result of the formula execution.
:rtype: fl... | python | def evaluate_formula(formula, variables):
"""Very simple formula evaluator. Beware the security.
:param formula: A simple formula.
:type formula: str
:param variables: A collection of variable (key and value).
:type variables: dict
:returns: The result of the formula execution.
:rtype: fl... | [
"def",
"evaluate_formula",
"(",
"formula",
",",
"variables",
")",
":",
"for",
"key",
",",
"value",
"in",
"list",
"(",
"variables",
".",
"items",
"(",
")",
")",
":",
"if",
"value",
"is",
"None",
"or",
"(",
"hasattr",
"(",
"value",
",",
"'isNull'",
")"... | Very simple formula evaluator. Beware the security.
:param formula: A simple formula.
:type formula: str
:param variables: A collection of variable (key and value).
:type variables: dict
:returns: The result of the formula execution.
:rtype: float, int | [
"Very",
"simple",
"formula",
"evaluator",
".",
"Beware",
"the",
"security",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/postprocessors.py#L34-L52 | train | 26,737 |
inasafe/inasafe | safe/impact_function/postprocessors.py | enough_input | def enough_input(layer, post_processor_input):
"""Check if the input from impact_fields in enough.
:param layer: The vector layer to use for post processing.
:type layer: QgsVectorLayer
:param post_processor_input: Collection of post processor input
requirements.
:type post_processor_input... | python | def enough_input(layer, post_processor_input):
"""Check if the input from impact_fields in enough.
:param layer: The vector layer to use for post processing.
:type layer: QgsVectorLayer
:param post_processor_input: Collection of post processor input
requirements.
:type post_processor_input... | [
"def",
"enough_input",
"(",
"layer",
",",
"post_processor_input",
")",
":",
"impact_fields",
"=",
"list",
"(",
"layer",
".",
"keywords",
"[",
"'inasafe_fields'",
"]",
".",
"keys",
"(",
")",
")",
"for",
"input_key",
",",
"input_values",
"in",
"list",
"(",
"... | Check if the input from impact_fields in enough.
:param layer: The vector layer to use for post processing.
:type layer: QgsVectorLayer
:param post_processor_input: Collection of post processor input
requirements.
:type post_processor_input: dict
:returns: Tuple with True if success, else... | [
"Check",
"if",
"the",
"input",
"from",
"impact_fields",
"in",
"enough",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/postprocessors.py#L311-L397 | train | 26,738 |
inasafe/inasafe | safe/common/parameters/group_select_parameter.py | GroupSelectParameter.set_value_for_key | def set_value_for_key(self, key, value):
"""Set the value of key to value.
:param key: The key.
:type key: str
:param value: The value to be assigned.
:type value: list, float, int
"""
if key in self.options:
self.options[key]['value'] = value | python | def set_value_for_key(self, key, value):
"""Set the value of key to value.
:param key: The key.
:type key: str
:param value: The value to be assigned.
:type value: list, float, int
"""
if key in self.options:
self.options[key]['value'] = value | [
"def",
"set_value_for_key",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"key",
"in",
"self",
".",
"options",
":",
"self",
".",
"options",
"[",
"key",
"]",
"[",
"'value'",
"]",
"=",
"value"
] | Set the value of key to value.
:param key: The key.
:type key: str
:param value: The value to be assigned.
:type value: list, float, int | [
"Set",
"the",
"value",
"of",
"key",
"to",
"value",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/common/parameters/group_select_parameter.py#L107-L117 | train | 26,739 |
inasafe/inasafe | safe/gui/tools/wizard/step_kw20_unit.py | StepKwUnit.on_lstUnits_itemSelectionChanged | def on_lstUnits_itemSelectionChanged(self):
"""Update unit description label and field widgets.
.. note:: This is an automatic Qt slot
executed when the unit selection changes.
"""
self.clear_further_steps()
# Set widgets
unit = self.selected_unit()
# ... | python | def on_lstUnits_itemSelectionChanged(self):
"""Update unit description label and field widgets.
.. note:: This is an automatic Qt slot
executed when the unit selection changes.
"""
self.clear_further_steps()
# Set widgets
unit = self.selected_unit()
# ... | [
"def",
"on_lstUnits_itemSelectionChanged",
"(",
"self",
")",
":",
"self",
".",
"clear_further_steps",
"(",
")",
"# Set widgets",
"unit",
"=",
"self",
".",
"selected_unit",
"(",
")",
"# Exit if no selection",
"if",
"not",
"unit",
":",
"return",
"self",
".",
"lblD... | Update unit description label and field widgets.
.. note:: This is an automatic Qt slot
executed when the unit selection changes. | [
"Update",
"unit",
"description",
"label",
"and",
"field",
"widgets",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw20_unit.py#L63-L77 | train | 26,740 |
inasafe/inasafe | safe/gui/tools/wizard/step_kw20_unit.py | StepKwUnit.selected_unit | def selected_unit(self):
"""Obtain the unit selected by user.
:returns: Metadata of the selected unit.
:rtype: dict, None
"""
item = self.lstUnits.currentItem()
try:
return definition(item.data(QtCore.Qt.UserRole))
except (AttributeError, NameError):
... | python | def selected_unit(self):
"""Obtain the unit selected by user.
:returns: Metadata of the selected unit.
:rtype: dict, None
"""
item = self.lstUnits.currentItem()
try:
return definition(item.data(QtCore.Qt.UserRole))
except (AttributeError, NameError):
... | [
"def",
"selected_unit",
"(",
"self",
")",
":",
"item",
"=",
"self",
".",
"lstUnits",
".",
"currentItem",
"(",
")",
"try",
":",
"return",
"definition",
"(",
"item",
".",
"data",
"(",
"QtCore",
".",
"Qt",
".",
"UserRole",
")",
")",
"except",
"(",
"Attr... | Obtain the unit selected by user.
:returns: Metadata of the selected unit.
:rtype: dict, None | [
"Obtain",
"the",
"unit",
"selected",
"by",
"user",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw20_unit.py#L79-L89 | train | 26,741 |
inasafe/inasafe | safe/gui/tools/wizard/step_kw20_unit.py | StepKwUnit.set_widgets | def set_widgets(self):
"""Set widgets on the Unit tab."""
self.clear_further_steps()
# Set widgets
purpose = self.parent.step_kw_purpose.selected_purpose()
subcategory = self.parent.step_kw_subcategory.selected_subcategory()
self.lblSelectUnit.setText(
unit_qu... | python | def set_widgets(self):
"""Set widgets on the Unit tab."""
self.clear_further_steps()
# Set widgets
purpose = self.parent.step_kw_purpose.selected_purpose()
subcategory = self.parent.step_kw_subcategory.selected_subcategory()
self.lblSelectUnit.setText(
unit_qu... | [
"def",
"set_widgets",
"(",
"self",
")",
":",
"self",
".",
"clear_further_steps",
"(",
")",
"# Set widgets",
"purpose",
"=",
"self",
".",
"parent",
".",
"step_kw_purpose",
".",
"selected_purpose",
"(",
")",
"subcategory",
"=",
"self",
".",
"parent",
".",
"ste... | Set widgets on the Unit tab. | [
"Set",
"widgets",
"on",
"the",
"Unit",
"tab",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw20_unit.py#L97-L132 | train | 26,742 |
inasafe/inasafe | safe/report/expressions/html_report.py | get_report_section | def get_report_section(
html_report, component_id, container_wrapper_format=container_format):
"""Get specific report section from InaSAFE analysis summary report.
:param html_report: The html report.
:type html_report: basestring
:param component_id: The component key.
:type component_id:... | python | def get_report_section(
html_report, component_id, container_wrapper_format=container_format):
"""Get specific report section from InaSAFE analysis summary report.
:param html_report: The html report.
:type html_report: basestring
:param component_id: The component key.
:type component_id:... | [
"def",
"get_report_section",
"(",
"html_report",
",",
"component_id",
",",
"container_wrapper_format",
"=",
"container_format",
")",
":",
"no_element_error",
"=",
"tr",
"(",
"'No element match the tag or component id.'",
")",
"root_element",
",",
"dict_of_elements",
"=",
... | Get specific report section from InaSAFE analysis summary report.
:param html_report: The html report.
:type html_report: basestring
:param component_id: The component key.
:type component_id: str
:param container_wrapper_format: A string format for wrapping the section.
:type container_wrapp... | [
"Get",
"specific",
"report",
"section",
"from",
"InaSAFE",
"analysis",
"summary",
"report",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/html_report.py#L155-L181 | train | 26,743 |
inasafe/inasafe | safe/report/expressions/html_report.py | analysis_summary_report | def analysis_summary_report(feature, parent):
"""Retrieve an HTML table report of current selected analysis.
"""
_ = feature, parent # NOQA
project_context_scope = QgsExpressionContextUtils.projectScope(
QgsProject.instance())
key = provenance_layer_analysis_impacted['provenance_key']
i... | python | def analysis_summary_report(feature, parent):
"""Retrieve an HTML table report of current selected analysis.
"""
_ = feature, parent # NOQA
project_context_scope = QgsExpressionContextUtils.projectScope(
QgsProject.instance())
key = provenance_layer_analysis_impacted['provenance_key']
i... | [
"def",
"analysis_summary_report",
"(",
"feature",
",",
"parent",
")",
":",
"_",
"=",
"feature",
",",
"parent",
"# NOQA",
"project_context_scope",
"=",
"QgsExpressionContextUtils",
".",
"projectScope",
"(",
"QgsProject",
".",
"instance",
"(",
")",
")",
"key",
"="... | Retrieve an HTML table report of current selected analysis. | [
"Retrieve",
"an",
"HTML",
"table",
"report",
"of",
"current",
"selected",
"analysis",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/html_report.py#L235-L246 | train | 26,744 |
inasafe/inasafe | safe/report/expressions/html_report.py | analysis_question_report | def analysis_question_report(feature, parent):
"""Retrieve the analysis question section from InaSAFE report.
"""
_ = feature, parent # NOQA
project_context_scope = QgsExpressionContextUtils.projectScope()
key = provenance_layer_analysis_impacted['provenance_key']
if not project_context_scope.h... | python | def analysis_question_report(feature, parent):
"""Retrieve the analysis question section from InaSAFE report.
"""
_ = feature, parent # NOQA
project_context_scope = QgsExpressionContextUtils.projectScope()
key = provenance_layer_analysis_impacted['provenance_key']
if not project_context_scope.h... | [
"def",
"analysis_question_report",
"(",
"feature",
",",
"parent",
")",
":",
"_",
"=",
"feature",
",",
"parent",
"# NOQA",
"project_context_scope",
"=",
"QgsExpressionContextUtils",
".",
"projectScope",
"(",
")",
"key",
"=",
"provenance_layer_analysis_impacted",
"[",
... | Retrieve the analysis question section from InaSAFE report. | [
"Retrieve",
"the",
"analysis",
"question",
"section",
"from",
"InaSAFE",
"report",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/html_report.py#L260-L275 | train | 26,745 |
inasafe/inasafe | safe/report/expressions/html_report.py | population_analysis_summary_report | def population_analysis_summary_report(feature, parent):
"""Retrieve an HTML population analysis table report from a multi exposure
analysis.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir(exposure_population['key'])
if analysis_dir:
return get_impact_report_as_string(an... | python | def population_analysis_summary_report(feature, parent):
"""Retrieve an HTML population analysis table report from a multi exposure
analysis.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir(exposure_population['key'])
if analysis_dir:
return get_impact_report_as_string(an... | [
"def",
"population_analysis_summary_report",
"(",
"feature",
",",
"parent",
")",
":",
"_",
"=",
"feature",
",",
"parent",
"# NOQA",
"analysis_dir",
"=",
"get_analysis_dir",
"(",
"exposure_population",
"[",
"'key'",
"]",
")",
"if",
"analysis_dir",
":",
"return",
... | Retrieve an HTML population analysis table report from a multi exposure
analysis. | [
"Retrieve",
"an",
"HTML",
"population",
"analysis",
"table",
"report",
"from",
"a",
"multi",
"exposure",
"analysis",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/html_report.py#L552-L560 | train | 26,746 |
inasafe/inasafe | safe/report/expressions/html_report.py | road_analysis_summary_report | def road_analysis_summary_report(feature, parent):
"""Retrieve an HTML road analysis table report from a multi exposure
analysis.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir(exposure_road['key'])
if analysis_dir:
return get_impact_report_as_string(analysis_dir)
re... | python | def road_analysis_summary_report(feature, parent):
"""Retrieve an HTML road analysis table report from a multi exposure
analysis.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir(exposure_road['key'])
if analysis_dir:
return get_impact_report_as_string(analysis_dir)
re... | [
"def",
"road_analysis_summary_report",
"(",
"feature",
",",
"parent",
")",
":",
"_",
"=",
"feature",
",",
"parent",
"# NOQA",
"analysis_dir",
"=",
"get_analysis_dir",
"(",
"exposure_road",
"[",
"'key'",
"]",
")",
"if",
"analysis_dir",
":",
"return",
"get_impact_... | Retrieve an HTML road analysis table report from a multi exposure
analysis. | [
"Retrieve",
"an",
"HTML",
"road",
"analysis",
"table",
"report",
"from",
"a",
"multi",
"exposure",
"analysis",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/html_report.py#L574-L582 | train | 26,747 |
inasafe/inasafe | safe/report/expressions/html_report.py | structure_analysis_summary_report | def structure_analysis_summary_report(feature, parent):
"""Retrieve an HTML structure analysis table report from a multi exposure
analysis.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir(exposure_structure['key'])
if analysis_dir:
return get_impact_report_as_string(analy... | python | def structure_analysis_summary_report(feature, parent):
"""Retrieve an HTML structure analysis table report from a multi exposure
analysis.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir(exposure_structure['key'])
if analysis_dir:
return get_impact_report_as_string(analy... | [
"def",
"structure_analysis_summary_report",
"(",
"feature",
",",
"parent",
")",
":",
"_",
"=",
"feature",
",",
"parent",
"# NOQA",
"analysis_dir",
"=",
"get_analysis_dir",
"(",
"exposure_structure",
"[",
"'key'",
"]",
")",
"if",
"analysis_dir",
":",
"return",
"g... | Retrieve an HTML structure analysis table report from a multi exposure
analysis. | [
"Retrieve",
"an",
"HTML",
"structure",
"analysis",
"table",
"report",
"from",
"a",
"multi",
"exposure",
"analysis",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/html_report.py#L596-L604 | train | 26,748 |
inasafe/inasafe | safe/report/expressions/html_report.py | place_analysis_summary_report | def place_analysis_summary_report(feature, parent):
"""Retrieve an HTML place analysis table report from a multi exposure
analysis.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir(exposure_place['key'])
if analysis_dir:
return get_impact_report_as_string(analysis_dir)
... | python | def place_analysis_summary_report(feature, parent):
"""Retrieve an HTML place analysis table report from a multi exposure
analysis.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir(exposure_place['key'])
if analysis_dir:
return get_impact_report_as_string(analysis_dir)
... | [
"def",
"place_analysis_summary_report",
"(",
"feature",
",",
"parent",
")",
":",
"_",
"=",
"feature",
",",
"parent",
"# NOQA",
"analysis_dir",
"=",
"get_analysis_dir",
"(",
"exposure_place",
"[",
"'key'",
"]",
")",
"if",
"analysis_dir",
":",
"return",
"get_impac... | Retrieve an HTML place analysis table report from a multi exposure
analysis. | [
"Retrieve",
"an",
"HTML",
"place",
"analysis",
"table",
"report",
"from",
"a",
"multi",
"exposure",
"analysis",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/html_report.py#L618-L626 | train | 26,749 |
inasafe/inasafe | safe/report/expressions/html_report.py | land_cover_analysis_summary_report | def land_cover_analysis_summary_report(feature, parent):
"""Retrieve an HTML land cover analysis table report from a multi exposure
analysis.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir(exposure_land_cover['key'])
if analysis_dir:
return get_impact_report_as_string(an... | python | def land_cover_analysis_summary_report(feature, parent):
"""Retrieve an HTML land cover analysis table report from a multi exposure
analysis.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir(exposure_land_cover['key'])
if analysis_dir:
return get_impact_report_as_string(an... | [
"def",
"land_cover_analysis_summary_report",
"(",
"feature",
",",
"parent",
")",
":",
"_",
"=",
"feature",
",",
"parent",
"# NOQA",
"analysis_dir",
"=",
"get_analysis_dir",
"(",
"exposure_land_cover",
"[",
"'key'",
"]",
")",
"if",
"analysis_dir",
":",
"return",
... | Retrieve an HTML land cover analysis table report from a multi exposure
analysis. | [
"Retrieve",
"an",
"HTML",
"land",
"cover",
"analysis",
"table",
"report",
"from",
"a",
"multi",
"exposure",
"analysis",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/html_report.py#L640-L648 | train | 26,750 |
inasafe/inasafe | safe/report/expressions/html_report.py | multi_exposure_analysis_summary_report | def multi_exposure_analysis_summary_report(feature, parent):
"""Retrieve an HTML multi exposure analysis table report.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir()
if analysis_dir:
return get_impact_report_as_string(analysis_dir)
return None | python | def multi_exposure_analysis_summary_report(feature, parent):
"""Retrieve an HTML multi exposure analysis table report.
"""
_ = feature, parent # NOQA
analysis_dir = get_analysis_dir()
if analysis_dir:
return get_impact_report_as_string(analysis_dir)
return None | [
"def",
"multi_exposure_analysis_summary_report",
"(",
"feature",
",",
"parent",
")",
":",
"_",
"=",
"feature",
",",
"parent",
"# NOQA",
"analysis_dir",
"=",
"get_analysis_dir",
"(",
")",
"if",
"analysis_dir",
":",
"return",
"get_impact_report_as_string",
"(",
"analy... | Retrieve an HTML multi exposure analysis table report. | [
"Retrieve",
"an",
"HTML",
"multi",
"exposure",
"analysis",
"table",
"report",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/html_report.py#L661-L668 | train | 26,751 |
inasafe/inasafe | safe/gui/tools/wizard/wizard_help.py | WizardHelp.show_help | def show_help(self, wizard_step):
"""Set wizard step and show the help text."""
self.wizard_step = wizard_step
header = html_header()
footer = html_footer()
content = header
message = self.wizard_step.help()
content += message.to_html()
content += foot... | python | def show_help(self, wizard_step):
"""Set wizard step and show the help text."""
self.wizard_step = wizard_step
header = html_header()
footer = html_footer()
content = header
message = self.wizard_step.help()
content += message.to_html()
content += foot... | [
"def",
"show_help",
"(",
"self",
",",
"wizard_step",
")",
":",
"self",
".",
"wizard_step",
"=",
"wizard_step",
"header",
"=",
"html_header",
"(",
")",
"footer",
"=",
"html_footer",
"(",
")",
"content",
"=",
"header",
"message",
"=",
"self",
".",
"wizard_st... | Set wizard step and show the help text. | [
"Set",
"wizard",
"step",
"and",
"show",
"the",
"help",
"text",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/wizard_help.py#L39-L61 | train | 26,752 |
inasafe/inasafe | safe/gui/tools/wizard/wizard_help.py | WizardHelp.restore_button_state | def restore_button_state(self):
"""Helper to restore button state."""
self.parent.pbnNext.setEnabled(self.next_button_state)
self.parent.pbnBack.setEnabled(self.back_button_state) | python | def restore_button_state(self):
"""Helper to restore button state."""
self.parent.pbnNext.setEnabled(self.next_button_state)
self.parent.pbnBack.setEnabled(self.back_button_state) | [
"def",
"restore_button_state",
"(",
"self",
")",
":",
"self",
".",
"parent",
".",
"pbnNext",
".",
"setEnabled",
"(",
"self",
".",
"next_button_state",
")",
"self",
".",
"parent",
".",
"pbnBack",
".",
"setEnabled",
"(",
"self",
".",
"back_button_state",
")"
] | Helper to restore button state. | [
"Helper",
"to",
"restore",
"button",
"state",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/wizard_help.py#L63-L66 | train | 26,753 |
inasafe/inasafe | safe/utilities/resources.py | html_footer | def html_footer():
"""Get a standard html footer for wrapping content in.
:returns: A header containing a web page closing content in html - up to
and including the body close tag.
:rtype: str
"""
file_path = resources_path('footer.html')
with open(file_path) as header_file:
con... | python | def html_footer():
"""Get a standard html footer for wrapping content in.
:returns: A header containing a web page closing content in html - up to
and including the body close tag.
:rtype: str
"""
file_path = resources_path('footer.html')
with open(file_path) as header_file:
con... | [
"def",
"html_footer",
"(",
")",
":",
"file_path",
"=",
"resources_path",
"(",
"'footer.html'",
")",
"with",
"open",
"(",
"file_path",
")",
"as",
"header_file",
":",
"content",
"=",
"header_file",
".",
"read",
"(",
")",
"return",
"content"
] | Get a standard html footer for wrapping content in.
:returns: A header containing a web page closing content in html - up to
and including the body close tag.
:rtype: str | [
"Get",
"a",
"standard",
"html",
"footer",
"for",
"wrapping",
"content",
"in",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/resources.py#L19-L29 | train | 26,754 |
inasafe/inasafe | safe/utilities/resources.py | html_header | def html_header():
"""Get a standard html header for wrapping content in.
:returns: A header containing a web page preamble in html - up to and
including the body open tag.
:rtype: str
"""
file_path = resources_path('header.html')
with codecs.open(file_path, 'r', encoding='utf8') as he... | python | def html_header():
"""Get a standard html header for wrapping content in.
:returns: A header containing a web page preamble in html - up to and
including the body open tag.
:rtype: str
"""
file_path = resources_path('header.html')
with codecs.open(file_path, 'r', encoding='utf8') as he... | [
"def",
"html_header",
"(",
")",
":",
"file_path",
"=",
"resources_path",
"(",
"'header.html'",
")",
"with",
"codecs",
".",
"open",
"(",
"file_path",
",",
"'r'",
",",
"encoding",
"=",
"'utf8'",
")",
"as",
"header_file",
":",
"content",
"=",
"header_file",
"... | Get a standard html header for wrapping content in.
:returns: A header containing a web page preamble in html - up to and
including the body open tag.
:rtype: str | [
"Get",
"a",
"standard",
"html",
"header",
"for",
"wrapping",
"content",
"in",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/resources.py#L32-L44 | train | 26,755 |
inasafe/inasafe | safe/utilities/resources.py | resources_path | def resources_path(*args):
"""Get the path to our resources folder.
.. versionadded:: 3.0
Note that in version 3.0 we removed the use of Qt Resource files in
favour of directly accessing on-disk resources.
:param args List of path elements e.g. ['img', 'logos', 'image.png']
:type args: str
... | python | def resources_path(*args):
"""Get the path to our resources folder.
.. versionadded:: 3.0
Note that in version 3.0 we removed the use of Qt Resource files in
favour of directly accessing on-disk resources.
:param args List of path elements e.g. ['img', 'logos', 'image.png']
:type args: str
... | [
"def",
"resources_path",
"(",
"*",
"args",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"os",
".",
"path",
... | Get the path to our resources folder.
.. versionadded:: 3.0
Note that in version 3.0 we removed the use of Qt Resource files in
favour of directly accessing on-disk resources.
:param args List of path elements e.g. ['img', 'logos', 'image.png']
:type args: str
:return: Absolute path to the r... | [
"Get",
"the",
"path",
"to",
"our",
"resources",
"folder",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/resources.py#L67-L87 | train | 26,756 |
inasafe/inasafe | safe/utilities/resources.py | resource_url | def resource_url(path):
"""Get the a local filesystem url to a given resource.
.. versionadded:: 3.0
Note that in version 3.0 we removed the use of Qt Resource files in
favour of directly accessing on-disk resources.
:param path: Path to resource e.g. /home/timlinux/foo/bar.png
:type path: st... | python | def resource_url(path):
"""Get the a local filesystem url to a given resource.
.. versionadded:: 3.0
Note that in version 3.0 we removed the use of Qt Resource files in
favour of directly accessing on-disk resources.
:param path: Path to resource e.g. /home/timlinux/foo/bar.png
:type path: st... | [
"def",
"resource_url",
"(",
"path",
")",
":",
"url",
"=",
"QtCore",
".",
"QUrl",
".",
"fromLocalFile",
"(",
"path",
")",
"return",
"str",
"(",
"url",
".",
"toString",
"(",
")",
")"
] | Get the a local filesystem url to a given resource.
.. versionadded:: 3.0
Note that in version 3.0 we removed the use of Qt Resource files in
favour of directly accessing on-disk resources.
:param path: Path to resource e.g. /home/timlinux/foo/bar.png
:type path: str
:return: A valid file ur... | [
"Get",
"the",
"a",
"local",
"filesystem",
"url",
"to",
"a",
"given",
"resource",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/resources.py#L90-L105 | train | 26,757 |
inasafe/inasafe | safe/utilities/resources.py | get_ui_class | def get_ui_class(ui_file):
"""Get UI Python class from .ui file.
Can be filename.ui or subdirectory/filename.ui
:param ui_file: The file of the ui in safe.gui.ui
:type ui_file: str
"""
os.path.sep.join(ui_file.split('/'))
ui_file_path = os.path.abspath(
os.path.join(
... | python | def get_ui_class(ui_file):
"""Get UI Python class from .ui file.
Can be filename.ui or subdirectory/filename.ui
:param ui_file: The file of the ui in safe.gui.ui
:type ui_file: str
"""
os.path.sep.join(ui_file.split('/'))
ui_file_path = os.path.abspath(
os.path.join(
... | [
"def",
"get_ui_class",
"(",
"ui_file",
")",
":",
"os",
".",
"path",
".",
"sep",
".",
"join",
"(",
"ui_file",
".",
"split",
"(",
"'/'",
")",
")",
"ui_file_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os... | Get UI Python class from .ui file.
Can be filename.ui or subdirectory/filename.ui
:param ui_file: The file of the ui in safe.gui.ui
:type ui_file: str | [
"Get",
"UI",
"Python",
"class",
"from",
".",
"ui",
"file",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/resources.py#L108-L126 | train | 26,758 |
inasafe/inasafe | safe/gui/tools/wizard/step_kw55_source.py | StepKwSource.set_widgets | def set_widgets(self):
"""Set widgets on the Source tab."""
# Just set values based on existing keywords
source = self.parent.get_existing_keyword('source')
if source or source == 0:
self.leSource.setText(source)
else:
self.leSource.clear()
source... | python | def set_widgets(self):
"""Set widgets on the Source tab."""
# Just set values based on existing keywords
source = self.parent.get_existing_keyword('source')
if source or source == 0:
self.leSource.setText(source)
else:
self.leSource.clear()
source... | [
"def",
"set_widgets",
"(",
"self",
")",
":",
"# Just set values based on existing keywords",
"source",
"=",
"self",
".",
"parent",
".",
"get_existing_keyword",
"(",
"'source'",
")",
"if",
"source",
"or",
"source",
"==",
"0",
":",
"self",
".",
"leSource",
".",
... | Set widgets on the Source tab. | [
"Set",
"widgets",
"on",
"the",
"Source",
"tab",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw55_source.py#L82-L120 | train | 26,759 |
inasafe/inasafe | safe/gui/tools/help/welcome_message.py | welcome_message | def welcome_message():
"""Welcome message for first running users.
.. versionadded:: 4.3.0
:returns: A message object containing helpful information.
:rtype: messaging.message.Message
"""
message = m.Message()
message.add(m.Brand())
message.add(heading())
message.add(content())
... | python | def welcome_message():
"""Welcome message for first running users.
.. versionadded:: 4.3.0
:returns: A message object containing helpful information.
:rtype: messaging.message.Message
"""
message = m.Message()
message.add(m.Brand())
message.add(heading())
message.add(content())
... | [
"def",
"welcome_message",
"(",
")",
":",
"message",
"=",
"m",
".",
"Message",
"(",
")",
"message",
".",
"add",
"(",
"m",
".",
"Brand",
"(",
")",
")",
"message",
".",
"add",
"(",
"heading",
"(",
")",
")",
"message",
".",
"add",
"(",
"content",
"("... | Welcome message for first running users.
.. versionadded:: 4.3.0
:returns: A message object containing helpful information.
:rtype: messaging.message.Message | [
"Welcome",
"message",
"for",
"first",
"running",
"users",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/help/welcome_message.py#L30-L43 | train | 26,760 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | read_scenarios | def read_scenarios(filename):
"""Read keywords dictionary from file.
:param filename: Name of file holding scenarios .
:return Dictionary of with structure like this
{{ 'foo' : { 'a': 'b', 'c': 'd'},
{ 'bar' : { 'd': 'e', 'f': 'g'}}
A scenarios file may look like this:
[j... | python | def read_scenarios(filename):
"""Read keywords dictionary from file.
:param filename: Name of file holding scenarios .
:return Dictionary of with structure like this
{{ 'foo' : { 'a': 'b', 'c': 'd'},
{ 'bar' : { 'd': 'e', 'f': 'g'}}
A scenarios file may look like this:
[j... | [
"def",
"read_scenarios",
"(",
"filename",
")",
":",
"# Input checks",
"filename",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"filename",
")",
"blocks",
"=",
"{",
"}",
"parser",
"=",
"ConfigParser",
"(",
")",
"# Parse the file content.",
"# if the content don't... | Read keywords dictionary from file.
:param filename: Name of file holding scenarios .
:return Dictionary of with structure like this
{{ 'foo' : { 'a': 'b', 'c': 'd'},
{ 'bar' : { 'd': 'e', 'f': 'g'}}
A scenarios file may look like this:
[jakarta_flood]
hazard: /path/t... | [
"Read",
"keywords",
"dictionary",
"from",
"file",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L849-L905 | train | 26,761 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | validate_scenario | def validate_scenario(blocks, scenario_directory):
"""Function to validate input layer stored in scenario file.
Check whether the files that are used in scenario file need to be
updated or not.
:param blocks: dictionary from read_scenarios
:type blocks: dictionary
:param scenario_directory: d... | python | def validate_scenario(blocks, scenario_directory):
"""Function to validate input layer stored in scenario file.
Check whether the files that are used in scenario file need to be
updated or not.
:param blocks: dictionary from read_scenarios
:type blocks: dictionary
:param scenario_directory: d... | [
"def",
"validate_scenario",
"(",
"blocks",
",",
"scenario_directory",
")",
":",
"# dictionary to temporary contain status message",
"blocks_update",
"=",
"{",
"}",
"for",
"section",
",",
"section_item",
"in",
"list",
"(",
"blocks",
".",
"items",
"(",
")",
")",
":"... | Function to validate input layer stored in scenario file.
Check whether the files that are used in scenario file need to be
updated or not.
:param blocks: dictionary from read_scenarios
:type blocks: dictionary
:param scenario_directory: directory where scenario text file is saved
:type scena... | [
"Function",
"to",
"validate",
"input",
"layer",
"stored",
"in",
"scenario",
"file",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L908-L942 | train | 26,762 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | append_row | def append_row(table, label, data):
"""Append new row to table widget.
:param table: The table that shall have the row added to it.
:type table: QTableWidget
:param label: Label for the row.
:type label: str
:param data: custom data associated with label value.
:type data: str
"""
... | python | def append_row(table, label, data):
"""Append new row to table widget.
:param table: The table that shall have the row added to it.
:type table: QTableWidget
:param label: Label for the row.
:type label: str
:param data: custom data associated with label value.
:type data: str
"""
... | [
"def",
"append_row",
"(",
"table",
",",
"label",
",",
"data",
")",
":",
"# noinspection PyUnresolvedReferences",
"count",
"=",
"table",
".",
"rowCount",
"(",
")",
"# noinspection PyUnresolvedReferences",
"table",
".",
"insertRow",
"(",
"table",
".",
"rowCount",
"(... | Append new row to table widget.
:param table: The table that shall have the row added to it.
:type table: QTableWidget
:param label: Label for the row.
:type label: str
:param data: custom data associated with label value.
:type data: str | [
"Append",
"new",
"row",
"to",
"table",
"widget",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L945-L976 | train | 26,763 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.restore_state | def restore_state(self):
"""Restore GUI state from configuration file."""
# restore last source path
last_source_path = setting(
'lastSourceDir', self.default_directory, expected_type=str)
self.source_directory.setText(last_source_path)
# restore path pdf output
... | python | def restore_state(self):
"""Restore GUI state from configuration file."""
# restore last source path
last_source_path = setting(
'lastSourceDir', self.default_directory, expected_type=str)
self.source_directory.setText(last_source_path)
# restore path pdf output
... | [
"def",
"restore_state",
"(",
"self",
")",
":",
"# restore last source path",
"last_source_path",
"=",
"setting",
"(",
"'lastSourceDir'",
",",
"self",
".",
"default_directory",
",",
"expected_type",
"=",
"str",
")",
"self",
".",
"source_directory",
".",
"setText",
... | Restore GUI state from configuration file. | [
"Restore",
"GUI",
"state",
"from",
"configuration",
"file",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L169-L185 | train | 26,764 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.save_state | def save_state(self):
"""Save current state of GUI to configuration file."""
set_setting('lastSourceDir', self.source_directory.text())
set_setting('lastOutputDir', self.output_directory.text())
set_setting(
'useDefaultOutputDir', self.scenario_directory_radio.isChecked()) | python | def save_state(self):
"""Save current state of GUI to configuration file."""
set_setting('lastSourceDir', self.source_directory.text())
set_setting('lastOutputDir', self.output_directory.text())
set_setting(
'useDefaultOutputDir', self.scenario_directory_radio.isChecked()) | [
"def",
"save_state",
"(",
"self",
")",
":",
"set_setting",
"(",
"'lastSourceDir'",
",",
"self",
".",
"source_directory",
".",
"text",
"(",
")",
")",
"set_setting",
"(",
"'lastOutputDir'",
",",
"self",
".",
"output_directory",
".",
"text",
"(",
")",
")",
"s... | Save current state of GUI to configuration file. | [
"Save",
"current",
"state",
"of",
"GUI",
"to",
"configuration",
"file",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L187-L192 | train | 26,765 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.choose_directory | def choose_directory(self, line_edit, title):
""" Show a directory selection dialog.
This function will show the dialog then set line_edit widget
text with output from the dialog.
:param line_edit: Widget whose text should be updated.
:type line_edit: QLineEdit
:param t... | python | def choose_directory(self, line_edit, title):
""" Show a directory selection dialog.
This function will show the dialog then set line_edit widget
text with output from the dialog.
:param line_edit: Widget whose text should be updated.
:type line_edit: QLineEdit
:param t... | [
"def",
"choose_directory",
"(",
"self",
",",
"line_edit",
",",
"title",
")",
":",
"path",
"=",
"line_edit",
".",
"text",
"(",
")",
"# noinspection PyCallByClass,PyTypeChecker",
"new_path",
"=",
"QFileDialog",
".",
"getExistingDirectory",
"(",
"self",
",",
"title",... | Show a directory selection dialog.
This function will show the dialog then set line_edit widget
text with output from the dialog.
:param line_edit: Widget whose text should be updated.
:type line_edit: QLineEdit
:param title: title of dialog
:type title: str, QString | [
"Show",
"a",
"directory",
"selection",
"dialog",
".",
"This",
"function",
"will",
"show",
"the",
"dialog",
"then",
"set",
"line_edit",
"widget",
"text",
"with",
"output",
"from",
"the",
"dialog",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L194-L210 | train | 26,766 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.populate_table | def populate_table(self, scenario_directory):
""" Populate table with files from scenario_directory directory.
:param scenario_directory: Path where .txt & .py reside.
:type scenario_directory: QString
"""
parsed_files = []
unparsed_files = []
self.table.clearCon... | python | def populate_table(self, scenario_directory):
""" Populate table with files from scenario_directory directory.
:param scenario_directory: Path where .txt & .py reside.
:type scenario_directory: QString
"""
parsed_files = []
unparsed_files = []
self.table.clearCon... | [
"def",
"populate_table",
"(",
"self",
",",
"scenario_directory",
")",
":",
"parsed_files",
"=",
"[",
"]",
"unparsed_files",
"=",
"[",
"]",
"self",
".",
"table",
".",
"clearContents",
"(",
")",
"# Block signal to allow update checking only when the table is ready",
"se... | Populate table with files from scenario_directory directory.
:param scenario_directory: Path where .txt & .py reside.
:type scenario_directory: QString | [
"Populate",
"table",
"with",
"files",
"from",
"scenario_directory",
"directory",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L213-L251 | train | 26,767 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.run_script | def run_script(self, filename):
""" Run a python script in QGIS to exercise InaSAFE functionality.
This functionality was originally intended for verifying that the key
elements are InaSAFE are loading correctly and available. However,
the utility of this function is such that you can r... | python | def run_script(self, filename):
""" Run a python script in QGIS to exercise InaSAFE functionality.
This functionality was originally intended for verifying that the key
elements are InaSAFE are loading correctly and available. However,
the utility of this function is such that you can r... | [
"def",
"run_script",
"(",
"self",
",",
"filename",
")",
":",
"module",
",",
"_",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"module",
"in",
"sys",
".",
"modules",
":",
"script",
"=",
"reload",
"(",
"sys",
".",
"modules",
"... | Run a python script in QGIS to exercise InaSAFE functionality.
This functionality was originally intended for verifying that the key
elements are InaSAFE are loading correctly and available. However,
the utility of this function is such that you can run any arbitrary
python scripts with... | [
"Run",
"a",
"python",
"script",
"in",
"QGIS",
"to",
"exercise",
"InaSAFE",
"functionality",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L254-L278 | train | 26,768 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.reset_status | def reset_status(self):
"""Set all scenarios' status to empty in the table."""
for row in range(self.table.rowCount()):
status_item = self.table.item(row, 1)
status_item.setText(self.tr('')) | python | def reset_status(self):
"""Set all scenarios' status to empty in the table."""
for row in range(self.table.rowCount()):
status_item = self.table.item(row, 1)
status_item.setText(self.tr('')) | [
"def",
"reset_status",
"(",
"self",
")",
":",
"for",
"row",
"in",
"range",
"(",
"self",
".",
"table",
".",
"rowCount",
"(",
")",
")",
":",
"status_item",
"=",
"self",
".",
"table",
".",
"item",
"(",
"row",
",",
"1",
")",
"status_item",
".",
"setTex... | Set all scenarios' status to empty in the table. | [
"Set",
"all",
"scenarios",
"status",
"to",
"empty",
"in",
"the",
"table",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L280-L284 | train | 26,769 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.prepare_task | def prepare_task(self, items):
"""Prepare scenario for impact function variable.
:param items: Dictionary containing settings for impact function.
:type items: Python dictionary.
:return: A tuple containing True and dictionary containing parameters
if post processor su... | python | def prepare_task(self, items):
"""Prepare scenario for impact function variable.
:param items: Dictionary containing settings for impact function.
:type items: Python dictionary.
:return: A tuple containing True and dictionary containing parameters
if post processor su... | [
"def",
"prepare_task",
"(",
"self",
",",
"items",
")",
":",
"status",
"=",
"True",
"message",
"=",
"''",
"# get hazard",
"if",
"'hazard'",
"in",
"items",
":",
"hazard_path",
"=",
"items",
"[",
"'hazard'",
"]",
"hazard",
"=",
"self",
".",
"define_layer",
... | Prepare scenario for impact function variable.
:param items: Dictionary containing settings for impact function.
:type items: Python dictionary.
:return: A tuple containing True and dictionary containing parameters
if post processor success. Or False and an error message
... | [
"Prepare",
"scenario",
"for",
"impact",
"function",
"variable",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L286-L371 | train | 26,770 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.set_layer_visible | def set_layer_visible(layer, visible):
"""Sets a layer in the project visible or not
:param layer: layer to change
:type layer: QgsMapLayer
:param visible: True to show layer, False to hide layer
:type visible: bool
"""
if layer is None:
return
... | python | def set_layer_visible(layer, visible):
"""Sets a layer in the project visible or not
:param layer: layer to change
:type layer: QgsMapLayer
:param visible: True to show layer, False to hide layer
:type visible: bool
"""
if layer is None:
return
... | [
"def",
"set_layer_visible",
"(",
"layer",
",",
"visible",
")",
":",
"if",
"layer",
"is",
"None",
":",
"return",
"QgsProject",
".",
"instance",
"(",
")",
".",
"layerTreeRoot",
"(",
")",
".",
"findLayer",
"(",
"layer",
".",
"id",
"(",
")",
")",
".",
"s... | Sets a layer in the project visible or not
:param layer: layer to change
:type layer: QgsMapLayer
:param visible: True to show layer, False to hide layer
:type visible: bool | [
"Sets",
"a",
"layer",
"in",
"the",
"project",
"visible",
"or",
"not"
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L404-L417 | train | 26,771 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.run_selected_clicked | def run_selected_clicked(self):
"""Run the selected scenario."""
# get all selected rows
rows = sorted(set(index.row() for index in
self.table.selectedIndexes()))
self.enable_busy_cursor()
# iterate over selected rows
for row in rows:
... | python | def run_selected_clicked(self):
"""Run the selected scenario."""
# get all selected rows
rows = sorted(set(index.row() for index in
self.table.selectedIndexes()))
self.enable_busy_cursor()
# iterate over selected rows
for row in rows:
... | [
"def",
"run_selected_clicked",
"(",
"self",
")",
":",
"# get all selected rows",
"rows",
"=",
"sorted",
"(",
"set",
"(",
"index",
".",
"row",
"(",
")",
"for",
"index",
"in",
"self",
".",
"table",
".",
"selectedIndexes",
"(",
")",
")",
")",
"self",
".",
... | Run the selected scenario. | [
"Run",
"the",
"selected",
"scenario",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L598-L610 | train | 26,772 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.run_all_clicked | def run_all_clicked(self):
"""Run all scenario when pbRunAll is clicked."""
self.reset_status()
self.enable_busy_cursor()
report = []
fail_count = 0
pass_count = 0
index = 0
for row in range(self.table.rowCount()):
item = self.table.item(row,... | python | def run_all_clicked(self):
"""Run all scenario when pbRunAll is clicked."""
self.reset_status()
self.enable_busy_cursor()
report = []
fail_count = 0
pass_count = 0
index = 0
for row in range(self.table.rowCount()):
item = self.table.item(row,... | [
"def",
"run_all_clicked",
"(",
"self",
")",
":",
"self",
".",
"reset_status",
"(",
")",
"self",
".",
"enable_busy_cursor",
"(",
")",
"report",
"=",
"[",
"]",
"fail_count",
"=",
"0",
"pass_count",
"=",
"0",
"index",
"=",
"0",
"for",
"row",
"in",
"range"... | Run all scenario when pbRunAll is clicked. | [
"Run",
"all",
"scenario",
"when",
"pbRunAll",
"is",
"clicked",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L613-L654 | train | 26,773 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.write_report | def write_report(self, report, pass_count, fail_count):
"""Write a report status of Batch Runner.
For convenience, the name will use current time.
:param report: A list of each scenario and its status.
:type report: list
:param pass_count: Number of passing scenarios.
... | python | def write_report(self, report, pass_count, fail_count):
"""Write a report status of Batch Runner.
For convenience, the name will use current time.
:param report: A list of each scenario and its status.
:type report: list
:param pass_count: Number of passing scenarios.
... | [
"def",
"write_report",
"(",
"self",
",",
"report",
",",
"pass_count",
",",
"fail_count",
")",
":",
"separator",
"=",
"'-----------------------------\\n'",
"current_time",
"=",
"datetime",
".",
"now",
"(",
")",
".",
"strftime",
"(",
"'%Y%m%d%H%M%S'",
")",
"report... | Write a report status of Batch Runner.
For convenience, the name will use current time.
:param report: A list of each scenario and its status.
:type report: list
:param pass_count: Number of passing scenarios.
:type pass_count: int
:param fail_count: Number of failed ... | [
"Write",
"a",
"report",
"status",
"of",
"Batch",
"Runner",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L656-L697 | train | 26,774 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.generate_pdf_report | def generate_pdf_report(self, impact_function, iface, scenario_name):
"""Generate and store map and impact report from impact function.
Directory where the report stored is specified by user input from the
dialog. This function is adapted from analysis_utilities.py
:param impact_functi... | python | def generate_pdf_report(self, impact_function, iface, scenario_name):
"""Generate and store map and impact report from impact function.
Directory where the report stored is specified by user input from the
dialog. This function is adapted from analysis_utilities.py
:param impact_functi... | [
"def",
"generate_pdf_report",
"(",
"self",
",",
"impact_function",
",",
"iface",
",",
"scenario_name",
")",
":",
"# output folder",
"output_dir",
"=",
"self",
".",
"output_directory",
".",
"text",
"(",
")",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"... | Generate and store map and impact report from impact function.
Directory where the report stored is specified by user input from the
dialog. This function is adapted from analysis_utilities.py
:param impact_function: Impact Function.
:type impact_function: ImpactFunction()
:pa... | [
"Generate",
"and",
"store",
"map",
"and",
"impact",
"report",
"from",
"impact",
"function",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L699-L741 | train | 26,775 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.show_report | def show_report(self, report_path):
"""Show batch report file in batchReportFileName using an external app.
This method uses QDesktop services to display the report (typically
using gedit or similar text editor).
:param report_path: Path to the file of batch report.
:type repor... | python | def show_report(self, report_path):
"""Show batch report file in batchReportFileName using an external app.
This method uses QDesktop services to display the report (typically
using gedit or similar text editor).
:param report_path: Path to the file of batch report.
:type repor... | [
"def",
"show_report",
"(",
"self",
",",
"report_path",
")",
":",
"if",
"self",
".",
"show_results_popup",
":",
"url",
"=",
"QtCore",
".",
"QUrl",
".",
"fromLocalFile",
"(",
"report_path",
")",
"# noinspection PyTypeChecker,PyCallByClass,PyArgumentList",
"QtGui",
"."... | Show batch report file in batchReportFileName using an external app.
This method uses QDesktop services to display the report (typically
using gedit or similar text editor).
:param report_path: Path to the file of batch report.
:type report_path: str | [
"Show",
"batch",
"report",
"file",
"in",
"batchReportFileName",
"using",
"an",
"external",
"app",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L743-L759 | train | 26,776 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.update_default_output_dir | def update_default_output_dir(self):
"""Update output dir if set to default."""
if self.scenario_directory_radio.isChecked():
self.output_directory.setText(self.source_directory.text()) | python | def update_default_output_dir(self):
"""Update output dir if set to default."""
if self.scenario_directory_radio.isChecked():
self.output_directory.setText(self.source_directory.text()) | [
"def",
"update_default_output_dir",
"(",
"self",
")",
":",
"if",
"self",
".",
"scenario_directory_radio",
".",
"isChecked",
"(",
")",
":",
"self",
".",
"output_directory",
".",
"setText",
"(",
"self",
".",
"source_directory",
".",
"text",
"(",
")",
")"
] | Update output dir if set to default. | [
"Update",
"output",
"dir",
"if",
"set",
"to",
"default",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L761-L764 | train | 26,777 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.enable_busy_cursor | def enable_busy_cursor(self):
"""Set the hourglass enabled."""
QgsApplication.instance().setOverrideCursor(
QtGui.QCursor(QtCore.Qt.WaitCursor)
) | python | def enable_busy_cursor(self):
"""Set the hourglass enabled."""
QgsApplication.instance().setOverrideCursor(
QtGui.QCursor(QtCore.Qt.WaitCursor)
) | [
"def",
"enable_busy_cursor",
"(",
"self",
")",
":",
"QgsApplication",
".",
"instance",
"(",
")",
".",
"setOverrideCursor",
"(",
"QtGui",
".",
"QCursor",
"(",
"QtCore",
".",
"Qt",
".",
"WaitCursor",
")",
")"
] | Set the hourglass enabled. | [
"Set",
"the",
"hourglass",
"enabled",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L767-L771 | train | 26,778 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.on_scenario_directory_radio_toggled | def on_scenario_directory_radio_toggled(self, flag):
"""Autoconnect slot activated when scenario_directory_radio is checked.
:param flag: Flag indicating whether the checkbox was toggled on or
off.
:type flag: bool
"""
if flag:
self.output_directory.setTe... | python | def on_scenario_directory_radio_toggled(self, flag):
"""Autoconnect slot activated when scenario_directory_radio is checked.
:param flag: Flag indicating whether the checkbox was toggled on or
off.
:type flag: bool
"""
if flag:
self.output_directory.setTe... | [
"def",
"on_scenario_directory_radio_toggled",
"(",
"self",
",",
"flag",
")",
":",
"if",
"flag",
":",
"self",
".",
"output_directory",
".",
"setText",
"(",
"self",
".",
"source_directory",
".",
"text",
"(",
")",
")",
"self",
".",
"output_directory_chooser",
"."... | Autoconnect slot activated when scenario_directory_radio is checked.
:param flag: Flag indicating whether the checkbox was toggled on or
off.
:type flag: bool | [
"Autoconnect",
"slot",
"activated",
"when",
"scenario_directory_radio",
"is",
"checked",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L779-L788 | train | 26,779 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.on_source_directory_chooser_clicked | def on_source_directory_chooser_clicked(self):
"""Autoconnect slot activated when tbSourceDir is clicked."""
title = self.tr('Set the source directory for script and scenario')
self.choose_directory(self.source_directory, title) | python | def on_source_directory_chooser_clicked(self):
"""Autoconnect slot activated when tbSourceDir is clicked."""
title = self.tr('Set the source directory for script and scenario')
self.choose_directory(self.source_directory, title) | [
"def",
"on_source_directory_chooser_clicked",
"(",
"self",
")",
":",
"title",
"=",
"self",
".",
"tr",
"(",
"'Set the source directory for script and scenario'",
")",
"self",
".",
"choose_directory",
"(",
"self",
".",
"source_directory",
",",
"title",
")"
] | Autoconnect slot activated when tbSourceDir is clicked. | [
"Autoconnect",
"slot",
"activated",
"when",
"tbSourceDir",
"is",
"clicked",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L791-L795 | train | 26,780 |
inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.on_output_directory_chooser_clicked | def on_output_directory_chooser_clicked(self):
"""Auto connect slot activated when tbOutputDiris clicked."""
title = self.tr('Set the output directory for pdf report files')
self.choose_directory(self.output_directory, title) | python | def on_output_directory_chooser_clicked(self):
"""Auto connect slot activated when tbOutputDiris clicked."""
title = self.tr('Set the output directory for pdf report files')
self.choose_directory(self.output_directory, title) | [
"def",
"on_output_directory_chooser_clicked",
"(",
"self",
")",
":",
"title",
"=",
"self",
".",
"tr",
"(",
"'Set the output directory for pdf report files'",
")",
"self",
".",
"choose_directory",
"(",
"self",
".",
"output_directory",
",",
"title",
")"
] | Auto connect slot activated when tbOutputDiris clicked. | [
"Auto",
"connect",
"slot",
"activated",
"when",
"tbOutputDiris",
"clicked",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L798-L801 | train | 26,781 |
inasafe/inasafe | safe/messaging/item/cell.py | Cell.to_html | def to_html(self):
"""Render a Cell MessageElement as html
:returns: The html representation of the Cell MessageElement
:rtype: basestring
"""
# Apply bootstrap alignment classes first
if self.align is 'left':
if self.style_class is None:
self... | python | def to_html(self):
"""Render a Cell MessageElement as html
:returns: The html representation of the Cell MessageElement
:rtype: basestring
"""
# Apply bootstrap alignment classes first
if self.align is 'left':
if self.style_class is None:
self... | [
"def",
"to_html",
"(",
"self",
")",
":",
"# Apply bootstrap alignment classes first",
"if",
"self",
".",
"align",
"is",
"'left'",
":",
"if",
"self",
".",
"style_class",
"is",
"None",
":",
"self",
".",
"style_class",
"=",
"'text-left'",
"else",
":",
"self",
"... | Render a Cell MessageElement as html
:returns: The html representation of the Cell MessageElement
:rtype: basestring | [
"Render",
"a",
"Cell",
"MessageElement",
"as",
"html"
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/messaging/item/cell.py#L104-L141 | train | 26,782 |
inasafe/inasafe | safe/messaging/example/error_message_example.py | error_creator5 | def error_creator5():
"""Raise a safe style error and append a full message."""
try:
error_creator4()
except SafeError as e4:
message = ErrorMessage(
'Creator 5 problem',
detail=Message(
Paragraph('Could not', ImportantText('call'), 'function.'),
... | python | def error_creator5():
"""Raise a safe style error and append a full message."""
try:
error_creator4()
except SafeError as e4:
message = ErrorMessage(
'Creator 5 problem',
detail=Message(
Paragraph('Could not', ImportantText('call'), 'function.'),
... | [
"def",
"error_creator5",
"(",
")",
":",
"try",
":",
"error_creator4",
"(",
")",
"except",
"SafeError",
"as",
"e4",
":",
"message",
"=",
"ErrorMessage",
"(",
"'Creator 5 problem'",
",",
"detail",
"=",
"Message",
"(",
"Paragraph",
"(",
"'Could not'",
",",
"Imp... | Raise a safe style error and append a full message. | [
"Raise",
"a",
"safe",
"style",
"error",
"and",
"append",
"a",
"full",
"message",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/messaging/example/error_message_example.py#L77-L89 | train | 26,783 |
inasafe/inasafe | safe/report/extractors/composer.py | qgis_composer_infographic_extractor | def qgis_composer_infographic_extractor(impact_report, component_metadata):
"""Extract composer context specific for infographic template.
This method extract necessary context for a given impact report and
component metadata and save the context so it can be used in composer
rendering phase
:para... | python | def qgis_composer_infographic_extractor(impact_report, component_metadata):
"""Extract composer context specific for infographic template.
This method extract necessary context for a given impact report and
component metadata and save the context so it can be used in composer
rendering phase
:para... | [
"def",
"qgis_composer_infographic_extractor",
"(",
"impact_report",
",",
"component_metadata",
")",
":",
"qgis_context",
"=",
"impact_report",
".",
"qgis_composition_context",
"extra_args",
"=",
"component_metadata",
".",
"extra_args",
"context",
"=",
"QGISComposerContext",
... | Extract composer context specific for infographic template.
This method extract necessary context for a given impact report and
component metadata and save the context so it can be used in composer
rendering phase
:param impact_report: the impact report that acts as a proxy to fetch
all the da... | [
"Extract",
"composer",
"context",
"specific",
"for",
"infographic",
"template",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/extractors/composer.py#L488-L574 | train | 26,784 |
inasafe/inasafe | safe/gui/tools/wizard/step_kw45_inasafe_fields.py | StepKwInaSAFEFields.inasafe_fields_for_the_layer | def inasafe_fields_for_the_layer(self):
"""Return a list of inasafe fields the current layer.
:returns: A list where each value represents inasafe field.
:rtype: list
"""
if (self.parent.get_layer_geometry_key()
== layer_geometry_raster['key']):
retur... | python | def inasafe_fields_for_the_layer(self):
"""Return a list of inasafe fields the current layer.
:returns: A list where each value represents inasafe field.
:rtype: list
"""
if (self.parent.get_layer_geometry_key()
== layer_geometry_raster['key']):
retur... | [
"def",
"inasafe_fields_for_the_layer",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"parent",
".",
"get_layer_geometry_key",
"(",
")",
"==",
"layer_geometry_raster",
"[",
"'key'",
"]",
")",
":",
"return",
"[",
"]",
"# Get hazard or exposure value",
"layer_purpos... | Return a list of inasafe fields the current layer.
:returns: A list where each value represents inasafe field.
:rtype: list | [
"Return",
"a",
"list",
"of",
"inasafe",
"fields",
"the",
"current",
"layer",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw45_inasafe_fields.py#L87-L116 | train | 26,785 |
inasafe/inasafe | safe/utilities/unicode.py | __if_not_basestring | def __if_not_basestring(text_object):
"""Convert to str"""
converted_str = text_object
if not isinstance(text_object, str):
converted_str = str(text_object)
return converted_str | python | def __if_not_basestring(text_object):
"""Convert to str"""
converted_str = text_object
if not isinstance(text_object, str):
converted_str = str(text_object)
return converted_str | [
"def",
"__if_not_basestring",
"(",
"text_object",
")",
":",
"converted_str",
"=",
"text_object",
"if",
"not",
"isinstance",
"(",
"text_object",
",",
"str",
")",
":",
"converted_str",
"=",
"str",
"(",
"text_object",
")",
"return",
"converted_str"
] | Convert to str | [
"Convert",
"to",
"str"
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/unicode.py#L25-L30 | train | 26,786 |
inasafe/inasafe | safe/utilities/unicode.py | get_string | def get_string(input_text, encoding='utf-8'):
"""Get byte string representation of an object.
:param input_text: The input text.
:type input_text: unicode, str, float, int
:param encoding: The encoding used to do the conversion, default to utf-8.
:type encoding: str
:returns: Byte string rep... | python | def get_string(input_text, encoding='utf-8'):
"""Get byte string representation of an object.
:param input_text: The input text.
:type input_text: unicode, str, float, int
:param encoding: The encoding used to do the conversion, default to utf-8.
:type encoding: str
:returns: Byte string rep... | [
"def",
"get_string",
"(",
"input_text",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"if",
"isinstance",
"(",
"input_text",
",",
"str",
")",
":",
"return",
"input_text",
".",
"encode",
"(",
"encoding",
")",
"return",
"input_text"
] | Get byte string representation of an object.
:param input_text: The input text.
:type input_text: unicode, str, float, int
:param encoding: The encoding used to do the conversion, default to utf-8.
:type encoding: str
:returns: Byte string representation of the input.
:rtype: bytes | [
"Get",
"byte",
"string",
"representation",
"of",
"an",
"object",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/unicode.py#L50-L64 | train | 26,787 |
inasafe/inasafe | safe/utilities/unicode.py | byteify | def byteify(input_object):
"""Recursive function to transform an object to byte.
:param input_object: A python object such as unicode, dictionary or list.
:type: unicode, list, dict
:return: The object with byte only.
"""
if isinstance(input_object, dict):
return {byteify(key): byteify... | python | def byteify(input_object):
"""Recursive function to transform an object to byte.
:param input_object: A python object such as unicode, dictionary or list.
:type: unicode, list, dict
:return: The object with byte only.
"""
if isinstance(input_object, dict):
return {byteify(key): byteify... | [
"def",
"byteify",
"(",
"input_object",
")",
":",
"if",
"isinstance",
"(",
"input_object",
",",
"dict",
")",
":",
"return",
"{",
"byteify",
"(",
"key",
")",
":",
"byteify",
"(",
"value",
")",
"for",
"key",
",",
"value",
"in",
"list",
"(",
"input_object"... | Recursive function to transform an object to byte.
:param input_object: A python object such as unicode, dictionary or list.
:type: unicode, list, dict
:return: The object with byte only. | [
"Recursive",
"function",
"to",
"transform",
"an",
"object",
"to",
"byte",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/unicode.py#L67-L83 | train | 26,788 |
inasafe/inasafe | safe/metadata35/impact_layer_metadata.py | ImpactLayerMetadata.dict | def dict(self):
"""
calls the overridden method and adds provenance and summary data
:return: dictionary representation of the metadata
:rtype: dict
"""
metadata = super(ImpactLayerMetadata, self).dict
metadata['provenance'] = self.provenance
metadata['s... | python | def dict(self):
"""
calls the overridden method and adds provenance and summary data
:return: dictionary representation of the metadata
:rtype: dict
"""
metadata = super(ImpactLayerMetadata, self).dict
metadata['provenance'] = self.provenance
metadata['s... | [
"def",
"dict",
"(",
"self",
")",
":",
"metadata",
"=",
"super",
"(",
"ImpactLayerMetadata",
",",
"self",
")",
".",
"dict",
"metadata",
"[",
"'provenance'",
"]",
"=",
"self",
".",
"provenance",
"metadata",
"[",
"'summary_data'",
"]",
"=",
"self",
".",
"su... | calls the overridden method and adds provenance and summary data
:return: dictionary representation of the metadata
:rtype: dict | [
"calls",
"the",
"overridden",
"method",
"and",
"adds",
"provenance",
"and",
"summary",
"data"
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/metadata35/impact_layer_metadata.py#L203-L215 | train | 26,789 |
inasafe/inasafe | safe/metadata35/impact_layer_metadata.py | ImpactLayerMetadata._read_provenance_from_xml | def _read_provenance_from_xml(self, root):
"""
read metadata provenance from xml.
:param root: container in which we search
:type root: ElementTree.Element
"""
path = self._special_properties['provenance']
provenance = root.find(path, XML_NS)
for step in ... | python | def _read_provenance_from_xml(self, root):
"""
read metadata provenance from xml.
:param root: container in which we search
:type root: ElementTree.Element
"""
path = self._special_properties['provenance']
provenance = root.find(path, XML_NS)
for step in ... | [
"def",
"_read_provenance_from_xml",
"(",
"self",
",",
"root",
")",
":",
"path",
"=",
"self",
".",
"_special_properties",
"[",
"'provenance'",
"]",
"provenance",
"=",
"root",
".",
"find",
"(",
"path",
",",
"XML_NS",
")",
"for",
"step",
"in",
"provenance",
"... | read metadata provenance from xml.
:param root: container in which we search
:type root: ElementTree.Element | [
"read",
"metadata",
"provenance",
"from",
"xml",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/metadata35/impact_layer_metadata.py#L312-L339 | train | 26,790 |
inasafe/inasafe | safe/metadata35/impact_layer_metadata.py | ImpactLayerMetadata.append_provenance_step | def append_provenance_step(self, title, description, timestamp=None):
"""
Add a step to the provenance of the metadata
:param title: The title of the step.
:type title: str
:param description: The content of the step
:type description: str
:param timestamp: the... | python | def append_provenance_step(self, title, description, timestamp=None):
"""
Add a step to the provenance of the metadata
:param title: The title of the step.
:type title: str
:param description: The content of the step
:type description: str
:param timestamp: the... | [
"def",
"append_provenance_step",
"(",
"self",
",",
"title",
",",
"description",
",",
"timestamp",
"=",
"None",
")",
":",
"step_time",
"=",
"self",
".",
"_provenance",
".",
"append_step",
"(",
"title",
",",
"description",
",",
"timestamp",
")",
"if",
"step_ti... | Add a step to the provenance of the metadata
:param title: The title of the step.
:type title: str
:param description: The content of the step
:type description: str
:param timestamp: the time of the step
:type timestamp: datetime, str | [
"Add",
"a",
"step",
"to",
"the",
"provenance",
"of",
"the",
"metadata"
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/metadata35/impact_layer_metadata.py#L354-L369 | train | 26,791 |
inasafe/inasafe | safe/metadata35/impact_layer_metadata.py | ImpactLayerMetadata.append_if_provenance_step | def append_if_provenance_step(
self, title, description, timestamp=None, data=None):
"""Add a if provenance step to the provenance of the metadata
:param title: The title of the step.
:type title: str
:param description: The content of the step
:type description: st... | python | def append_if_provenance_step(
self, title, description, timestamp=None, data=None):
"""Add a if provenance step to the provenance of the metadata
:param title: The title of the step.
:type title: str
:param description: The content of the step
:type description: st... | [
"def",
"append_if_provenance_step",
"(",
"self",
",",
"title",
",",
"description",
",",
"timestamp",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"step_time",
"=",
"self",
".",
"_provenance",
".",
"append_if_provenance_step",
"(",
"title",
",",
"descriptio... | Add a if provenance step to the provenance of the metadata
:param title: The title of the step.
:type title: str
:param description: The content of the step
:type description: str
:param timestamp: the time of the step
:type timestamp: datetime, str
:param dat... | [
"Add",
"a",
"if",
"provenance",
"step",
"to",
"the",
"provenance",
"of",
"the",
"metadata"
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/metadata35/impact_layer_metadata.py#L371-L390 | train | 26,792 |
inasafe/inasafe | safe/metadata35/impact_layer_metadata.py | ImpactLayerMetadata.update_from_dict | def update_from_dict(self, keywords):
"""Update metadata value from a keywords dictionary.
:param keywords:
:return:
"""
super(ImpactLayerMetadata, self).update_from_dict(keywords)
if 'if_provenance' in list(keywords.keys()):
if_provenance = keywords['if_pro... | python | def update_from_dict(self, keywords):
"""Update metadata value from a keywords dictionary.
:param keywords:
:return:
"""
super(ImpactLayerMetadata, self).update_from_dict(keywords)
if 'if_provenance' in list(keywords.keys()):
if_provenance = keywords['if_pro... | [
"def",
"update_from_dict",
"(",
"self",
",",
"keywords",
")",
":",
"super",
"(",
"ImpactLayerMetadata",
",",
"self",
")",
".",
"update_from_dict",
"(",
"keywords",
")",
"if",
"'if_provenance'",
"in",
"list",
"(",
"keywords",
".",
"keys",
"(",
")",
")",
":"... | Update metadata value from a keywords dictionary.
:param keywords:
:return: | [
"Update",
"metadata",
"value",
"from",
"a",
"keywords",
"dictionary",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/metadata35/impact_layer_metadata.py#L392-L403 | train | 26,793 |
inasafe/inasafe | safe/common/parameters/group_select_parameter_widget.py | GroupSelectParameterWidget.update_list_widget | def update_list_widget(self):
"""Update list widget when radio button is clicked."""
# Get selected radio button
radio_button_checked_id = self.input_button_group.checkedId()
# No radio button checked, then default value = None
if radio_button_checked_id > -1:
selecte... | python | def update_list_widget(self):
"""Update list widget when radio button is clicked."""
# Get selected radio button
radio_button_checked_id = self.input_button_group.checkedId()
# No radio button checked, then default value = None
if radio_button_checked_id > -1:
selecte... | [
"def",
"update_list_widget",
"(",
"self",
")",
":",
"# Get selected radio button",
"radio_button_checked_id",
"=",
"self",
".",
"input_button_group",
".",
"checkedId",
"(",
")",
"# No radio button checked, then default value = None",
"if",
"radio_button_checked_id",
">",
"-",... | Update list widget when radio button is clicked. | [
"Update",
"list",
"widget",
"when",
"radio",
"button",
"is",
"clicked",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/common/parameters/group_select_parameter_widget.py#L180-L198 | train | 26,794 |
inasafe/inasafe | safe/common/parameters/group_select_parameter_widget.py | GroupSelectParameterWidget.radio_buttons_clicked | def radio_buttons_clicked(self):
"""Handler when selected radio button changed."""
# Disable all spin boxes
for spin_box in list(self.spin_boxes.values()):
spin_box.setEnabled(False)
# Disable list widget
self.list_widget.setEnabled(False)
# Get selected radi... | python | def radio_buttons_clicked(self):
"""Handler when selected radio button changed."""
# Disable all spin boxes
for spin_box in list(self.spin_boxes.values()):
spin_box.setEnabled(False)
# Disable list widget
self.list_widget.setEnabled(False)
# Get selected radi... | [
"def",
"radio_buttons_clicked",
"(",
"self",
")",
":",
"# Disable all spin boxes",
"for",
"spin_box",
"in",
"list",
"(",
"self",
".",
"spin_boxes",
".",
"values",
"(",
")",
")",
":",
"spin_box",
".",
"setEnabled",
"(",
"False",
")",
"# Disable list widget",
"s... | Handler when selected radio button changed. | [
"Handler",
"when",
"selected",
"radio",
"button",
"changed",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/common/parameters/group_select_parameter_widget.py#L200-L220 | train | 26,795 |
inasafe/inasafe | safe/common/parameters/group_select_parameter_widget.py | GroupSelectParameterWidget.select_radio_button | def select_radio_button(self, key):
"""Helper to select a radio button with key.
:param key: The key of the radio button.
:type key: str
"""
key_index = list(self._parameter.options.keys()).index(key)
radio_button = self.input_button_group.button(key_index)
radio... | python | def select_radio_button(self, key):
"""Helper to select a radio button with key.
:param key: The key of the radio button.
:type key: str
"""
key_index = list(self._parameter.options.keys()).index(key)
radio_button = self.input_button_group.button(key_index)
radio... | [
"def",
"select_radio_button",
"(",
"self",
",",
"key",
")",
":",
"key_index",
"=",
"list",
"(",
"self",
".",
"_parameter",
".",
"options",
".",
"keys",
"(",
")",
")",
".",
"index",
"(",
"key",
")",
"radio_button",
"=",
"self",
".",
"input_button_group",
... | Helper to select a radio button with key.
:param key: The key of the radio button.
:type key: str | [
"Helper",
"to",
"select",
"a",
"radio",
"button",
"with",
"key",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/common/parameters/group_select_parameter_widget.py#L222-L230 | train | 26,796 |
inasafe/inasafe | safe/messaging/item/brand.py | Brand.to_html | def to_html(self):
"""Render as html.
"""
uri = resource_url(
resources_path('img', 'logos', 'inasafe-logo-white.png'))
snippet = (
'<div class="branding">'
'<img src="%s" title="%s" alt="%s" %s/></div>') % (
uri,
'InaSA... | python | def to_html(self):
"""Render as html.
"""
uri = resource_url(
resources_path('img', 'logos', 'inasafe-logo-white.png'))
snippet = (
'<div class="branding">'
'<img src="%s" title="%s" alt="%s" %s/></div>') % (
uri,
'InaSA... | [
"def",
"to_html",
"(",
"self",
")",
":",
"uri",
"=",
"resource_url",
"(",
"resources_path",
"(",
"'img'",
",",
"'logos'",
",",
"'inasafe-logo-white.png'",
")",
")",
"snippet",
"=",
"(",
"'<div class=\"branding\">'",
"'<img src=\"%s\" title=\"%s\" alt=\"%s\" %s/></div>'"... | Render as html. | [
"Render",
"as",
"html",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/messaging/item/brand.py#L52-L64 | train | 26,797 |
inasafe/inasafe | safe/report/extractors/mmi_detail.py | mmi_detail_extractor | def mmi_detail_extractor(impact_report, component_metadata):
"""Extracting MMI-related analysis result.
This extractor should only be used for EQ Raster with Population.
:param impact_report: the impact report that acts as a proxy to fetch
all the data that extractor needed
:type impact_report... | python | def mmi_detail_extractor(impact_report, component_metadata):
"""Extracting MMI-related analysis result.
This extractor should only be used for EQ Raster with Population.
:param impact_report: the impact report that acts as a proxy to fetch
all the data that extractor needed
:type impact_report... | [
"def",
"mmi_detail_extractor",
"(",
"impact_report",
",",
"component_metadata",
")",
":",
"context",
"=",
"{",
"}",
"analysis_layer",
"=",
"impact_report",
".",
"analysis",
"analysis_layer_keywords",
"=",
"analysis_layer",
".",
"keywords",
"extra_args",
"=",
"componen... | Extracting MMI-related analysis result.
This extractor should only be used for EQ Raster with Population.
:param impact_report: the impact report that acts as a proxy to fetch
all the data that extractor needed
:type impact_report: safe.report.impact_report.ImpactReport
:param component_metad... | [
"Extracting",
"MMI",
"-",
"related",
"analysis",
"result",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/extractors/mmi_detail.py#L21-L137 | train | 26,798 |
inasafe/inasafe | safe/report/expressions/infographic.py | inasafe_field_header | def inasafe_field_header(field, feature, parent):
"""Retrieve a header name of the field name from definitions.
For instance:
inasafe_field_header('minimum_needs__clean_water') -> 'Clean water'
"""
_ = feature, parent # NOQA
age_fields = [under_5_displaced_count_field, over_60_displaced_count_... | python | def inasafe_field_header(field, feature, parent):
"""Retrieve a header name of the field name from definitions.
For instance:
inasafe_field_header('minimum_needs__clean_water') -> 'Clean water'
"""
_ = feature, parent # NOQA
age_fields = [under_5_displaced_count_field, over_60_displaced_count_... | [
"def",
"inasafe_field_header",
"(",
"field",
",",
"feature",
",",
"parent",
")",
":",
"_",
"=",
"feature",
",",
"parent",
"# NOQA",
"age_fields",
"=",
"[",
"under_5_displaced_count_field",
",",
"over_60_displaced_count_field",
"]",
"symbol_mapping",
"=",
"{",
"'ov... | Retrieve a header name of the field name from definitions.
For instance:
inasafe_field_header('minimum_needs__clean_water') -> 'Clean water' | [
"Retrieve",
"a",
"header",
"name",
"of",
"the",
"field",
"name",
"from",
"definitions",
"."
] | 831d60abba919f6d481dc94a8d988cc205130724 | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/infographic.py#L55-L88 | train | 26,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.