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/report/impact_report.py
ImpactReport.output_folder
def output_folder(self, value): """Output folder path for the rendering. :param value: output folder path :type value: str """ self._output_folder = value if not os.path.exists(self._output_folder): os.makedirs(self._output_folder)
python
def output_folder(self, value): """Output folder path for the rendering. :param value: output folder path :type value: str """ self._output_folder = value if not os.path.exists(self._output_folder): os.makedirs(self._output_folder)
[ "def", "output_folder", "(", "self", ",", "value", ")", ":", "self", ".", "_output_folder", "=", "value", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "_output_folder", ")", ":", "os", ".", "makedirs", "(", "self", ".", "_output_fol...
Output folder path for the rendering. :param value: output folder path :type value: str
[ "Output", "folder", "path", "for", "the", "rendering", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/impact_report.py#L368-L376
train
26,600
inasafe/inasafe
safe/report/impact_report.py
ImpactReport._check_layer_count
def _check_layer_count(self, layer): """Check for the validity of the layer. :param layer: QGIS layer :type layer: qgis.core.QgsVectorLayer :return: """ if layer: if not layer.isValid(): raise ImpactReport.LayerException('Layer is not valid') ...
python
def _check_layer_count(self, layer): """Check for the validity of the layer. :param layer: QGIS layer :type layer: qgis.core.QgsVectorLayer :return: """ if layer: if not layer.isValid(): raise ImpactReport.LayerException('Layer is not valid') ...
[ "def", "_check_layer_count", "(", "self", ",", "layer", ")", ":", "if", "layer", ":", "if", "not", "layer", ".", "isValid", "(", ")", ":", "raise", "ImpactReport", ".", "LayerException", "(", "'Layer is not valid'", ")", "if", "isinstance", "(", "layer", "...
Check for the validity of the layer. :param layer: QGIS layer :type layer: qgis.core.QgsVectorLayer :return:
[ "Check", "for", "the", "validity", "of", "the", "layer", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/impact_report.py#L455-L471
train
26,601
inasafe/inasafe
safe/report/impact_report.py
ImpactReport.map_title
def map_title(self): """Get the map title from the layer keywords if possible. :returns: None on error, otherwise the title. :rtype: None, str """ # noinspection PyBroadException try: title = self._keyword_io.read_keywords( self.impact, 'map_t...
python
def map_title(self): """Get the map title from the layer keywords if possible. :returns: None on error, otherwise the title. :rtype: None, str """ # noinspection PyBroadException try: title = self._keyword_io.read_keywords( self.impact, 'map_t...
[ "def", "map_title", "(", "self", ")", ":", "# noinspection PyBroadException", "try", ":", "title", "=", "self", ".", "_keyword_io", ".", "read_keywords", "(", "self", ".", "impact", ",", "'map_title'", ")", "return", "title", "except", "KeywordNotFoundError", ":...
Get the map title from the layer keywords if possible. :returns: None on error, otherwise the title. :rtype: None, str
[ "Get", "the", "map", "title", "from", "the", "layer", "keywords", "if", "possible", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/impact_report.py#L674-L688
train
26,602
inasafe/inasafe
safe/report/impact_report.py
ImpactReport.map_legend_attributes
def map_legend_attributes(self): """Get the map legend attribute from the layer keywords if possible. :returns: None on error, otherwise the attributes (notes and units). :rtype: None, str """ LOGGER.debug('InaSAFE Map getMapLegendAttributes called') legend_attribute_lis...
python
def map_legend_attributes(self): """Get the map legend attribute from the layer keywords if possible. :returns: None on error, otherwise the attributes (notes and units). :rtype: None, str """ LOGGER.debug('InaSAFE Map getMapLegendAttributes called') legend_attribute_lis...
[ "def", "map_legend_attributes", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "'InaSAFE Map getMapLegendAttributes called'", ")", "legend_attribute_list", "=", "[", "'legend_notes'", ",", "'legend_units'", ",", "'legend_title'", "]", "legend_attribute_dict", "=", ...
Get the map legend attribute from the layer keywords if possible. :returns: None on error, otherwise the attributes (notes and units). :rtype: None, str
[ "Get", "the", "map", "legend", "attribute", "from", "the", "layer", "keywords", "if", "possible", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/impact_report.py#L691-L713
train
26,603
inasafe/inasafe
safe/datastore/geopackage.py
GeoPackage._vector_layers
def _vector_layers(self): """Return a list of vector layers available. :return: List of vector layers available in the geopackage. :rtype: list .. versionadded:: 4.0 """ layers = [] vector_datasource = self.vector_driver.Open( self.uri.absoluteFilePa...
python
def _vector_layers(self): """Return a list of vector layers available. :return: List of vector layers available in the geopackage. :rtype: list .. versionadded:: 4.0 """ layers = [] vector_datasource = self.vector_driver.Open( self.uri.absoluteFilePa...
[ "def", "_vector_layers", "(", "self", ")", ":", "layers", "=", "[", "]", "vector_datasource", "=", "self", ".", "vector_driver", ".", "Open", "(", "self", ".", "uri", ".", "absoluteFilePath", "(", ")", ")", "if", "vector_datasource", ":", "for", "i", "in...
Return a list of vector layers available. :return: List of vector layers available in the geopackage. :rtype: list .. versionadded:: 4.0
[ "Return", "a", "list", "of", "vector", "layers", "available", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/datastore/geopackage.py#L103-L117
train
26,604
inasafe/inasafe
safe/datastore/geopackage.py
GeoPackage._raster_layers
def _raster_layers(self): """Return a list of raster layers available. :return: List of raster layers available in the geopackage. :rtype: list .. versionadded:: 4.0 """ layers = [] raster_datasource = gdal.Open(self.uri.absoluteFilePath()) if raster_da...
python
def _raster_layers(self): """Return a list of raster layers available. :return: List of raster layers available in the geopackage. :rtype: list .. versionadded:: 4.0 """ layers = [] raster_datasource = gdal.Open(self.uri.absoluteFilePath()) if raster_da...
[ "def", "_raster_layers", "(", "self", ")", ":", "layers", "=", "[", "]", "raster_datasource", "=", "gdal", ".", "Open", "(", "self", ".", "uri", ".", "absoluteFilePath", "(", ")", ")", "if", "raster_datasource", ":", "subdatasets", "=", "raster_datasource", ...
Return a list of raster layers available. :return: List of raster layers available in the geopackage. :rtype: list .. versionadded:: 4.0
[ "Return", "a", "list", "of", "raster", "layers", "available", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/datastore/geopackage.py#L119-L139
train
26,605
inasafe/inasafe
safe/datastore/geopackage.py
GeoPackage._add_vector_layer
def _add_vector_layer(self, vector_layer, layer_name, save_style=False): """Add a vector layer to the geopackage. :param vector_layer: The layer to add. :type vector_layer: QgsVectorLayer :param layer_name: The name of the layer in the datastore. :type layer_name: str ...
python
def _add_vector_layer(self, vector_layer, layer_name, save_style=False): """Add a vector layer to the geopackage. :param vector_layer: The layer to add. :type vector_layer: QgsVectorLayer :param layer_name: The name of the layer in the datastore. :type layer_name: str ...
[ "def", "_add_vector_layer", "(", "self", ",", "vector_layer", ",", "layer_name", ",", "save_style", "=", "False", ")", ":", "# Fixme", "# if not self.is_writable():", "# return False, 'The destination is not writable.'", "geometry", "=", "QGIS_OGR_GEOMETRY_MAP", "[", "ve...
Add a vector layer to the geopackage. :param vector_layer: The layer to add. :type vector_layer: QgsVectorLayer :param layer_name: The name of the layer in the datastore. :type layer_name: str :param save_style: If we have to save a QML too. Default to False. Not imple...
[ "Add", "a", "vector", "layer", "to", "the", "geopackage", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/datastore/geopackage.py#L182-L228
train
26,606
inasafe/inasafe
safe/datastore/geopackage.py
GeoPackage._add_tabular_layer
def _add_tabular_layer(self, tabular_layer, layer_name, save_style=False): """Add a tabular layer to the geopackage. :param tabular_layer: The layer to add. :type tabular_layer: QgsVectorLayer :param layer_name: The name of the layer in the datastore. :type layer_name: str ...
python
def _add_tabular_layer(self, tabular_layer, layer_name, save_style=False): """Add a tabular layer to the geopackage. :param tabular_layer: The layer to add. :type tabular_layer: QgsVectorLayer :param layer_name: The name of the layer in the datastore. :type layer_name: str ...
[ "def", "_add_tabular_layer", "(", "self", ",", "tabular_layer", ",", "layer_name", ",", "save_style", "=", "False", ")", ":", "return", "self", ".", "_add_vector_layer", "(", "tabular_layer", ",", "layer_name", ",", "save_style", ")" ]
Add a tabular layer to the geopackage. :param tabular_layer: The layer to add. :type tabular_layer: QgsVectorLayer :param layer_name: The name of the layer in the datastore. :type layer_name: str :param save_style: If we have to save a QML too. Default to False. Not im...
[ "Add", "a", "tabular", "layer", "to", "the", "geopackage", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/datastore/geopackage.py#L275-L295
train
26,607
inasafe/inasafe
safe/gui/tools/wizard/step_fc20_hazlayer_from_canvas.py
StepFcHazLayerFromCanvas.selected_canvas_hazlayer
def selected_canvas_hazlayer(self): """Obtain the canvas layer selected by user. :returns: The currently selected map layer in the list. :rtype: QgsMapLayer """ if self.lstCanvasHazLayers.selectedItems(): item = self.lstCanvasHazLayers.currentItem() else: ...
python
def selected_canvas_hazlayer(self): """Obtain the canvas layer selected by user. :returns: The currently selected map layer in the list. :rtype: QgsMapLayer """ if self.lstCanvasHazLayers.selectedItems(): item = self.lstCanvasHazLayers.currentItem() else: ...
[ "def", "selected_canvas_hazlayer", "(", "self", ")", ":", "if", "self", ".", "lstCanvasHazLayers", ".", "selectedItems", "(", ")", ":", "item", "=", "self", ".", "lstCanvasHazLayers", ".", "currentItem", "(", ")", "else", ":", "return", "None", "try", ":", ...
Obtain the canvas layer selected by user. :returns: The currently selected map layer in the list. :rtype: QgsMapLayer
[ "Obtain", "the", "canvas", "layer", "selected", "by", "user", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_fc20_hazlayer_from_canvas.py#L72-L90
train
26,608
inasafe/inasafe
safe/gui/tools/wizard/step_fc20_hazlayer_from_canvas.py
StepFcHazLayerFromCanvas.list_compatible_canvas_layers
def list_compatible_canvas_layers(self): """Fill the list widget with compatible layers. :returns: Metadata of found layers. :rtype: list of dicts """ italic_font = QFont() italic_font.setItalic(True) list_widget = self.lstCanvasHazLayers # Add compatible...
python
def list_compatible_canvas_layers(self): """Fill the list widget with compatible layers. :returns: Metadata of found layers. :rtype: list of dicts """ italic_font = QFont() italic_font.setItalic(True) list_widget = self.lstCanvasHazLayers # Add compatible...
[ "def", "list_compatible_canvas_layers", "(", "self", ")", ":", "italic_font", "=", "QFont", "(", ")", "italic_font", ".", "setItalic", "(", "True", ")", "list_widget", "=", "self", ".", "lstCanvasHazLayers", "# Add compatible layers", "list_widget", ".", "clear", ...
Fill the list widget with compatible layers. :returns: Metadata of found layers. :rtype: list of dicts
[ "Fill", "the", "list", "widget", "with", "compatible", "layers", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_fc20_hazlayer_from_canvas.py#L92-L108
train
26,609
inasafe/inasafe
safe/gui/tools/wizard/step_fc20_hazlayer_from_canvas.py
StepFcHazLayerFromCanvas.set_widgets
def set_widgets(self): """Set widgets on the Hazard Layer From TOC tab.""" # The list is already populated in the previous step, but now we # need to do it again in case we're back from the Keyword Wizard. # First, preserve self.parent.layer before clearing the list last_layer = ...
python
def set_widgets(self): """Set widgets on the Hazard Layer From TOC tab.""" # The list is already populated in the previous step, but now we # need to do it again in case we're back from the Keyword Wizard. # First, preserve self.parent.layer before clearing the list last_layer = ...
[ "def", "set_widgets", "(", "self", ")", ":", "# The list is already populated in the previous step, but now we", "# need to do it again in case we're back from the Keyword Wizard.", "# First, preserve self.parent.layer before clearing the list", "last_layer", "=", "self", ".", "parent", ...
Set widgets on the Hazard Layer From TOC tab.
[ "Set", "widgets", "on", "the", "Hazard", "Layer", "From", "TOC", "tab", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_fc20_hazlayer_from_canvas.py#L110-L132
train
26,610
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.performance_log_message
def performance_log_message(self): """Return the profiling log as a message.""" message = m.Message() table = m.Table(style_class='table table-condensed table-striped') row = m.Row() row.add(m.Cell(tr('Function'), header=True)) row.add(m.Cell(tr('Time'), header=True)) ...
python
def performance_log_message(self): """Return the profiling log as a message.""" message = m.Message() table = m.Table(style_class='table table-condensed table-striped') row = m.Row() row.add(m.Cell(tr('Function'), header=True)) row.add(m.Cell(tr('Time'), header=True)) ...
[ "def", "performance_log_message", "(", "self", ")", ":", "message", "=", "m", ".", "Message", "(", ")", "table", "=", "m", ".", "Table", "(", "style_class", "=", "'table table-condensed table-striped'", ")", "row", "=", "m", ".", "Row", "(", ")", "row", ...
Return the profiling log as a message.
[ "Return", "the", "profiling", "log", "as", "a", "message", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L461-L513
train
26,611
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.requested_extent
def requested_extent(self, extent): """Setter for extent property. :param extent: Analysis boundaries expressed as a QgsRectangle. The extent CRS should match the crs property of this IF instance. :type extent: QgsRectangle """ if isinstance(extent, QgsRe...
python
def requested_extent(self, extent): """Setter for extent property. :param extent: Analysis boundaries expressed as a QgsRectangle. The extent CRS should match the crs property of this IF instance. :type extent: QgsRectangle """ if isinstance(extent, QgsRe...
[ "def", "requested_extent", "(", "self", ",", "extent", ")", ":", "if", "isinstance", "(", "extent", ",", "QgsRectangle", ")", ":", "self", ".", "_requested_extent", "=", "extent", "self", ".", "_is_ready", "=", "False", "else", ":", "raise", "InvalidExtentEr...
Setter for extent property. :param extent: Analysis boundaries expressed as a QgsRectangle. The extent CRS should match the crs property of this IF instance. :type extent: QgsRectangle
[ "Setter", "for", "extent", "property", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L748-L760
train
26,612
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.crs
def crs(self, crs): """Setter for extent_crs property. :param crs: The coordinate reference system for the analysis boundary. :type crs: QgsCoordinateReferenceSystem """ if isinstance(crs, QgsCoordinateReferenceSystem): self._crs = crs self._is_ready = Fa...
python
def crs(self, crs): """Setter for extent_crs property. :param crs: The coordinate reference system for the analysis boundary. :type crs: QgsCoordinateReferenceSystem """ if isinstance(crs, QgsCoordinateReferenceSystem): self._crs = crs self._is_ready = Fa...
[ "def", "crs", "(", "self", ",", "crs", ")", ":", "if", "isinstance", "(", "crs", ",", "QgsCoordinateReferenceSystem", ")", ":", "self", ".", "_crs", "=", "crs", "self", ".", "_is_ready", "=", "False", "else", ":", "raise", "InvalidExtentError", "(", "'%s...
Setter for extent_crs property. :param crs: The coordinate reference system for the analysis boundary. :type crs: QgsCoordinateReferenceSystem
[ "Setter", "for", "extent_crs", "property", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L775-L785
train
26,613
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.datastore
def datastore(self, datastore): """Setter for the datastore. :param datastore: The datastore. :type datastore: DataStore """ if isinstance(datastore, DataStore): self._datastore = datastore else: raise Exception('%s is not a valid datastore.' % da...
python
def datastore(self, datastore): """Setter for the datastore. :param datastore: The datastore. :type datastore: DataStore """ if isinstance(datastore, DataStore): self._datastore = datastore else: raise Exception('%s is not a valid datastore.' % da...
[ "def", "datastore", "(", "self", ",", "datastore", ")", ":", "if", "isinstance", "(", "datastore", ",", "DataStore", ")", ":", "self", ".", "_datastore", "=", "datastore", "else", ":", "raise", "Exception", "(", "'%s is not a valid datastore.'", "%", "datastor...
Setter for the datastore. :param datastore: The datastore. :type datastore: DataStore
[ "Setter", "for", "the", "datastore", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L806-L815
train
26,614
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.duration
def duration(self): """The duration of running the impact function in seconds. Return 0 if the start or end datetime is None. :return: The duration. :rtype: float """ if self.end_datetime is None or self.start_datetime is None: return 0 return (self....
python
def duration(self): """The duration of running the impact function in seconds. Return 0 if the start or end datetime is None. :return: The duration. :rtype: float """ if self.end_datetime is None or self.start_datetime is None: return 0 return (self....
[ "def", "duration", "(", "self", ")", ":", "if", "self", ".", "end_datetime", "is", "None", "or", "self", ".", "start_datetime", "is", "None", ":", "return", "0", "return", "(", "self", ".", "end_datetime", "-", "self", ".", "start_datetime", ")", ".", ...
The duration of running the impact function in seconds. Return 0 if the start or end datetime is None. :return: The duration. :rtype: float
[ "The", "duration", "of", "running", "the", "impact", "function", "in", "seconds", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L854-L864
train
26,615
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.console_progress_callback
def console_progress_callback(current, maximum, message=None): """Simple console based callback implementation for tests. :param current: Current progress. :type current: int :param maximum: Maximum range (point at which task is complete. :type maximum: int :param mess...
python
def console_progress_callback(current, maximum, message=None): """Simple console based callback implementation for tests. :param current: Current progress. :type current: int :param maximum: Maximum range (point at which task is complete. :type maximum: int :param mess...
[ "def", "console_progress_callback", "(", "current", ",", "maximum", ",", "message", "=", "None", ")", ":", "# noinspection PyChainedComparisons", "if", "maximum", ">", "1000", "and", "current", "%", "1000", "!=", "0", "and", "current", "!=", "maximum", ":", "r...
Simple console based callback implementation for tests. :param current: Current progress. :type current: int :param maximum: Maximum range (point at which task is complete. :type maximum: int :param message: Optional message dictionary to containing content we can ...
[ "Simple", "console", "based", "callback", "implementation", "for", "tests", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L909-L928
train
26,616
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.set_state_process
def set_state_process(self, context, process): """Method to append process for a context in the IF state. :param context: It can be a layer purpose or a section (impact function, post processor). :type context: str, unicode :param process: A text explain the process. ...
python
def set_state_process(self, context, process): """Method to append process for a context in the IF state. :param context: It can be a layer purpose or a section (impact function, post processor). :type context: str, unicode :param process: A text explain the process. ...
[ "def", "set_state_process", "(", "self", ",", "context", ",", "process", ")", ":", "LOGGER", ".", "info", "(", "'%s: %s'", "%", "(", "context", ",", "process", ")", ")", "self", ".", "state", "[", "context", "]", "[", "\"process\"", "]", ".", "append",...
Method to append process for a context in the IF state. :param context: It can be a layer purpose or a section (impact function, post processor). :type context: str, unicode :param process: A text explain the process. :type process: str, unicode
[ "Method", "to", "append", "process", "for", "a", "context", "in", "the", "IF", "state", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L959-L970
train
26,617
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.set_state_info
def set_state_info(self, context, key, value): """Method to add information for a context in the IF state. :param context: It can be a layer purpose or a section (impact function, post processor). :type context: str, unicode :param key: A key for the information, e.g. algor...
python
def set_state_info(self, context, key, value): """Method to add information for a context in the IF state. :param context: It can be a layer purpose or a section (impact function, post processor). :type context: str, unicode :param key: A key for the information, e.g. algor...
[ "def", "set_state_info", "(", "self", ",", "context", ",", "key", ",", "value", ")", ":", "LOGGER", ".", "info", "(", "'%s: %s: %s'", "%", "(", "context", ",", "key", ",", "value", ")", ")", "self", ".", "state", "[", "context", "]", "[", "\"info\"",...
Method to add information for a context in the IF state. :param context: It can be a layer purpose or a section (impact function, post processor). :type context: str, unicode :param key: A key for the information, e.g. algorithm. :type key: str, unicode :param valu...
[ "Method", "to", "add", "information", "for", "a", "context", "in", "the", "IF", "state", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L972-L986
train
26,618
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.debug_layer
def debug_layer(self, layer, check_fields=True, add_to_datastore=None): """Write the layer produced to the datastore if debug mode is on. :param layer: The QGIS layer to check and save. :type layer: QgsMapLayer :param check_fields: Boolean to check or not inasafe_fields. By...
python
def debug_layer(self, layer, check_fields=True, add_to_datastore=None): """Write the layer produced to the datastore if debug mode is on. :param layer: The QGIS layer to check and save. :type layer: QgsMapLayer :param check_fields: Boolean to check or not inasafe_fields. By...
[ "def", "debug_layer", "(", "self", ",", "layer", ",", "check_fields", "=", "True", ",", "add_to_datastore", "=", "None", ")", ":", "# This one checks the memory layer.", "check_layer", "(", "layer", ",", "has_geometry", "=", "None", ")", "if", "isinstance", "(",...
Write the layer produced to the datastore if debug mode is on. :param layer: The QGIS layer to check and save. :type layer: QgsMapLayer :param check_fields: Boolean to check or not inasafe_fields. By default, it's true. :type check_fields: bool :param add_to_datast...
[ "Write", "the", "layer", "produced", "to", "the", "datastore", "if", "debug", "mode", "is", "on", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L1369-L1423
train
26,619
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.pre_process
def pre_process(self): """Run every pre-processors. Preprocessors are creating new layers with a specific layer_purpose. This layer is added then to the datastore. :return: Nothing """ LOGGER.info('ANALYSIS : Pre processing') for pre_processor in self._preproce...
python
def pre_process(self): """Run every pre-processors. Preprocessors are creating new layers with a specific layer_purpose. This layer is added then to the datastore. :return: Nothing """ LOGGER.info('ANALYSIS : Pre processing') for pre_processor in self._preproce...
[ "def", "pre_process", "(", "self", ")", ":", "LOGGER", ".", "info", "(", "'ANALYSIS : Pre processing'", ")", "for", "pre_processor", "in", "self", ".", "_preprocessors", ":", "layer", "=", "pre_processor", "[", "'process'", "]", "[", "'function'", "]", "(", ...
Run every pre-processors. Preprocessors are creating new layers with a specific layer_purpose. This layer is added then to the datastore. :return: Nothing
[ "Run", "every", "pre", "-", "processors", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L1878-L1902
train
26,620
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.hazard_preparation
def hazard_preparation(self): """This function is doing the hazard preparation.""" LOGGER.info('ANALYSIS : Hazard preparation') use_same_projection = ( self.hazard.crs().authid() == self._crs.authid()) self.set_state_info( 'hazard', 'use_same_projecti...
python
def hazard_preparation(self): """This function is doing the hazard preparation.""" LOGGER.info('ANALYSIS : Hazard preparation') use_same_projection = ( self.hazard.crs().authid() == self._crs.authid()) self.set_state_info( 'hazard', 'use_same_projecti...
[ "def", "hazard_preparation", "(", "self", ")", ":", "LOGGER", ".", "info", "(", "'ANALYSIS : Hazard preparation'", ")", "use_same_projection", "=", "(", "self", ".", "hazard", ".", "crs", "(", ")", ".", "authid", "(", ")", "==", "self", ".", "_crs", ".", ...
This function is doing the hazard preparation.
[ "This", "function", "is", "doing", "the", "hazard", "preparation", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2129-L2205
train
26,621
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.aggregate_hazard_preparation
def aggregate_hazard_preparation(self): """This function is doing the aggregate hazard layer. It will prepare the aggregate layer and intersect hazard polygons with aggregation areas and assign hazard class. """ LOGGER.info('ANALYSIS : Aggregate hazard preparation') self...
python
def aggregate_hazard_preparation(self): """This function is doing the aggregate hazard layer. It will prepare the aggregate layer and intersect hazard polygons with aggregation areas and assign hazard class. """ LOGGER.info('ANALYSIS : Aggregate hazard preparation') self...
[ "def", "aggregate_hazard_preparation", "(", "self", ")", ":", "LOGGER", ".", "info", "(", "'ANALYSIS : Aggregate hazard preparation'", ")", "self", ".", "set_state_process", "(", "'hazard'", ",", "'Make hazard layer valid'", ")", "self", ".", "hazard", "=", "clean_lay...
This function is doing the aggregate hazard layer. It will prepare the aggregate layer and intersect hazard polygons with aggregation areas and assign hazard class.
[ "This", "function", "is", "doing", "the", "aggregate", "hazard", "layer", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2208-L2224
train
26,622
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.exposure_preparation
def exposure_preparation(self): """This function is doing the exposure preparation.""" LOGGER.info('ANALYSIS : Exposure preparation') use_same_projection = ( self.exposure.crs().authid() == self._crs.authid()) self.set_state_info( 'exposure', 'use_sam...
python
def exposure_preparation(self): """This function is doing the exposure preparation.""" LOGGER.info('ANALYSIS : Exposure preparation') use_same_projection = ( self.exposure.crs().authid() == self._crs.authid()) self.set_state_info( 'exposure', 'use_sam...
[ "def", "exposure_preparation", "(", "self", ")", ":", "LOGGER", ".", "info", "(", "'ANALYSIS : Exposure preparation'", ")", "use_same_projection", "=", "(", "self", ".", "exposure", ".", "crs", "(", ")", ".", "authid", "(", ")", "==", "self", ".", "_crs", ...
This function is doing the exposure preparation.
[ "This", "function", "is", "doing", "the", "exposure", "preparation", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2227-L2307
train
26,623
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.intersect_exposure_and_aggregate_hazard
def intersect_exposure_and_aggregate_hazard(self): """This function intersects the exposure with the aggregate hazard. If the the exposure is a continuous raster exposure, this function will set the aggregate hazard layer. However, this function will set the impact layer. ""...
python
def intersect_exposure_and_aggregate_hazard(self): """This function intersects the exposure with the aggregate hazard. If the the exposure is a continuous raster exposure, this function will set the aggregate hazard layer. However, this function will set the impact layer. ""...
[ "def", "intersect_exposure_and_aggregate_hazard", "(", "self", ")", ":", "LOGGER", ".", "info", "(", "'ANALYSIS : Intersect Exposure and Aggregate Hazard'", ")", "if", "is_raster_layer", "(", "self", ".", "exposure", ")", ":", "self", ".", "set_state_process", "(", "'...
This function intersects the exposure with the aggregate hazard. If the the exposure is a continuous raster exposure, this function will set the aggregate hazard layer. However, this function will set the impact layer.
[ "This", "function", "intersects", "the", "exposure", "with", "the", "aggregate", "hazard", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2310-L2400
train
26,624
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.post_process
def post_process(self, layer): """More process after getting the impact layer with data. :param layer: The vector layer to use for post processing. :type layer: QgsVectorLayer """ LOGGER.info('ANALYSIS : Post processing') # Set the layer title purpose = layer.ke...
python
def post_process(self, layer): """More process after getting the impact layer with data. :param layer: The vector layer to use for post processing. :type layer: QgsVectorLayer """ LOGGER.info('ANALYSIS : Post processing') # Set the layer title purpose = layer.ke...
[ "def", "post_process", "(", "self", ",", "layer", ")", ":", "LOGGER", ".", "info", "(", "'ANALYSIS : Post processing'", ")", "# Set the layer title", "purpose", "=", "layer", ".", "keywords", "[", "'layer_purpose'", "]", "if", "purpose", "!=", "layer_purpose_aggre...
More process after getting the impact layer with data. :param layer: The vector layer to use for post processing. :type layer: QgsVectorLayer
[ "More", "process", "after", "getting", "the", "impact", "layer", "with", "data", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2403-L2439
train
26,625
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.summary_calculation
def summary_calculation(self): """Do the summary calculation. We do not check layers here, we will check them in the next step. """ LOGGER.info('ANALYSIS : Summary calculation') if is_vector_layer(self._exposure_summary): # With continuous exposure, we don't have an ...
python
def summary_calculation(self): """Do the summary calculation. We do not check layers here, we will check them in the next step. """ LOGGER.info('ANALYSIS : Summary calculation') if is_vector_layer(self._exposure_summary): # With continuous exposure, we don't have an ...
[ "def", "summary_calculation", "(", "self", ")", ":", "LOGGER", ".", "info", "(", "'ANALYSIS : Summary calculation'", ")", "if", "is_vector_layer", "(", "self", ".", "_exposure_summary", ")", ":", "# With continuous exposure, we don't have an exposure summary layer", "self",...
Do the summary calculation. We do not check layers here, we will check them in the next step.
[ "Do", "the", "summary", "calculation", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2442-L2476
train
26,626
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.style
def style(self): """Function to apply some styles to the layers.""" LOGGER.info('ANALYSIS : Styling') classes = generate_classified_legend( self.analysis_impacted, self.exposure, self.hazard, self.use_rounding, self.debug_mode) ...
python
def style(self): """Function to apply some styles to the layers.""" LOGGER.info('ANALYSIS : Styling') classes = generate_classified_legend( self.analysis_impacted, self.exposure, self.hazard, self.use_rounding, self.debug_mode) ...
[ "def", "style", "(", "self", ")", ":", "LOGGER", ".", "info", "(", "'ANALYSIS : Styling'", ")", "classes", "=", "generate_classified_legend", "(", "self", ".", "analysis_impacted", ",", "self", ".", "exposure", ",", "self", ".", "hazard", ",", "self", ".", ...
Function to apply some styles to the layers.
[ "Function", "to", "apply", "some", "styles", "to", "the", "layers", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2478-L2510
train
26,627
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.exposure_notes
def exposure_notes(self): """Get the exposure specific notes defined in definitions. This method will do a lookup in definitions and return the exposure definition specific notes dictionary. This is a helper function to make it easy to get exposure specific notes from the defin...
python
def exposure_notes(self): """Get the exposure specific notes defined in definitions. This method will do a lookup in definitions and return the exposure definition specific notes dictionary. This is a helper function to make it easy to get exposure specific notes from the defin...
[ "def", "exposure_notes", "(", "self", ")", ":", "notes", "=", "[", "]", "exposure", "=", "definition", "(", "self", ".", "exposure", ".", "keywords", ".", "get", "(", "'exposure'", ")", ")", "if", "'notes'", "in", "exposure", ":", "notes", "+=", "expos...
Get the exposure specific notes defined in definitions. This method will do a lookup in definitions and return the exposure definition specific notes dictionary. This is a helper function to make it easy to get exposure specific notes from the definitions metadata. .. versiona...
[ "Get", "the", "exposure", "specific", "notes", "defined", "in", "definitions", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2607-L2632
train
26,628
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.hazard_notes
def hazard_notes(self): """Get the hazard specific notes defined in definitions. This method will do a lookup in definitions and return the hazard definition specific notes dictionary. This is a helper function to make it easy to get hazard specific notes from the definitions m...
python
def hazard_notes(self): """Get the hazard specific notes defined in definitions. This method will do a lookup in definitions and return the hazard definition specific notes dictionary. This is a helper function to make it easy to get hazard specific notes from the definitions m...
[ "def", "hazard_notes", "(", "self", ")", ":", "notes", "=", "[", "]", "hazard", "=", "definition", "(", "self", ".", "hazard", ".", "keywords", ".", "get", "(", "'hazard'", ")", ")", "if", "'notes'", "in", "hazard", ":", "notes", "+=", "hazard", "[",...
Get the hazard specific notes defined in definitions. This method will do a lookup in definitions and return the hazard definition specific notes dictionary. This is a helper function to make it easy to get hazard specific notes from the definitions metadata. .. versionadded::...
[ "Get", "the", "hazard", "specific", "notes", "defined", "in", "definitions", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2634-L2666
train
26,629
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.notes
def notes(self): """Return the notes section of the report. .. versionadded:: 3.5 :return: The notes that should be attached to this impact report. :rtype: list """ fields = [] # Notes still to be defined for ASH # include any generic exposure specific notes fr...
python
def notes(self): """Return the notes section of the report. .. versionadded:: 3.5 :return: The notes that should be attached to this impact report. :rtype: list """ fields = [] # Notes still to be defined for ASH # include any generic exposure specific notes fr...
[ "def", "notes", "(", "self", ")", ":", "fields", "=", "[", "]", "# Notes still to be defined for ASH", "# include any generic exposure specific notes from definitions", "fields", "=", "fields", "+", "self", ".", "exposure_notes", "(", ")", "# include any generic hazard spec...
Return the notes section of the report. .. versionadded:: 3.5 :return: The notes that should be attached to this impact report. :rtype: list
[ "Return", "the", "notes", "section", "of", "the", "report", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2668-L2693
train
26,630
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.action_checklist
def action_checklist(self): """Return the list of action check list dictionary. :return: The list of action check list dictionary. :rtype: list """ actions = [] exposure = definition(self.exposure.keywords.get('exposure')) actions.extend(exposure.get('actions')) ...
python
def action_checklist(self): """Return the list of action check list dictionary. :return: The list of action check list dictionary. :rtype: list """ actions = [] exposure = definition(self.exposure.keywords.get('exposure')) actions.extend(exposure.get('actions')) ...
[ "def", "action_checklist", "(", "self", ")", ":", "actions", "=", "[", "]", "exposure", "=", "definition", "(", "self", ".", "exposure", ".", "keywords", ".", "get", "(", "'exposure'", ")", ")", "actions", ".", "extend", "(", "exposure", ".", "get", "(...
Return the list of action check list dictionary. :return: The list of action check list dictionary. :rtype: list
[ "Return", "the", "list", "of", "action", "check", "list", "dictionary", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2695-L2709
train
26,631
inasafe/inasafe
safe/utilities/memory_checker.py
memory_error
def memory_error(): """Display an error when there is not enough memory.""" warning_heading = m.Heading( tr('Memory issue'), **WARNING_STYLE) warning_message = tr( 'There is not enough free memory to run this analysis.') suggestion_heading = m.Heading( tr('Suggestion'), **SUGGEST...
python
def memory_error(): """Display an error when there is not enough memory.""" warning_heading = m.Heading( tr('Memory issue'), **WARNING_STYLE) warning_message = tr( 'There is not enough free memory to run this analysis.') suggestion_heading = m.Heading( tr('Suggestion'), **SUGGEST...
[ "def", "memory_error", "(", ")", ":", "warning_heading", "=", "m", ".", "Heading", "(", "tr", "(", "'Memory issue'", ")", ",", "*", "*", "WARNING_STYLE", ")", "warning_message", "=", "tr", "(", "'There is not enough free memory to run this analysis.'", ")", "sugge...
Display an error when there is not enough memory.
[ "Display", "an", "error", "when", "there", "is", "not", "enough", "memory", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/memory_checker.py#L162-L180
train
26,632
inasafe/inasafe
scripts/create_api_docs.py
create_top_level_index_entry
def create_top_level_index_entry(title, max_depth, subtitles): """Function for creating a text entry in index.rst for its content. :param title : Title for the content. :type title: str :param max_depth : Value for max_depth in the top level index content. :type max_depth: int :param subtitle...
python
def create_top_level_index_entry(title, max_depth, subtitles): """Function for creating a text entry in index.rst for its content. :param title : Title for the content. :type title: str :param max_depth : Value for max_depth in the top level index content. :type max_depth: int :param subtitle...
[ "def", "create_top_level_index_entry", "(", "title", ",", "max_depth", ",", "subtitles", ")", ":", "return_text", "=", "title", "+", "'\\n'", "dash", "=", "'-'", "*", "len", "(", "title", ")", "+", "'\\n'", "return_text", "+=", "dash", "+", "'\\n'", "retur...
Function for creating a text entry in index.rst for its content. :param title : Title for the content. :type title: str :param max_depth : Value for max_depth in the top level index content. :type max_depth: int :param subtitles : list of subtitles that is available. :type subtitles: list ...
[ "Function", "for", "creating", "a", "text", "entry", "in", "index", ".", "rst", "for", "its", "content", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/scripts/create_api_docs.py#L24-L49
train
26,633
inasafe/inasafe
scripts/create_api_docs.py
create_package_level_rst_index_file
def create_package_level_rst_index_file( package_name, max_depth, modules, inner_packages=None): """Function for creating text for index for a package. :param package_name: name of the package :type package_name: str :param max_depth: Value for max_depth in the index file. :type max_depth:...
python
def create_package_level_rst_index_file( package_name, max_depth, modules, inner_packages=None): """Function for creating text for index for a package. :param package_name: name of the package :type package_name: str :param max_depth: Value for max_depth in the index file. :type max_depth:...
[ "def", "create_package_level_rst_index_file", "(", "package_name", ",", "max_depth", ",", "modules", ",", "inner_packages", "=", "None", ")", ":", "if", "inner_packages", "is", "None", ":", "inner_packages", "=", "[", "]", "return_text", "=", "'Package::'", "+", ...
Function for creating text for index for a package. :param package_name: name of the package :type package_name: str :param max_depth: Value for max_depth in the index file. :type max_depth: int :param modules: list of module in the package. :type modules: list :return: A text for the co...
[ "Function", "for", "creating", "text", "for", "index", "for", "a", "package", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/scripts/create_api_docs.py#L52-L85
train
26,634
inasafe/inasafe
scripts/create_api_docs.py
create_module_rst_file
def create_module_rst_file(module_name): """Function for creating content in each .rst file for a module. :param module_name: name of the module. :type module_name: str :returns: A content for auto module. :rtype: str """ return_text = 'Module: ' + module_name dash = '=' * len(return...
python
def create_module_rst_file(module_name): """Function for creating content in each .rst file for a module. :param module_name: name of the module. :type module_name: str :returns: A content for auto module. :rtype: str """ return_text = 'Module: ' + module_name dash = '=' * len(return...
[ "def", "create_module_rst_file", "(", "module_name", ")", ":", "return_text", "=", "'Module: '", "+", "module_name", "dash", "=", "'='", "*", "len", "(", "return_text", ")", "return_text", "+=", "'\\n'", "+", "dash", "+", "'\\n\\n'", "return_text", "+=", "'.....
Function for creating content in each .rst file for a module. :param module_name: name of the module. :type module_name: str :returns: A content for auto module. :rtype: str
[ "Function", "for", "creating", "content", "in", "each", ".", "rst", "file", "for", "a", "module", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/scripts/create_api_docs.py#L88-L104
train
26,635
inasafe/inasafe
scripts/create_api_docs.py
write_rst_file
def write_rst_file(file_directory, file_name, content): """Shorter procedure for creating rst file. :param file_directory: Directory of the filename. :type file_directory: str :param file_name: Name of the file. :type file_name: str :param content: The content of the file. :type content: ...
python
def write_rst_file(file_directory, file_name, content): """Shorter procedure for creating rst file. :param file_directory: Directory of the filename. :type file_directory: str :param file_name: Name of the file. :type file_name: str :param content: The content of the file. :type content: ...
[ "def", "write_rst_file", "(", "file_directory", ",", "file_name", ",", "content", ")", ":", "create_dirs", "(", "os", ".", "path", ".", "split", "(", "os", ".", "path", ".", "join", "(", "file_directory", ",", "file_name", ")", ")", "[", "0", "]", ")",...
Shorter procedure for creating rst file. :param file_directory: Directory of the filename. :type file_directory: str :param file_name: Name of the file. :type file_name: str :param content: The content of the file. :type content: str
[ "Shorter", "procedure", "for", "creating", "rst", "file", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/scripts/create_api_docs.py#L113-L133
train
26,636
inasafe/inasafe
scripts/create_api_docs.py
get_python_files_from_list
def get_python_files_from_list(files, excluded_files=None): """Return list of python file from files, without excluded files. :param files: List of files. :type files: list :param excluded_files: List of excluded file names. :type excluded_files: list, None :returns: List of python file witho...
python
def get_python_files_from_list(files, excluded_files=None): """Return list of python file from files, without excluded files. :param files: List of files. :type files: list :param excluded_files: List of excluded file names. :type excluded_files: list, None :returns: List of python file witho...
[ "def", "get_python_files_from_list", "(", "files", ",", "excluded_files", "=", "None", ")", ":", "if", "excluded_files", "is", "None", ":", "excluded_files", "=", "[", "'__init__.py'", "]", "python_files", "=", "[", "]", "for", "fl", "in", "files", ":", "if"...
Return list of python file from files, without excluded files. :param files: List of files. :type files: list :param excluded_files: List of excluded file names. :type excluded_files: list, None :returns: List of python file without the excluded file, not started with test. :rtype: li...
[ "Return", "list", "of", "python", "file", "from", "files", "without", "excluded", "files", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/scripts/create_api_docs.py#L136-L158
train
26,637
inasafe/inasafe
scripts/create_api_docs.py
get_inasafe_code_path
def get_inasafe_code_path(custom_inasafe_path=None): """Determine the path to inasafe location. :param custom_inasafe_path: Custom inasafe project location. :type custom_inasafe_path: str :returns: Path to inasafe source code. :rtype: str """ inasafe_code_path = os.path.abspath( o...
python
def get_inasafe_code_path(custom_inasafe_path=None): """Determine the path to inasafe location. :param custom_inasafe_path: Custom inasafe project location. :type custom_inasafe_path: str :returns: Path to inasafe source code. :rtype: str """ inasafe_code_path = os.path.abspath( o...
[ "def", "get_inasafe_code_path", "(", "custom_inasafe_path", "=", "None", ")", ":", "inasafe_code_path", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'..'"...
Determine the path to inasafe location. :param custom_inasafe_path: Custom inasafe project location. :type custom_inasafe_path: str :returns: Path to inasafe source code. :rtype: str
[ "Determine", "the", "path", "to", "inasafe", "location", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/scripts/create_api_docs.py#L185-L200
train
26,638
inasafe/inasafe
scripts/create_api_docs.py
clean_api_docs_dirs
def clean_api_docs_dirs(): """Empty previous api-docs directory. :returns: Path to api-docs directory. :rtype: str """ inasafe_docs_path = os.path.abspath( os.path.join( os.path.dirname(__file__), '..', 'docs', 'api-docs')) if os.path.exists(inasafe_docs_path): rmtre...
python
def clean_api_docs_dirs(): """Empty previous api-docs directory. :returns: Path to api-docs directory. :rtype: str """ inasafe_docs_path = os.path.abspath( os.path.join( os.path.dirname(__file__), '..', 'docs', 'api-docs')) if os.path.exists(inasafe_docs_path): rmtre...
[ "def", "clean_api_docs_dirs", "(", ")", ":", "inasafe_docs_path", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'..'", ",", "'docs'", ",", "'api-docs'", ...
Empty previous api-docs directory. :returns: Path to api-docs directory. :rtype: str
[ "Empty", "previous", "api", "-", "docs", "directory", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/scripts/create_api_docs.py#L203-L215
train
26,639
inasafe/inasafe
scripts/create_api_docs.py
create_api_docs
def create_api_docs(code_path, api_docs_path, max_depth=2): """Function for generating .rst file for all .py file in dir_path folder. :param code_path: Path of the source code. :type code_path: str :param api_docs_path: Path of the api documentation directory. :type api_docs_path: str :param ...
python
def create_api_docs(code_path, api_docs_path, max_depth=2): """Function for generating .rst file for all .py file in dir_path folder. :param code_path: Path of the source code. :type code_path: str :param api_docs_path: Path of the api documentation directory. :type api_docs_path: str :param ...
[ "def", "create_api_docs", "(", "code_path", ",", "api_docs_path", ",", "max_depth", "=", "2", ")", ":", "base_path", "=", "os", ".", "path", ".", "split", "(", "code_path", ")", "[", "0", "]", "for", "package", ",", "subpackages", ",", "candidate_files", ...
Function for generating .rst file for all .py file in dir_path folder. :param code_path: Path of the source code. :type code_path: str :param api_docs_path: Path of the api documentation directory. :type api_docs_path: str :param max_depth: Maximum depth for the index. :type max_depth: int
[ "Function", "for", "generating", ".", "rst", "file", "for", "all", ".", "py", "file", "in", "dir_path", "folder", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/scripts/create_api_docs.py#L218-L270
train
26,640
inasafe/inasafe
safe/gui/tools/wizard/step_kw47_default_inasafe_fields.py
StepKwDefaultInaSAFEFields.get_inasafe_fields
def get_inasafe_fields(self): """Return inasafe fields from the current wizard state. :returns: Dictionary of key and value from InaSAFE Fields. :rtype: dict """ inasafe_fields = {} parameters = self.parameter_container.get_parameters(True) for parameter in param...
python
def get_inasafe_fields(self): """Return inasafe fields from the current wizard state. :returns: Dictionary of key and value from InaSAFE Fields. :rtype: dict """ inasafe_fields = {} parameters = self.parameter_container.get_parameters(True) for parameter in param...
[ "def", "get_inasafe_fields", "(", "self", ")", ":", "inasafe_fields", "=", "{", "}", "parameters", "=", "self", ".", "parameter_container", ".", "get_parameters", "(", "True", ")", "for", "parameter", "in", "parameters", ":", "if", "not", "parameter", ".", "...
Return inasafe fields from the current wizard state. :returns: Dictionary of key and value from InaSAFE Fields. :rtype: dict
[ "Return", "inasafe", "fields", "from", "the", "current", "wizard", "state", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw47_default_inasafe_fields.py#L195-L207
train
26,641
inasafe/inasafe
safe/gui/tools/wizard/step_kw47_default_inasafe_fields.py
StepKwDefaultInaSAFEFields.get_inasafe_default_values
def get_inasafe_default_values(self): """Return inasafe default from the current wizard state. :returns: Dictionary of key and value from InaSAFE Default Values. :rtype: dict """ inasafe_default_values = {} parameters = self.parameter_container.get_parameters(True) ...
python
def get_inasafe_default_values(self): """Return inasafe default from the current wizard state. :returns: Dictionary of key and value from InaSAFE Default Values. :rtype: dict """ inasafe_default_values = {} parameters = self.parameter_container.get_parameters(True) ...
[ "def", "get_inasafe_default_values", "(", "self", ")", ":", "inasafe_default_values", "=", "{", "}", "parameters", "=", "self", ".", "parameter_container", ".", "get_parameters", "(", "True", ")", "for", "parameter", "in", "parameters", ":", "if", "parameter", "...
Return inasafe default from the current wizard state. :returns: Dictionary of key and value from InaSAFE Default Values. :rtype: dict
[ "Return", "inasafe", "default", "from", "the", "current", "wizard", "state", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw47_default_inasafe_fields.py#L209-L221
train
26,642
inasafe/inasafe
safe/gui/tools/help/function_options_help.py
function_options_help
def function_options_help(): """Help message for Function options Dialog. .. versionadded:: 3.2.1 :returns: A message object containing helpful information. :rtype: messaging.message.Message """ message = m.Message() message.add(m.Brand()) message.add(heading()) message.add(conten...
python
def function_options_help(): """Help message for Function options Dialog. .. versionadded:: 3.2.1 :returns: A message object containing helpful information. :rtype: messaging.message.Message """ message = m.Message() message.add(m.Brand()) message.add(heading()) message.add(conten...
[ "def", "function_options_help", "(", ")", ":", "message", "=", "m", ".", "Message", "(", ")", "message", ".", "add", "(", "m", ".", "Brand", "(", ")", ")", "message", ".", "add", "(", "heading", "(", ")", ")", "message", ".", "add", "(", "content",...
Help message for Function options Dialog. .. versionadded:: 3.2.1 :returns: A message object containing helpful information. :rtype: messaging.message.Message
[ "Help", "message", "for", "Function", "options", "Dialog", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/help/function_options_help.py#L18-L31
train
26,643
inasafe/inasafe
safe/utilities/rounding.py
format_number
def format_number( x, use_rounding=True, is_population=False, coefficient=1): """Format a number according to the standards. :param x: A number to be formatted in a locale friendly way. :type x: int :param use_rounding: Flag to enable a rounding. :type use_rounding: bool :param is_pop...
python
def format_number( x, use_rounding=True, is_population=False, coefficient=1): """Format a number according to the standards. :param x: A number to be formatted in a locale friendly way. :type x: int :param use_rounding: Flag to enable a rounding. :type use_rounding: bool :param is_pop...
[ "def", "format_number", "(", "x", ",", "use_rounding", "=", "True", ",", "is_population", "=", "False", ",", "coefficient", "=", "1", ")", ":", "if", "use_rounding", ":", "x", "=", "rounding", "(", "x", ",", "is_population", ")", "x", "//=", "coefficient...
Format a number according to the standards. :param x: A number to be formatted in a locale friendly way. :type x: int :param use_rounding: Flag to enable a rounding. :type use_rounding: bool :param is_population: Flag if the number is population. It needs to be used with enable_rounding. ...
[ "Format", "a", "number", "according", "to", "the", "standards", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/rounding.py#L17-L45
train
26,644
inasafe/inasafe
safe/utilities/rounding.py
add_separators
def add_separators(x): """Format integer with separator between thousands. :param x: A number to be formatted in a locale friendly way. :type x: int :returns: A locale friendly formatted string e.g. 1,000,0000.00 representing the original x. If a ValueError exception occurs, x is simpl...
python
def add_separators(x): """Format integer with separator between thousands. :param x: A number to be formatted in a locale friendly way. :type x: int :returns: A locale friendly formatted string e.g. 1,000,0000.00 representing the original x. If a ValueError exception occurs, x is simpl...
[ "def", "add_separators", "(", "x", ")", ":", "try", ":", "s", "=", "'{0:,}'", ".", "format", "(", "x", ")", "# s = '{0:n}'.format(x) # n means locale aware (read up on this)", "# see issue #526", "except", "ValueError", ":", "return", "x", "# Quick solution for the mom...
Format integer with separator between thousands. :param x: A number to be formatted in a locale friendly way. :type x: int :returns: A locale friendly formatted string e.g. 1,000,0000.00 representing the original x. If a ValueError exception occurs, x is simply returned. :rtype: basest...
[ "Format", "integer", "with", "separator", "between", "thousands", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/rounding.py#L48-L76
train
26,645
inasafe/inasafe
safe/utilities/rounding.py
round_affected_number
def round_affected_number( number, use_rounding=False, use_population_rounding=False): """Tries to convert and round the number. Rounded using population rounding rule. :param number: number represented as string or float :type number: str, float :param use_rounding: flag ...
python
def round_affected_number( number, use_rounding=False, use_population_rounding=False): """Tries to convert and round the number. Rounded using population rounding rule. :param number: number represented as string or float :type number: str, float :param use_rounding: flag ...
[ "def", "round_affected_number", "(", "number", ",", "use_rounding", "=", "False", ",", "use_population_rounding", "=", "False", ")", ":", "decimal_number", "=", "float", "(", "number", ")", "rounded_number", "=", "int", "(", "ceil", "(", "decimal_number", ")", ...
Tries to convert and round the number. Rounded using population rounding rule. :param number: number represented as string or float :type number: str, float :param use_rounding: flag to enable rounding :type use_rounding: bool :param use_population_rounding: flag to enable population roundin...
[ "Tries", "to", "convert", "and", "round", "the", "number", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/rounding.py#L112-L139
train
26,646
inasafe/inasafe
safe/utilities/rounding.py
rounding_full
def rounding_full(number, is_population=False): """This function performs a rigorous rounding. :param number: The amount to round. :type number: int, float :param is_population: If we should use the population rounding rule, #4062. :type is_population: bool :returns: result and rounding brack...
python
def rounding_full(number, is_population=False): """This function performs a rigorous rounding. :param number: The amount to round. :type number: int, float :param is_population: If we should use the population rounding rule, #4062. :type is_population: bool :returns: result and rounding brack...
[ "def", "rounding_full", "(", "number", ",", "is_population", "=", "False", ")", ":", "if", "number", "<", "1000", "and", "not", "is_population", ":", "rounding_number", "=", "1", "# See ticket #4062", "elif", "number", "<", "1000", "and", "is_population", ":",...
This function performs a rigorous rounding. :param number: The amount to round. :type number: int, float :param is_population: If we should use the population rounding rule, #4062. :type is_population: bool :returns: result and rounding bracket. :rtype: (int, int)
[ "This", "function", "performs", "a", "rigorous", "rounding", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/rounding.py#L142-L163
train
26,647
inasafe/inasafe
safe/utilities/rounding.py
convert_unit
def convert_unit(number, input_unit, expected_unit): """A helper to convert the unit. :param number: The number to update. :type number: int :param input_unit: The unit of the number. :type input_unit: safe.definitions.units :param expected_unit: The expected output unit. :type expected_u...
python
def convert_unit(number, input_unit, expected_unit): """A helper to convert the unit. :param number: The number to update. :type number: int :param input_unit: The unit of the number. :type input_unit: safe.definitions.units :param expected_unit: The expected output unit. :type expected_u...
[ "def", "convert_unit", "(", "number", ",", "input_unit", ",", "expected_unit", ")", ":", "for", "mapping", "in", "unit_mapping", ":", "if", "input_unit", "==", "mapping", "[", "0", "]", "and", "expected_unit", "==", "mapping", "[", "1", "]", ":", "return",...
A helper to convert the unit. :param number: The number to update. :type number: int :param input_unit: The unit of the number. :type input_unit: safe.definitions.units :param expected_unit: The expected output unit. :type expected_unit: safe.definitions.units :return: The new number in ...
[ "A", "helper", "to", "convert", "the", "unit", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/rounding.py#L181-L202
train
26,648
inasafe/inasafe
safe/utilities/rounding.py
coefficient_between_units
def coefficient_between_units(unit_a, unit_b): """A helper to get the coefficient between two units. :param unit_a: The first unit. :type unit_a: safe.definitions.units :param unit_b: The second unit. :type unit_b: safe.definitions.units :return: The coefficient between these two units. :...
python
def coefficient_between_units(unit_a, unit_b): """A helper to get the coefficient between two units. :param unit_a: The first unit. :type unit_a: safe.definitions.units :param unit_b: The second unit. :type unit_b: safe.definitions.units :return: The coefficient between these two units. :...
[ "def", "coefficient_between_units", "(", "unit_a", ",", "unit_b", ")", ":", "for", "mapping", "in", "unit_mapping", ":", "if", "unit_a", "==", "mapping", "[", "0", "]", "and", "unit_b", "==", "mapping", "[", "1", "]", ":", "return", "mapping", "[", "2", ...
A helper to get the coefficient between two units. :param unit_a: The first unit. :type unit_a: safe.definitions.units :param unit_b: The second unit. :type unit_b: safe.definitions.units :return: The coefficient between these two units. :rtype: float
[ "A", "helper", "to", "get", "the", "coefficient", "between", "two", "units", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/rounding.py#L205-L223
train
26,649
inasafe/inasafe
safe/utilities/rounding.py
fatalities_range
def fatalities_range(number): """A helper to return fatalities as a range of number. See https://github.com/inasafe/inasafe/issues/3666#issuecomment-283565297 :param number: The exact number. Will be converted as a range. :type number: int, float :return: The range of the number. :rtype: str ...
python
def fatalities_range(number): """A helper to return fatalities as a range of number. See https://github.com/inasafe/inasafe/issues/3666#issuecomment-283565297 :param number: The exact number. Will be converted as a range. :type number: int, float :return: The range of the number. :rtype: str ...
[ "def", "fatalities_range", "(", "number", ")", ":", "range_format", "=", "'{min_range} - {max_range}'", "more_than_format", "=", "'> {min_range}'", "ranges", "=", "[", "[", "0", ",", "100", "]", ",", "[", "100", ",", "1000", "]", ",", "[", "1000", ",", "10...
A helper to return fatalities as a range of number. See https://github.com/inasafe/inasafe/issues/3666#issuecomment-283565297 :param number: The exact number. Will be converted as a range. :type number: int, float :return: The range of the number. :rtype: str
[ "A", "helper", "to", "return", "fatalities", "as", "a", "range", "of", "number", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/rounding.py#L226-L256
train
26,650
inasafe/inasafe
safe/utilities/rounding.py
html_scientific_notation_rate
def html_scientific_notation_rate(rate): """Helper for convert decimal rate using scientific notation. For example we want to show the very detail value of fatality rate because it might be a very small number. :param rate: Rate value :type rate: float :return: Rate value with html tag to sho...
python
def html_scientific_notation_rate(rate): """Helper for convert decimal rate using scientific notation. For example we want to show the very detail value of fatality rate because it might be a very small number. :param rate: Rate value :type rate: float :return: Rate value with html tag to sho...
[ "def", "html_scientific_notation_rate", "(", "rate", ")", ":", "precision", "=", "'%.3f'", "if", "rate", "*", "100", ">", "0", ":", "decimal_rate", "=", "Decimal", "(", "precision", "%", "(", "rate", "*", "100", ")", ")", "if", "decimal_rate", "==", "Dec...
Helper for convert decimal rate using scientific notation. For example we want to show the very detail value of fatality rate because it might be a very small number. :param rate: Rate value :type rate: float :return: Rate value with html tag to show the exponent :rtype: str
[ "Helper", "for", "convert", "decimal", "rate", "using", "scientific", "notation", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/rounding.py#L259-L288
train
26,651
inasafe/inasafe
safe/utilities/rounding.py
denomination
def denomination(value, min_nominal=None): """Return the denomination of a number. :param value: The value. :type value: int :param min_nominal: Minimum value of denomination eg: 1000, 100. :type min_nominal: int :return: The new value and the denomination as a unit definition. :rtype: tu...
python
def denomination(value, min_nominal=None): """Return the denomination of a number. :param value: The value. :type value: int :param min_nominal: Minimum value of denomination eg: 1000, 100. :type min_nominal: int :return: The new value and the denomination as a unit definition. :rtype: tu...
[ "def", "denomination", "(", "value", ",", "min_nominal", "=", "None", ")", ":", "if", "value", "is", "None", "or", "(", "hasattr", "(", "value", ",", "'isNull'", ")", "and", "value", ".", "isNull", "(", ")", ")", ":", "return", "None", ",", "None", ...
Return the denomination of a number. :param value: The value. :type value: int :param min_nominal: Minimum value of denomination eg: 1000, 100. :type min_nominal: int :return: The new value and the denomination as a unit definition. :rtype: tuple(int, safe.unit.definition)
[ "Return", "the", "denomination", "of", "a", "number", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/rounding.py#L291-L330
train
26,652
inasafe/inasafe
safe/report/expressions/map_report.py
legend_title_header_element
def legend_title_header_element(feature, parent): """Retrieve legend title header string from definitions.""" _ = feature, parent # NOQA header = legend_title_header['string_format'] return header.capitalize()
python
def legend_title_header_element(feature, parent): """Retrieve legend title header string from definitions.""" _ = feature, parent # NOQA header = legend_title_header['string_format'] return header.capitalize()
[ "def", "legend_title_header_element", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "header", "=", "legend_title_header", "[", "'string_format'", "]", "return", "header", ".", "capitalize", "(", ")" ]
Retrieve legend title header string from definitions.
[ "Retrieve", "legend", "title", "header", "string", "from", "definitions", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L85-L89
train
26,653
inasafe/inasafe
safe/report/expressions/map_report.py
exposure_summary_layer
def exposure_summary_layer(): """Helper method for retrieving exposure summary layer. If the analysis is multi-exposure, then it will return the exposure summary layer from place exposure analysis. """ project_context_scope = QgsExpressionContextUtils.projectScope( QgsProject.instance()) ...
python
def exposure_summary_layer(): """Helper method for retrieving exposure summary layer. If the analysis is multi-exposure, then it will return the exposure summary layer from place exposure analysis. """ project_context_scope = QgsExpressionContextUtils.projectScope( QgsProject.instance()) ...
[ "def", "exposure_summary_layer", "(", ")", ":", "project_context_scope", "=", "QgsExpressionContextUtils", ".", "projectScope", "(", "QgsProject", ".", "instance", "(", ")", ")", "project", "=", "QgsProject", ".", "instance", "(", ")", "key", "=", "provenance_laye...
Helper method for retrieving exposure summary layer. If the analysis is multi-exposure, then it will return the exposure summary layer from place exposure analysis.
[ "Helper", "method", "for", "retrieving", "exposure", "summary", "layer", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L92-L142
train
26,654
inasafe/inasafe
safe/report/expressions/map_report.py
distance_to_nearest_place
def distance_to_nearest_place(feature, parent): """If the impact layer has a distance field, it will return the distance to the nearest place in metres. e.g. distance_to_nearest_place() -> 1234 """ _ = feature, parent # NOQA layer = exposure_summary_layer() if not layer: return No...
python
def distance_to_nearest_place(feature, parent): """If the impact layer has a distance field, it will return the distance to the nearest place in metres. e.g. distance_to_nearest_place() -> 1234 """ _ = feature, parent # NOQA layer = exposure_summary_layer() if not layer: return No...
[ "def", "distance_to_nearest_place", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "layer", "=", "exposure_summary_layer", "(", ")", "if", "not", "layer", ":", "return", "None", "index", "=", "layer", ".", "fields", ...
If the impact layer has a distance field, it will return the distance to the nearest place in metres. e.g. distance_to_nearest_place() -> 1234
[ "If", "the", "impact", "layer", "has", "a", "distance", "field", "it", "will", "return", "the", "distance", "to", "the", "nearest", "place", "in", "metres", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L157-L175
train
26,655
inasafe/inasafe
safe/report/expressions/map_report.py
direction_to_nearest_place
def direction_to_nearest_place(feature, parent): """If the impact layer has a distance field, it will return the direction to the nearest place. e.g. direction_to_nearest_place() -> NW """ _ = feature, parent # NOQA layer = exposure_summary_layer() if not layer: return None i...
python
def direction_to_nearest_place(feature, parent): """If the impact layer has a distance field, it will return the direction to the nearest place. e.g. direction_to_nearest_place() -> NW """ _ = feature, parent # NOQA layer = exposure_summary_layer() if not layer: return None i...
[ "def", "direction_to_nearest_place", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "layer", "=", "exposure_summary_layer", "(", ")", "if", "not", "layer", ":", "return", "None", "index", "=", "layer", ".", "fields", ...
If the impact layer has a distance field, it will return the direction to the nearest place. e.g. direction_to_nearest_place() -> NW
[ "If", "the", "impact", "layer", "has", "a", "distance", "field", "it", "will", "return", "the", "direction", "to", "the", "nearest", "place", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L190-L208
train
26,656
inasafe/inasafe
safe/report/expressions/map_report.py
bearing_to_nearest_place
def bearing_to_nearest_place(feature, parent): """If the impact layer has a distance field, it will return the bearing to the nearest place in degrees. e.g. bearing_to_nearest_place() -> 280 """ _ = feature, parent # NOQA layer = exposure_summary_layer() if not layer: return None ...
python
def bearing_to_nearest_place(feature, parent): """If the impact layer has a distance field, it will return the bearing to the nearest place in degrees. e.g. bearing_to_nearest_place() -> 280 """ _ = feature, parent # NOQA layer = exposure_summary_layer() if not layer: return None ...
[ "def", "bearing_to_nearest_place", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "layer", "=", "exposure_summary_layer", "(", ")", "if", "not", "layer", ":", "return", "None", "index", "=", "layer", ".", "fields", "...
If the impact layer has a distance field, it will return the bearing to the nearest place in degrees. e.g. bearing_to_nearest_place() -> 280
[ "If", "the", "impact", "layer", "has", "a", "distance", "field", "it", "will", "return", "the", "bearing", "to", "the", "nearest", "place", "in", "degrees", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L223-L241
train
26,657
inasafe/inasafe
safe/report/expressions/map_report.py
name_of_the_nearest_place
def name_of_the_nearest_place(feature, parent): """If the impact layer has a distance field, it will return the name of the nearest place. e.g. name_of_the_nearest_place() -> Tokyo """ _ = feature, parent # NOQA layer = exposure_summary_layer() if not layer: return None index...
python
def name_of_the_nearest_place(feature, parent): """If the impact layer has a distance field, it will return the name of the nearest place. e.g. name_of_the_nearest_place() -> Tokyo """ _ = feature, parent # NOQA layer = exposure_summary_layer() if not layer: return None index...
[ "def", "name_of_the_nearest_place", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "layer", "=", "exposure_summary_layer", "(", ")", "if", "not", "layer", ":", "return", "None", "index", "=", "layer", ".", "fields", ...
If the impact layer has a distance field, it will return the name of the nearest place. e.g. name_of_the_nearest_place() -> Tokyo
[ "If", "the", "impact", "layer", "has", "a", "distance", "field", "it", "will", "return", "the", "name", "of", "the", "nearest", "place", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L256-L274
train
26,658
inasafe/inasafe
safe/report/expressions/map_report.py
disclaimer_title_header_element
def disclaimer_title_header_element(feature, parent): """Retrieve disclaimer title header string from definitions.""" _ = feature, parent # NOQA header = disclaimer_title_header['string_format'] return header.capitalize()
python
def disclaimer_title_header_element(feature, parent): """Retrieve disclaimer title header string from definitions.""" _ = feature, parent # NOQA header = disclaimer_title_header['string_format'] return header.capitalize()
[ "def", "disclaimer_title_header_element", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "header", "=", "disclaimer_title_header", "[", "'string_format'", "]", "return", "header", ".", "capitalize", "(", ")" ]
Retrieve disclaimer title header string from definitions.
[ "Retrieve", "disclaimer", "title", "header", "string", "from", "definitions", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L288-L292
train
26,659
inasafe/inasafe
safe/report/expressions/map_report.py
information_title_header_element
def information_title_header_element(feature, parent): """Retrieve information title header string from definitions.""" _ = feature, parent # NOQA header = information_title_header['string_format'] return header.capitalize()
python
def information_title_header_element(feature, parent): """Retrieve information title header string from definitions.""" _ = feature, parent # NOQA header = information_title_header['string_format'] return header.capitalize()
[ "def", "information_title_header_element", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "header", "=", "information_title_header", "[", "'string_format'", "]", "return", "header", ".", "capitalize", "(", ")" ]
Retrieve information title header string from definitions.
[ "Retrieve", "information", "title", "header", "string", "from", "definitions", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L323-L327
train
26,660
inasafe/inasafe
safe/report/expressions/map_report.py
time_title_header_element
def time_title_header_element(feature, parent): """Retrieve time title header string from definitions.""" _ = feature, parent # NOQA header = time_title_header['string_format'] return header.capitalize()
python
def time_title_header_element(feature, parent): """Retrieve time title header string from definitions.""" _ = feature, parent # NOQA header = time_title_header['string_format'] return header.capitalize()
[ "def", "time_title_header_element", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "header", "=", "time_title_header", "[", "'string_format'", "]", "return", "header", ".", "capitalize", "(", ")" ]
Retrieve time title header string from definitions.
[ "Retrieve", "time", "title", "header", "string", "from", "definitions", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L341-L345
train
26,661
inasafe/inasafe
safe/report/expressions/map_report.py
caution_title_header_element
def caution_title_header_element(feature, parent): """Retrieve caution title header string from definitions.""" _ = feature, parent # NOQA header = caution_title_header['string_format'] return header.capitalize()
python
def caution_title_header_element(feature, parent): """Retrieve caution title header string from definitions.""" _ = feature, parent # NOQA header = caution_title_header['string_format'] return header.capitalize()
[ "def", "caution_title_header_element", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "header", "=", "caution_title_header", "[", "'string_format'", "]", "return", "header", ".", "capitalize", "(", ")" ]
Retrieve caution title header string from definitions.
[ "Retrieve", "caution", "title", "header", "string", "from", "definitions", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L359-L363
train
26,662
inasafe/inasafe
safe/report/expressions/map_report.py
source_title_header_element
def source_title_header_element(feature, parent): """Retrieve source title header string from definitions.""" _ = feature, parent # NOQA header = source_title_header['string_format'] return header.capitalize()
python
def source_title_header_element(feature, parent): """Retrieve source title header string from definitions.""" _ = feature, parent # NOQA header = source_title_header['string_format'] return header.capitalize()
[ "def", "source_title_header_element", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "header", "=", "source_title_header", "[", "'string_format'", "]", "return", "header", ".", "capitalize", "(", ")" ]
Retrieve source title header string from definitions.
[ "Retrieve", "source", "title", "header", "string", "from", "definitions", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L395-L399
train
26,663
inasafe/inasafe
safe/report/expressions/map_report.py
analysis_title_header_element
def analysis_title_header_element(feature, parent): """Retrieve analysis title header string from definitions.""" _ = feature, parent # NOQA header = analysis_title_header['string_format'] return header.capitalize()
python
def analysis_title_header_element(feature, parent): """Retrieve analysis title header string from definitions.""" _ = feature, parent # NOQA header = analysis_title_header['string_format'] return header.capitalize()
[ "def", "analysis_title_header_element", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "header", "=", "analysis_title_header", "[", "'string_format'", "]", "return", "header", ".", "capitalize", "(", ")" ]
Retrieve analysis title header string from definitions.
[ "Retrieve", "analysis", "title", "header", "string", "from", "definitions", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L413-L417
train
26,664
inasafe/inasafe
safe/report/expressions/map_report.py
version_title_header_element
def version_title_header_element(feature, parent): """Retrieve version title header string from definitions.""" _ = feature, parent # NOQA header = version_title_header['string_format'] return header.capitalize()
python
def version_title_header_element(feature, parent): """Retrieve version title header string from definitions.""" _ = feature, parent # NOQA header = version_title_header['string_format'] return header.capitalize()
[ "def", "version_title_header_element", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "header", "=", "version_title_header", "[", "'string_format'", "]", "return", "header", ".", "capitalize", "(", ")" ]
Retrieve version title header string from definitions.
[ "Retrieve", "version", "title", "header", "string", "from", "definitions", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L431-L435
train
26,665
inasafe/inasafe
safe/report/expressions/map_report.py
crs_text_element
def crs_text_element(crs, feature, parent): """Retrieve coordinate reference system text string from definitions. Example usage: crs_text_element('EPSG:3857'). """ _ = feature, parent # NOQA crs_definition = QgsCoordinateReferenceSystem(crs) crs_description = crs_definition.description() t...
python
def crs_text_element(crs, feature, parent): """Retrieve coordinate reference system text string from definitions. Example usage: crs_text_element('EPSG:3857'). """ _ = feature, parent # NOQA crs_definition = QgsCoordinateReferenceSystem(crs) crs_description = crs_definition.description() t...
[ "def", "crs_text_element", "(", "crs", ",", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "crs_definition", "=", "QgsCoordinateReferenceSystem", "(", "crs", ")", "crs_description", "=", "crs_definition", ".", "description", "(...
Retrieve coordinate reference system text string from definitions. Example usage: crs_text_element('EPSG:3857').
[ "Retrieve", "coordinate", "reference", "system", "text", "string", "from", "definitions", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L468-L477
train
26,666
inasafe/inasafe
safe/report/expressions/map_report.py
north_arrow_path
def north_arrow_path(feature, parent): """Retrieve the full path of default north arrow logo.""" _ = feature, parent # NOQA north_arrow_file = setting(inasafe_north_arrow_path['setting_key']) if os.path.exists(north_arrow_file): return north_arrow_file else: LOGGER.info( ...
python
def north_arrow_path(feature, parent): """Retrieve the full path of default north arrow logo.""" _ = feature, parent # NOQA north_arrow_file = setting(inasafe_north_arrow_path['setting_key']) if os.path.exists(north_arrow_file): return north_arrow_file else: LOGGER.info( ...
[ "def", "north_arrow_path", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "north_arrow_file", "=", "setting", "(", "inasafe_north_arrow_path", "[", "'setting_key'", "]", ")", "if", "os", ".", "path", ".", "exists", "("...
Retrieve the full path of default north arrow logo.
[ "Retrieve", "the", "full", "path", "of", "default", "north", "arrow", "logo", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L563-L575
train
26,667
inasafe/inasafe
safe/report/expressions/map_report.py
organisation_logo_path
def organisation_logo_path(feature, parent): """Retrieve the full path of used specified organisation logo.""" _ = feature, parent # NOQA organisation_logo_file = setting( inasafe_organisation_logo_path['setting_key']) if os.path.exists(organisation_logo_file): return organisation_logo_...
python
def organisation_logo_path(feature, parent): """Retrieve the full path of used specified organisation logo.""" _ = feature, parent # NOQA organisation_logo_file = setting( inasafe_organisation_logo_path['setting_key']) if os.path.exists(organisation_logo_file): return organisation_logo_...
[ "def", "organisation_logo_path", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "organisation_logo_file", "=", "setting", "(", "inasafe_organisation_logo_path", "[", "'setting_key'", "]", ")", "if", "os", ".", "path", ".",...
Retrieve the full path of used specified organisation logo.
[ "Retrieve", "the", "full", "path", "of", "used", "specified", "organisation", "logo", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L591-L603
train
26,668
inasafe/inasafe
safe/gui/tools/help/multi_buffer_help.py
multi_buffer_help
def multi_buffer_help(): """Help message for multi buffer dialog. .. versionadded:: 4.0.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 multi_buffer_help(): """Help message for multi buffer dialog. .. versionadded:: 4.0.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", "multi_buffer_help", "(", ")", ":", "message", "=", "m", ".", "Message", "(", ")", "message", ".", "add", "(", "m", ".", "Brand", "(", ")", ")", "message", ".", "add", "(", "heading", "(", ")", ")", "message", ".", "add", "(", "content", "...
Help message for multi buffer dialog. .. versionadded:: 4.0.0 :returns: A message object containing helpful information. :rtype: messaging.message.Message
[ "Help", "message", "for", "multi", "buffer", "dialog", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/help/multi_buffer_help.py#L12-L24
train
26,669
inasafe/inasafe
safe/processors/post_processor_functions.py
multiply
def multiply(**kwargs): """Simple postprocessor where we multiply the input values. :param kwargs: Dictionary of values to multiply :type kwargs: dict :return: The result. :rtype: float """ result = 1 for i in list(kwargs.values()): if not i: # If one value is null,...
python
def multiply(**kwargs): """Simple postprocessor where we multiply the input values. :param kwargs: Dictionary of values to multiply :type kwargs: dict :return: The result. :rtype: float """ result = 1 for i in list(kwargs.values()): if not i: # If one value is null,...
[ "def", "multiply", "(", "*", "*", "kwargs", ")", ":", "result", "=", "1", "for", "i", "in", "list", "(", "kwargs", ".", "values", "(", ")", ")", ":", "if", "not", "i", ":", "# If one value is null, we return null.", "return", "i", "result", "*=", "i", ...
Simple postprocessor where we multiply the input values. :param kwargs: Dictionary of values to multiply :type kwargs: dict :return: The result. :rtype: float
[ "Simple", "postprocessor", "where", "we", "multiply", "the", "input", "values", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/processors/post_processor_functions.py#L29-L44
train
26,670
inasafe/inasafe
safe/processors/post_processor_functions.py
calculate_distance
def calculate_distance( distance_calculator, place_geometry, latitude, longitude, earthquake_hazard=None, place_exposure=None): """Simple postprocessor where we compute the distance between two points. :param distance_calculator: The size calculator. :type di...
python
def calculate_distance( distance_calculator, place_geometry, latitude, longitude, earthquake_hazard=None, place_exposure=None): """Simple postprocessor where we compute the distance between two points. :param distance_calculator: The size calculator. :type di...
[ "def", "calculate_distance", "(", "distance_calculator", ",", "place_geometry", ",", "latitude", ",", "longitude", ",", "earthquake_hazard", "=", "None", ",", "place_exposure", "=", "None", ")", ":", "_", "=", "earthquake_hazard", ",", "place_exposure", "# NOQA", ...
Simple postprocessor where we compute the distance between two points. :param distance_calculator: The size calculator. :type distance_calculator: safe.gis.vector.tools.SizeCalculator :param latitude: The latitude to use. :type latitude: float :param longitude: The longitude to use. :type lon...
[ "Simple", "postprocessor", "where", "we", "compute", "the", "distance", "between", "two", "points", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/processors/post_processor_functions.py#L62-L97
train
26,671
inasafe/inasafe
safe/processors/post_processor_functions.py
calculate_bearing
def calculate_bearing( place_geometry, latitude, longitude, earthquake_hazard=None, place_exposure=None ): """Simple postprocessor where we compute the bearing angle between two points. :param place_geometry: Geometry of place. :type place_geometry: QgsGeometry ...
python
def calculate_bearing( place_geometry, latitude, longitude, earthquake_hazard=None, place_exposure=None ): """Simple postprocessor where we compute the bearing angle between two points. :param place_geometry: Geometry of place. :type place_geometry: QgsGeometry ...
[ "def", "calculate_bearing", "(", "place_geometry", ",", "latitude", ",", "longitude", ",", "earthquake_hazard", "=", "None", ",", "place_exposure", "=", "None", ")", ":", "_", "=", "earthquake_hazard", ",", "place_exposure", "# NOQA", "epicenter", "=", "QgsPointXY...
Simple postprocessor where we compute the bearing angle between two points. :param place_geometry: Geometry of place. :type place_geometry: QgsGeometry :param latitude: The latitude to use. :type latitude: float :param longitude: The longitude to use. :type longitude: float :param ea...
[ "Simple", "postprocessor", "where", "we", "compute", "the", "bearing", "angle", "between", "two", "points", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/processors/post_processor_functions.py#L100-L133
train
26,672
inasafe/inasafe
safe/processors/post_processor_functions.py
calculate_cardinality
def calculate_cardinality( angle, earthquake_hazard=None, place_exposure=None ): """Simple postprocessor where we compute the cardinality of an angle. :param angle: Bearing angle. :type angle: float :param earthquake_hazard: The hazard to use. :type earthquake_hazard: str ...
python
def calculate_cardinality( angle, earthquake_hazard=None, place_exposure=None ): """Simple postprocessor where we compute the cardinality of an angle. :param angle: Bearing angle. :type angle: float :param earthquake_hazard: The hazard to use. :type earthquake_hazard: str ...
[ "def", "calculate_cardinality", "(", "angle", ",", "earthquake_hazard", "=", "None", ",", "place_exposure", "=", "None", ")", ":", "# this method could still be improved later, since the acquisition interval", "# is a bit strange, i.e the input angle of 22.499° will return `N` even", ...
Simple postprocessor where we compute the cardinality of an angle. :param angle: Bearing angle. :type angle: float :param earthquake_hazard: The hazard to use. :type earthquake_hazard: str :param place_exposure: The exposure to use. :type place_exposure: str :return: Cardinality text. ...
[ "Simple", "postprocessor", "where", "we", "compute", "the", "cardinality", "of", "an", "angle", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/processors/post_processor_functions.py#L136-L169
train
26,673
inasafe/inasafe
safe/processors/post_processor_functions.py
post_processor_affected_function
def post_processor_affected_function( exposure=None, hazard=None, classification=None, hazard_class=None): """Private function used in the affected postprocessor. It returns a boolean if it's affected or not, or not exposed. :param exposure: The exposure to use. :type exposure: str :param...
python
def post_processor_affected_function( exposure=None, hazard=None, classification=None, hazard_class=None): """Private function used in the affected postprocessor. It returns a boolean if it's affected or not, or not exposed. :param exposure: The exposure to use. :type exposure: str :param...
[ "def", "post_processor_affected_function", "(", "exposure", "=", "None", ",", "hazard", "=", "None", ",", "classification", "=", "None", ",", "hazard_class", "=", "None", ")", ":", "if", "exposure", "==", "exposure_population", "[", "'key'", "]", ":", "affecte...
Private function used in the affected postprocessor. It returns a boolean if it's affected or not, or not exposed. :param exposure: The exposure to use. :type exposure: str :param hazard: The hazard to use. :type hazard: str :param classification: The hazard classification to use. :type ...
[ "Private", "function", "used", "in", "the", "affected", "postprocessor", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/processors/post_processor_functions.py#L173-L213
train
26,674
inasafe/inasafe
safe/processors/post_processor_functions.py
post_processor_population_displacement_function
def post_processor_population_displacement_function( hazard=None, classification=None, hazard_class=None, population=None): """Private function used in the displacement postprocessor. :param hazard: The hazard to use. :type hazard: str :param classification: The hazard classification to use. ...
python
def post_processor_population_displacement_function( hazard=None, classification=None, hazard_class=None, population=None): """Private function used in the displacement postprocessor. :param hazard: The hazard to use. :type hazard: str :param classification: The hazard classification to use. ...
[ "def", "post_processor_population_displacement_function", "(", "hazard", "=", "None", ",", "classification", "=", "None", ",", "hazard_class", "=", "None", ",", "population", "=", "None", ")", ":", "_", "=", "population", "# NOQA", "return", "get_displacement_rate",...
Private function used in the displacement postprocessor. :param hazard: The hazard to use. :type hazard: str :param classification: The hazard classification to use. :type classification: str :param hazard_class: The hazard class of the feature. :type hazard_class: str :param population:...
[ "Private", "function", "used", "in", "the", "displacement", "postprocessor", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/processors/post_processor_functions.py#L216-L238
train
26,675
inasafe/inasafe
safe/processors/post_processor_functions.py
post_processor_population_fatality_function
def post_processor_population_fatality_function( classification=None, hazard_class=None, population=None): """Private function used in the fatality postprocessor. :param classification: The hazard classification to use. :type classification: str :param hazard_class: The hazard class of the fea...
python
def post_processor_population_fatality_function( classification=None, hazard_class=None, population=None): """Private function used in the fatality postprocessor. :param classification: The hazard classification to use. :type classification: str :param hazard_class: The hazard class of the fea...
[ "def", "post_processor_population_fatality_function", "(", "classification", "=", "None", ",", "hazard_class", "=", "None", ",", "population", "=", "None", ")", ":", "_", "=", "population", "# NOQA", "for", "hazard", "in", "hazard_classes_all", ":", "if", "hazard"...
Private function used in the fatality postprocessor. :param classification: The hazard classification to use. :type classification: str :param hazard_class: The hazard class of the feature. :type hazard_class: str :param population: We don't use this value here. It's only used for conditi...
[ "Private", "function", "used", "in", "the", "fatality", "postprocessor", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/processors/post_processor_functions.py#L241-L272
train
26,676
inasafe/inasafe
safe/utilities/metadata.py
append_ISO19115_keywords
def append_ISO19115_keywords(keywords): """Append ISO19115 from setting to keywords. :param keywords: The keywords destination. :type keywords: dict """ # Map setting's key and metadata key ISO19115_mapping = { 'ISO19115_ORGANIZATION': 'organisation', 'ISO19115_URL': 'url', ...
python
def append_ISO19115_keywords(keywords): """Append ISO19115 from setting to keywords. :param keywords: The keywords destination. :type keywords: dict """ # Map setting's key and metadata key ISO19115_mapping = { 'ISO19115_ORGANIZATION': 'organisation', 'ISO19115_URL': 'url', ...
[ "def", "append_ISO19115_keywords", "(", "keywords", ")", ":", "# Map setting's key and metadata key", "ISO19115_mapping", "=", "{", "'ISO19115_ORGANIZATION'", ":", "'organisation'", ",", "'ISO19115_URL'", ":", "'url'", ",", "'ISO19115_EMAIL'", ":", "'email'", ",", "'ISO19...
Append ISO19115 from setting to keywords. :param keywords: The keywords destination. :type keywords: dict
[ "Append", "ISO19115", "from", "setting", "to", "keywords", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/metadata.py#L112-L129
train
26,677
inasafe/inasafe
safe/utilities/metadata.py
write_iso19115_metadata
def write_iso19115_metadata(layer_uri, keywords, version_35=False): """Create metadata object from a layer path and keywords dictionary. This function will save these keywords to the file system or the database. :param version_35: If we write keywords version 3.5. Default to False. :type version_35: ...
python
def write_iso19115_metadata(layer_uri, keywords, version_35=False): """Create metadata object from a layer path and keywords dictionary. This function will save these keywords to the file system or the database. :param version_35: If we write keywords version 3.5. Default to False. :type version_35: ...
[ "def", "write_iso19115_metadata", "(", "layer_uri", ",", "keywords", ",", "version_35", "=", "False", ")", ":", "active_metadata_classes", "=", "METADATA_CLASSES", "if", "version_35", ":", "active_metadata_classes", "=", "METADATA_CLASSES35", "if", "'layer_purpose'", "i...
Create metadata object from a layer path and keywords dictionary. This function will save these keywords to the file system or the database. :param version_35: If we write keywords version 3.5. Default to False. :type version_35: bool :param layer_uri: Uri to layer. :type layer_uri: basestring ...
[ "Create", "metadata", "object", "from", "a", "layer", "path", "and", "keywords", "dictionary", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/metadata.py#L132-L180
train
26,678
inasafe/inasafe
safe/utilities/metadata.py
read_iso19115_metadata
def read_iso19115_metadata(layer_uri, keyword=None, version_35=False): """Retrieve keywords from a metadata object :param layer_uri: Uri to layer. :type layer_uri: basestring :param keyword: The key of keyword that want to be read. If None, return all keywords in dictionary. :type keyword:...
python
def read_iso19115_metadata(layer_uri, keyword=None, version_35=False): """Retrieve keywords from a metadata object :param layer_uri: Uri to layer. :type layer_uri: basestring :param keyword: The key of keyword that want to be read. If None, return all keywords in dictionary. :type keyword:...
[ "def", "read_iso19115_metadata", "(", "layer_uri", ",", "keyword", "=", "None", ",", "version_35", "=", "False", ")", ":", "xml_uri", "=", "os", ".", "path", ".", "splitext", "(", "layer_uri", ")", "[", "0", "]", "+", "'.xml'", "# Remove the prefix for local...
Retrieve keywords from a metadata object :param layer_uri: Uri to layer. :type layer_uri: basestring :param keyword: The key of keyword that want to be read. If None, return all keywords in dictionary. :type keyword: basestring :returns: Dictionary of keywords or value of key as string. ...
[ "Retrieve", "keywords", "from", "a", "metadata", "object" ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/metadata.py#L183-L247
train
26,679
inasafe/inasafe
safe/utilities/metadata.py
active_classification
def active_classification(keywords, exposure_key): """Helper to retrieve active classification for an exposure. :param keywords: Hazard layer keywords. :type keywords: dict :param exposure_key: The exposure key. :type exposure_key: str :returns: The active classification key. None if there is...
python
def active_classification(keywords, exposure_key): """Helper to retrieve active classification for an exposure. :param keywords: Hazard layer keywords. :type keywords: dict :param exposure_key: The exposure key. :type exposure_key: str :returns: The active classification key. None if there is...
[ "def", "active_classification", "(", "keywords", ",", "exposure_key", ")", ":", "classifications", "=", "None", "if", "'classification'", "in", "keywords", ":", "return", "keywords", "[", "'classification'", "]", "if", "'layer_mode'", "in", "keywords", "and", "key...
Helper to retrieve active classification for an exposure. :param keywords: Hazard layer keywords. :type keywords: dict :param exposure_key: The exposure key. :type exposure_key: str :returns: The active classification key. None if there is no active one. :rtype: str
[ "Helper", "to", "retrieve", "active", "classification", "for", "an", "exposure", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/metadata.py#L250-L276
train
26,680
inasafe/inasafe
safe/utilities/metadata.py
active_thresholds_value_maps
def active_thresholds_value_maps(keywords, exposure_key): """Helper to retrieve active value maps or thresholds for an exposure. :param keywords: Hazard layer keywords. :type keywords: dict :param exposure_key: The exposure key. :type exposure_key: str :returns: Active thresholds or value map...
python
def active_thresholds_value_maps(keywords, exposure_key): """Helper to retrieve active value maps or thresholds for an exposure. :param keywords: Hazard layer keywords. :type keywords: dict :param exposure_key: The exposure key. :type exposure_key: str :returns: Active thresholds or value map...
[ "def", "active_thresholds_value_maps", "(", "keywords", ",", "exposure_key", ")", ":", "if", "'classification'", "in", "keywords", ":", "if", "keywords", "[", "'layer_mode'", "]", "==", "layer_mode_continuous", "[", "'key'", "]", ":", "return", "keywords", "[", ...
Helper to retrieve active value maps or thresholds for an exposure. :param keywords: Hazard layer keywords. :type keywords: dict :param exposure_key: The exposure key. :type exposure_key: str :returns: Active thresholds or value maps. :rtype: dict
[ "Helper", "to", "retrieve", "active", "value", "maps", "or", "thresholds", "for", "an", "exposure", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/metadata.py#L279-L305
train
26,681
inasafe/inasafe
safe/utilities/metadata.py
copy_layer_keywords
def copy_layer_keywords(layer_keywords): """Helper to make a deep copy of a layer keywords. :param layer_keywords: A dictionary of layer's keywords. :type layer_keywords: dict :returns: A deep copy of layer keywords. :rtype: dict """ copy_keywords = {} for key, value in list(layer_keyw...
python
def copy_layer_keywords(layer_keywords): """Helper to make a deep copy of a layer keywords. :param layer_keywords: A dictionary of layer's keywords. :type layer_keywords: dict :returns: A deep copy of layer keywords. :rtype: dict """ copy_keywords = {} for key, value in list(layer_keyw...
[ "def", "copy_layer_keywords", "(", "layer_keywords", ")", ":", "copy_keywords", "=", "{", "}", "for", "key", ",", "value", "in", "list", "(", "layer_keywords", ".", "items", "(", ")", ")", ":", "if", "isinstance", "(", "value", ",", "QUrl", ")", ":", "...
Helper to make a deep copy of a layer keywords. :param layer_keywords: A dictionary of layer's keywords. :type layer_keywords: dict :returns: A deep copy of layer keywords. :rtype: dict
[ "Helper", "to", "make", "a", "deep", "copy", "of", "a", "layer", "keywords", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/metadata.py#L308-L332
train
26,682
inasafe/inasafe
safe/gui/tools/wizard/step_kw44_fields_mapping.py
StepKwFieldsMapping.set_widgets
def set_widgets(self): """Set widgets on the Field Mapping step.""" on_the_fly_metadata = {} layer_purpose = self.parent.step_kw_purpose.selected_purpose() on_the_fly_metadata['layer_purpose'] = layer_purpose['key'] if layer_purpose != layer_purpose_aggregation: subca...
python
def set_widgets(self): """Set widgets on the Field Mapping step.""" on_the_fly_metadata = {} layer_purpose = self.parent.step_kw_purpose.selected_purpose() on_the_fly_metadata['layer_purpose'] = layer_purpose['key'] if layer_purpose != layer_purpose_aggregation: subca...
[ "def", "set_widgets", "(", "self", ")", ":", "on_the_fly_metadata", "=", "{", "}", "layer_purpose", "=", "self", ".", "parent", ".", "step_kw_purpose", ".", "selected_purpose", "(", ")", "on_the_fly_metadata", "[", "'layer_purpose'", "]", "=", "layer_purpose", "...
Set widgets on the Field Mapping step.
[ "Set", "widgets", "on", "the", "Field", "Mapping", "step", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw44_fields_mapping.py#L94-L115
train
26,683
inasafe/inasafe
safe/gis/sanity_check.py
check_inasafe_fields
def check_inasafe_fields(layer, keywords_only=False): """Helper to check inasafe_fields. :param layer: The layer to check. :type layer: QgsVectorLayer :param keywords_only: If we should check from the keywords only. False by default, we will check also from the layer. :type keywords_only: ...
python
def check_inasafe_fields(layer, keywords_only=False): """Helper to check inasafe_fields. :param layer: The layer to check. :type layer: QgsVectorLayer :param keywords_only: If we should check from the keywords only. False by default, we will check also from the layer. :type keywords_only: ...
[ "def", "check_inasafe_fields", "(", "layer", ",", "keywords_only", "=", "False", ")", ":", "inasafe_fields", "=", "layer", ".", "keywords", "[", "'inasafe_fields'", "]", "real_fields", "=", "[", "field", ".", "name", "(", ")", "for", "field", "in", "layer", ...
Helper to check inasafe_fields. :param layer: The layer to check. :type layer: QgsVectorLayer :param keywords_only: If we should check from the keywords only. False by default, we will check also from the layer. :type keywords_only: bool :return: Return True if the layer is valid. :rt...
[ "Helper", "to", "check", "inasafe_fields", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/sanity_check.py#L17-L62
train
26,684
inasafe/inasafe
safe/gis/sanity_check.py
check_layer
def check_layer(layer, has_geometry=True): """Helper to check layer validity. This function wil; raise InvalidLayerError if the layer is invalid. :param layer: The layer to check. :type layer: QgsMapLayer :param has_geometry: If the layer must have a geometry. True by default. If it's a r...
python
def check_layer(layer, has_geometry=True): """Helper to check layer validity. This function wil; raise InvalidLayerError if the layer is invalid. :param layer: The layer to check. :type layer: QgsMapLayer :param has_geometry: If the layer must have a geometry. True by default. If it's a r...
[ "def", "check_layer", "(", "layer", ",", "has_geometry", "=", "True", ")", ":", "if", "is_vector_layer", "(", "layer", ")", "or", "is_raster_layer", "(", "layer", ")", ":", "if", "not", "layer", ".", "isValid", "(", ")", ":", "raise", "InvalidLayerError", ...
Helper to check layer validity. This function wil; raise InvalidLayerError if the layer is invalid. :param layer: The layer to check. :type layer: QgsMapLayer :param has_geometry: If the layer must have a geometry. True by default. If it's a raster layer, we will no check this parameter. If w...
[ "Helper", "to", "check", "layer", "validity", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/sanity_check.py#L65-L120
train
26,685
inasafe/inasafe
safe/defaults.py
default_provenance
def default_provenance(): """The provenance for the default values. :return: default provenance. :rtype: str """ field = TextParameter() field.name = tr('Provenance') field.description = tr('The provenance of minimum needs') field.value = 'The minimum needs are based on BNPB Perka 7/200...
python
def default_provenance(): """The provenance for the default values. :return: default provenance. :rtype: str """ field = TextParameter() field.name = tr('Provenance') field.description = tr('The provenance of minimum needs') field.value = 'The minimum needs are based on BNPB Perka 7/200...
[ "def", "default_provenance", "(", ")", ":", "field", "=", "TextParameter", "(", ")", "field", ".", "name", "=", "tr", "(", "'Provenance'", ")", "field", ".", "description", "=", "tr", "(", "'The provenance of minimum needs'", ")", "field", ".", "value", "=",...
The provenance for the default values. :return: default provenance. :rtype: str
[ "The", "provenance", "for", "the", "default", "values", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/defaults.py#L18-L28
train
26,686
inasafe/inasafe
safe/gui/tools/peta_bencana_dialog.py
PetaBencanaDialog.accept
def accept(self): """Do PetaBencana download and display it in QGIS. .. versionadded: 3.3 """ self.save_state() try: self.require_directory() except CanceledImportDialogError: return QgsApplication.instance().setOverrideCursor( ...
python
def accept(self): """Do PetaBencana download and display it in QGIS. .. versionadded: 3.3 """ self.save_state() try: self.require_directory() except CanceledImportDialogError: return QgsApplication.instance().setOverrideCursor( ...
[ "def", "accept", "(", "self", ")", ":", "self", ".", "save_state", "(", ")", "try", ":", "self", ".", "require_directory", "(", ")", "except", "CanceledImportDialogError", ":", "return", "QgsApplication", ".", "instance", "(", ")", ".", "setOverrideCursor", ...
Do PetaBencana download and display it in QGIS. .. versionadded: 3.3
[ "Do", "PetaBencana", "download", "and", "display", "it", "in", "QGIS", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/peta_bencana_dialog.py#L205-L288
train
26,687
inasafe/inasafe
safe/gui/tools/peta_bencana_dialog.py
PetaBencanaDialog.add_flooded_field
def add_flooded_field(self, shapefile_path): """Create the layer from the local shp adding the flooded field. .. versionadded:: 3.3 Use this method to add a calculated field to a shapefile. The shapefile should have a field called 'count' containing the number of flood reports ...
python
def add_flooded_field(self, shapefile_path): """Create the layer from the local shp adding the flooded field. .. versionadded:: 3.3 Use this method to add a calculated field to a shapefile. The shapefile should have a field called 'count' containing the number of flood reports ...
[ "def", "add_flooded_field", "(", "self", ",", "shapefile_path", ")", ":", "layer", "=", "QgsVectorLayer", "(", "shapefile_path", ",", "self", ".", "tr", "(", "'Jakarta Floods'", ")", ",", "'ogr'", ")", "# Add a calculated field indicating if a poly is flooded or not", ...
Create the layer from the local shp adding the flooded field. .. versionadded:: 3.3 Use this method to add a calculated field to a shapefile. The shapefile should have a field called 'count' containing the number of flood reports for the field. The field values will be set to 0 if the ...
[ "Create", "the", "layer", "from", "the", "local", "shp", "adding", "the", "flooded", "field", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/peta_bencana_dialog.py#L290-L341
train
26,688
inasafe/inasafe
safe/gui/tools/peta_bencana_dialog.py
PetaBencanaDialog.copy_keywords
def copy_keywords(self, shapefile_path): """Copy keywords from the OSM resource directory to the output path. .. versionadded: 3.3 In addition to copying the template, tokens within the template will be replaced with new values for the date token and title token. :param shapef...
python
def copy_keywords(self, shapefile_path): """Copy keywords from the OSM resource directory to the output path. .. versionadded: 3.3 In addition to copying the template, tokens within the template will be replaced with new values for the date token and title token. :param shapef...
[ "def", "copy_keywords", "(", "self", ",", "shapefile_path", ")", ":", "source_xml_path", "=", "resources_path", "(", "'petabencana'", ",", "'flood-keywords.xml'", ")", "output_xml_path", "=", "shapefile_path", ".", "replace", "(", "'shp'", ",", "'xml'", ")", "LOGG...
Copy keywords from the OSM resource directory to the output path. .. versionadded: 3.3 In addition to copying the template, tokens within the template will be replaced with new values for the date token and title token. :param shapefile_path: Path to the shapefile that will have the f...
[ "Copy", "keywords", "from", "the", "OSM", "resource", "directory", "to", "the", "output", "path", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/peta_bencana_dialog.py#L343-L369
train
26,689
inasafe/inasafe
safe/gui/tools/peta_bencana_dialog.py
PetaBencanaDialog.copy_style
def copy_style(shapefile_path): """Copy style from the OSM resource directory to the output path. .. versionadded: 3.3 :param shapefile_path: Path to the shapefile that should get the path added. :type shapefile_path: basestring """ source_qml_path = resourc...
python
def copy_style(shapefile_path): """Copy style from the OSM resource directory to the output path. .. versionadded: 3.3 :param shapefile_path: Path to the shapefile that should get the path added. :type shapefile_path: basestring """ source_qml_path = resourc...
[ "def", "copy_style", "(", "shapefile_path", ")", ":", "source_qml_path", "=", "resources_path", "(", "'petabencana'", ",", "'flood-style.qml'", ")", "output_qml_path", "=", "shapefile_path", ".", "replace", "(", "'shp'", ",", "'qml'", ")", "LOGGER", ".", "info", ...
Copy style from the OSM resource directory to the output path. .. versionadded: 3.3 :param shapefile_path: Path to the shapefile that should get the path added. :type shapefile_path: basestring
[ "Copy", "style", "from", "the", "OSM", "resource", "directory", "to", "the", "output", "path", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/peta_bencana_dialog.py#L372-L384
train
26,690
inasafe/inasafe
safe/gui/tools/peta_bencana_dialog.py
PetaBencanaDialog.download
def download(self, url, output_path): """Download file from API url and write to output path. :param url: URL of the API. :type url: str :param output_path: Path of output file, :type output_path: str """ request_failed_message = self.tr( "Can't acce...
python
def download(self, url, output_path): """Download file from API url and write to output path. :param url: URL of the API. :type url: str :param output_path: Path of output file, :type output_path: str """ request_failed_message = self.tr( "Can't acce...
[ "def", "download", "(", "self", ",", "url", ",", "output_path", ")", ":", "request_failed_message", "=", "self", ".", "tr", "(", "\"Can't access PetaBencana API: {source}\"", ")", ".", "format", "(", "source", "=", "url", ")", "downloader", "=", "FileDownloader"...
Download file from API url and write to output path. :param url: URL of the API. :type url: str :param output_path: Path of output file, :type output_path: str
[ "Download", "file", "from", "API", "url", "and", "write", "to", "output", "path", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/peta_bencana_dialog.py#L546-L570
train
26,691
inasafe/inasafe
safe/gui/tools/peta_bencana_dialog.py
PetaBencanaDialog.populate_combo_box
def populate_combo_box(self): """Populate combobox for selecting city.""" if self.radio_button_production.isChecked(): self.source = production_api['url'] available_data = production_api['available_data'] else: self.source = development_api['url'] ...
python
def populate_combo_box(self): """Populate combobox for selecting city.""" if self.radio_button_production.isChecked(): self.source = production_api['url'] available_data = production_api['available_data'] else: self.source = development_api['url'] ...
[ "def", "populate_combo_box", "(", "self", ")", ":", "if", "self", ".", "radio_button_production", ".", "isChecked", "(", ")", ":", "self", ".", "source", "=", "production_api", "[", "'url'", "]", "available_data", "=", "production_api", "[", "'available_data'", ...
Populate combobox for selecting city.
[ "Populate", "combobox", "for", "selecting", "city", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/peta_bencana_dialog.py#L594-L608
train
26,692
inasafe/inasafe
safe/gui/tools/peta_bencana_dialog.py
PetaBencanaDialog.define_url
def define_url(self): """Define API url based on which source is selected. :return: Valid url of selected source. :rtype: str """ current_index = self.city_combo_box.currentIndex() city_code = self.city_combo_box.itemData(current_index, Qt.UserRole) source = (sel...
python
def define_url(self): """Define API url based on which source is selected. :return: Valid url of selected source. :rtype: str """ current_index = self.city_combo_box.currentIndex() city_code = self.city_combo_box.itemData(current_index, Qt.UserRole) source = (sel...
[ "def", "define_url", "(", "self", ")", ":", "current_index", "=", "self", ".", "city_combo_box", ".", "currentIndex", "(", ")", "city_code", "=", "self", ".", "city_combo_box", ".", "itemData", "(", "current_index", ",", "Qt", ".", "UserRole", ")", "source",...
Define API url based on which source is selected. :return: Valid url of selected source. :rtype: str
[ "Define", "API", "url", "based", "on", "which", "source", "is", "selected", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/peta_bencana_dialog.py#L610-L619
train
26,693
inasafe/inasafe
safe/report/extractors/analysis_provenance_details.py
analysis_provenance_details_simplified_extractor
def analysis_provenance_details_simplified_extractor( impact_report, component_metadata): """Extracting simplified version of provenance details of layers. This extractor will produce provenance details which will be displayed in the main report. :param impact_report: the impact report that ac...
python
def analysis_provenance_details_simplified_extractor( impact_report, component_metadata): """Extracting simplified version of provenance details of layers. This extractor will produce provenance details which will be displayed in the main report. :param impact_report: the impact report that ac...
[ "def", "analysis_provenance_details_simplified_extractor", "(", "impact_report", ",", "component_metadata", ")", ":", "context", "=", "{", "}", "extra_args", "=", "component_metadata", ".", "extra_args", "default_source", "=", "resolve_from_dictionary", "(", "extra_args", ...
Extracting simplified version of provenance details of layers. This extractor will produce provenance details which will be displayed in the main report. :param impact_report: the impact report that acts as a proxy to fetch all the data that extractor needed :type impact_report: safe.report.im...
[ "Extracting", "simplified", "version", "of", "provenance", "details", "of", "layers", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/extractors/analysis_provenance_details.py#L228-L339
train
26,694
inasafe/inasafe
safe/report/extractors/analysis_provenance_details.py
analysis_provenance_details_pdf_extractor
def analysis_provenance_details_pdf_extractor( impact_report, component_metadata): """Extracting the main provenance details to its own pdf report. For PDF generations :param impact_report: the impact report that acts as a proxy to fetch all the data that extractor needed :type impact_...
python
def analysis_provenance_details_pdf_extractor( impact_report, component_metadata): """Extracting the main provenance details to its own pdf report. For PDF generations :param impact_report: the impact report that acts as a proxy to fetch all the data that extractor needed :type impact_...
[ "def", "analysis_provenance_details_pdf_extractor", "(", "impact_report", ",", "component_metadata", ")", ":", "# QGIS Composer needed certain context to generate the output", "# - Map Settings", "# - Substitution maps", "# - Element settings, such as icon for picture file or image source", ...
Extracting the main provenance details to its own pdf report. For PDF generations :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_metadata: the component metad...
[ "Extracting", "the", "main", "provenance", "details", "to", "its", "own", "pdf", "report", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/extractors/analysis_provenance_details.py#L377-L416
train
26,695
inasafe/inasafe
safe/report/extractors/analysis_provenance_details.py
headerize
def headerize(provenances): """Create a header for each keyword. :param provenances: The keywords. :type provenances: dict :return: New keywords with header for every keyword. :rtype: dict """ special_case = { 'Inasafe': 'InaSAFE', 'Qgis': 'QGIS', 'Pyqt': 'PyQt', ...
python
def headerize(provenances): """Create a header for each keyword. :param provenances: The keywords. :type provenances: dict :return: New keywords with header for every keyword. :rtype: dict """ special_case = { 'Inasafe': 'InaSAFE', 'Qgis': 'QGIS', 'Pyqt': 'PyQt', ...
[ "def", "headerize", "(", "provenances", ")", ":", "special_case", "=", "{", "'Inasafe'", ":", "'InaSAFE'", ",", "'Qgis'", ":", "'QGIS'", ",", "'Pyqt'", ":", "'PyQt'", ",", "'Os'", ":", "'OS'", ",", "'Gdal'", ":", "'GDAL'", ",", "'Maps'", ":", "'Map'", ...
Create a header for each keyword. :param provenances: The keywords. :type provenances: dict :return: New keywords with header for every keyword. :rtype: dict
[ "Create", "a", "header", "for", "each", "keyword", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/extractors/analysis_provenance_details.py#L419-L464
train
26,696
inasafe/inasafe
safe/report/extractors/analysis_provenance_details.py
resolve_dict_keywords
def resolve_dict_keywords(keywords): """Replace dictionary content with html. :param keywords: The keywords. :type keywords: dict :return: New keywords with updated content. :rtype: dict """ for keyword in ['value_map', 'inasafe_fields', 'inasafe_default_values']: value = keywords...
python
def resolve_dict_keywords(keywords): """Replace dictionary content with html. :param keywords: The keywords. :type keywords: dict :return: New keywords with updated content. :rtype: dict """ for keyword in ['value_map', 'inasafe_fields', 'inasafe_default_values']: value = keywords...
[ "def", "resolve_dict_keywords", "(", "keywords", ")", ":", "for", "keyword", "in", "[", "'value_map'", ",", "'inasafe_fields'", ",", "'inasafe_default_values'", "]", ":", "value", "=", "keywords", ".", "get", "(", "keyword", ")", "if", "value", ":", "value", ...
Replace dictionary content with html. :param keywords: The keywords. :type keywords: dict :return: New keywords with updated content. :rtype: dict
[ "Replace", "dictionary", "content", "with", "html", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/extractors/analysis_provenance_details.py#L467-L495
train
26,697
inasafe/inasafe
safe/report/extractors/analysis_provenance_details.py
sorted_keywords_by_order
def sorted_keywords_by_order(keywords, order): """Sort keywords based on defined order. :param keywords: Keyword to be sorted. :type keywords: dict :param order: Ordered list of key. :type order: list :return: Ordered dictionary based on order list. :rtype: OrderedDict """ # we n...
python
def sorted_keywords_by_order(keywords, order): """Sort keywords based on defined order. :param keywords: Keyword to be sorted. :type keywords: dict :param order: Ordered list of key. :type order: list :return: Ordered dictionary based on order list. :rtype: OrderedDict """ # we n...
[ "def", "sorted_keywords_by_order", "(", "keywords", ",", "order", ")", ":", "# we need to delete item with no value", "for", "key", ",", "value", "in", "list", "(", "keywords", ".", "items", "(", ")", ")", ":", "if", "value", "is", "None", ":", "del", "keywo...
Sort keywords based on defined order. :param keywords: Keyword to be sorted. :type keywords: dict :param order: Ordered list of key. :type order: list :return: Ordered dictionary based on order list. :rtype: OrderedDict
[ "Sort", "keywords", "based", "on", "defined", "order", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/extractors/analysis_provenance_details.py#L498-L525
train
26,698
inasafe/inasafe
safe/plugin.py
Plugin.add_action
def add_action(self, action, add_to_toolbar=True, add_to_legend=False): """Add a toolbar icon to the InaSAFE toolbar. :param action: The action that should be added to the toolbar. :type action: QAction :param add_to_toolbar: Flag indicating whether the action should also b...
python
def add_action(self, action, add_to_toolbar=True, add_to_legend=False): """Add a toolbar icon to the InaSAFE toolbar. :param action: The action that should be added to the toolbar. :type action: QAction :param add_to_toolbar: Flag indicating whether the action should also b...
[ "def", "add_action", "(", "self", ",", "action", ",", "add_to_toolbar", "=", "True", ",", "add_to_legend", "=", "False", ")", ":", "# store in the class list of actions for easy plugin unloading", "self", ".", "actions", ".", "append", "(", "action", ")", "self", ...
Add a toolbar icon to the InaSAFE toolbar. :param action: The action that should be added to the toolbar. :type action: QAction :param add_to_toolbar: Flag indicating whether the action should also be added to the InaSAFE toolbar. Defaults to True. :type add_to_toolbar: boo...
[ "Add", "a", "toolbar", "icon", "to", "the", "InaSAFE", "toolbar", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/plugin.py#L138-L168
train
26,699