_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q243800
resolve_from_dictionary
train
def resolve_from_dictionary(dictionary, key_list, default_value=None): """Take value from a given key list from dictionary. Example: given dictionary d, key_list = ['foo', 'bar'], it will try to resolve d['foo']['bar']. If not possible, return default_value. :param dictionary: A dictionary to reso...
python
{ "resource": "" }
q243801
retrieve_exposure_classes_lists
train
def retrieve_exposure_classes_lists(exposure_keywords): """Retrieve exposures classes. Only if the exposure has some classifications. :param exposure_keywords: exposure keywords :type exposure_keywords: dict :return: lists of classes used in
python
{ "resource": "" }
q243802
initialize_minimum_needs_post_processors
train
def initialize_minimum_needs_post_processors(): """Generate definitions for minimum needs post processors.""" processors = [] for field in minimum_needs_fields: field_key = field['key'] field_name = field['name'] field_description = field['description'] need_parameter = fiel...
python
{ "resource": "" }
q243803
layer_from_combo
train
def layer_from_combo(combo): """Get the QgsMapLayer currently selected in a combo. Obtain QgsMapLayer id from the userrole of the QtCombo and return it as a QgsMapLayer. :returns: The currently selected map layer a combo. :rtype: QgsMapLayer """ index = combo.currentIndex() if index < ...
python
{ "resource": "" }
q243804
add_ordered_combo_item
train
def add_ordered_combo_item( combo, text, data=None, count_selected_features=None, icon=None): """Add a combo item ensuring that all items are listed alphabetically. Although QComboBox allows you to set an InsertAlphabetically enum this only has effect when a user interactively adds combo items to ...
python
{ "resource": "" }
q243805
send_static_message
train
def send_static_message(sender, message): """Send a static message to the listeners. Static messages represents a whole new message. Usually it will replace the previous message. .. versionadded:: 3.3 :param sender: The sender. :type sender: object :param message: An instance of our rich...
python
{ "resource": "" }
q243806
send_dynamic_message
train
def send_dynamic_message(sender, message): """Send a dynamic message to the listeners. Dynamic messages represents a progress. Usually it will be appended to the previous messages. .. versionadded:: 3.3 :param sender: The sender. :type sender: object :param message: An instance of our ri...
python
{ "resource": "" }
q243807
send_error_message
train
def send_error_message(sender, error_message): """Send an error message to the listeners. Error messages represents and error. It usually replace the previous message since an error has been happened. .. versionadded:: 3.3 :param sender: The sender. :type sender: object :param error_mess...
python
{ "resource": "" }
q243808
analysis_error
train
def analysis_error(sender, exception, message): """A helper to spawn an error and halt processing. An exception will be logged, busy status removed and a message displayed. .. versionadded:: 3.3 :param sender: The sender. :type sender: object :param message: an ErrorMessage to display ...
python
{ "resource": "" }
q243809
DefaultSelectParameterWidget.set_default
train
def set_default(self, default): """Set default value by item's string. :param default: The default. :type default: str, int :returns: True if success, else False. :rtype: bool """ # Find index of choice try: default_index = self._parameter.de...
python
{ "resource": "" }
q243810
DefaultSelectParameterWidget.toggle_input
train
def toggle_input(self): """Change behaviour of radio button based on input.""" current_index = self.input.currentIndex() # If current input is not a radio button enabler, disable
python
{ "resource": "" }
q243811
DefaultSelectParameterWidget.set_selected_radio_button
train
def set_selected_radio_button(self): """Set selected radio button to 'Do not report'."""
python
{ "resource": "" }
q243812
DefaultSelectParameterWidget.disable_radio_button
train
def disable_radio_button(self): """Disable radio button group and custom value input area.""" checked = self.default_input_button_group.checkedButton() if checked: self.default_input_button_group.setExclusive(False) checked.setChecked(False)
python
{ "resource": "" }
q243813
DefaultSelectParameterWidget.enable_radio_button
train
def enable_radio_button(self): """Enable radio button and custom value input area then set selected radio button to 'Do not report'.
python
{ "resource": "" }
q243814
earthquake_fatality_rate
train
def earthquake_fatality_rate(hazard_level): """Earthquake fatality ratio for a given hazard level. It reads the QGIS QSettings to know what is the default earthquake function. :param hazard_level: The hazard level. :type hazard_level: int :return: The fatality rate. :rtype: float """ ...
python
{ "resource": "" }
q243815
itb_fatality_rates
train
def itb_fatality_rates(): """Indonesian Earthquake Fatality Model. :returns: Fatality rate. :rtype: dic """ # As per email discussion with Ole, Trevor, Hadi, mmi < 4 will have # a fatality rate of 0 - Tim mmi_range = list(range(2, 11)) # Model coefficients
python
{ "resource": "" }
q243816
pager_fatality_rates
train
def pager_fatality_rates(): """USGS Pager fatality estimation model. Fatality rate(MMI) = cum. standard normal dist(1/BETA * ln(MMI/THETA)). Reference: Jaiswal, K. S., Wald, D. J., and Hearne, M. (2009a). Estimating casualties for large worldwide earthquakes using an empirical approach. U.S. ...
python
{ "resource": "" }
q243817
normal_cdf
train
def normal_cdf(x, mu=0, sigma=1): """Cumulative Normal Distribution Function. :param x: scalar or array of real numbers. :type x: numpy.ndarray, float :param mu: Mean value. Default 0. :type mu: float, numpy.ndarray :param sigma: Standard deviation. Default 1. :type sigma: float :ret...
python
{ "resource": "" }
q243818
log_normal_cdf
train
def log_normal_cdf(x, median=1, sigma=1): """Cumulative Log Normal Distribution Function. :param x: scalar or array of real numbers. :type x: numpy.ndarray, float :param median: Median (exp(mean of log(x)). Default 1. :type median: float :param sigma: Log normal standard deviation. Default 1....
python
{ "resource": "" }
q243819
erf
train
def erf(z): """Approximation to ERF. :param z: Input array or scalar to perform erf on. :type z: numpy.ndarray, float :returns: The approximate error. :rtype: numpy.ndarray, float Note: from: http://www.cs.princeton.edu/introcs/21function/ErrorFunction.java.html Implem...
python
{ "resource": "" }
q243820
current_earthquake_model_name
train
def current_earthquake_model_name(): """Human friendly name for the currently active earthquake fatality model. :returns: Name of the current EQ fatality model as defined in users settings.
python
{ "resource": "" }
q243821
from_counts_to_ratios
train
def from_counts_to_ratios(layer): """Transform counts to ratios. Formula: ratio = subset count / total count :param layer: The vector layer. :type layer: QgsVectorLayer :return: The layer with new ratios. :rtype: QgsVectorLayer .. versionadded:: 4.0 """ output_layer_name = recomp...
python
{ "resource": "" }
q243822
FlatTable.get_value
train
def get_value(self, **kwargs): """Return the value for a specific key.""" key = tuple(kwargs[group]
python
{ "resource": "" }
q243823
FlatTable.group_values
train
def group_values(self, group_name): """Return all distinct group values for given group.""" group_index = self.groups.index(group_name) values = [] for key in self.data_keys: if
python
{ "resource": "" }
q243824
FlatTable.from_json
train
def from_json(self, json_string): """Override current FlatTable using data from json. :param json_string: JSON String
python
{ "resource": "" }
q243825
FlatTable.from_dict
train
def from_dict(self, groups, data): """Populate FlatTable based on groups and data. :param groups: List of group name. :type groups: list :param data: Dictionary of raw table. :type data: list example of groups: ["road_type", "hazard"] example of data: [ ...
python
{ "resource": "" }
q243826
needs_calculator_help
train
def needs_calculator_help(): """Help message for needs calculator dialog. .. versionadded:: 3.2.1 :returns: A message object containing helpful information. :rtype: messaging.message.Message """
python
{ "resource": "" }
q243827
reproject
train
def reproject(layer, output_crs, callback=None): """Reproject a vector layer to a specific CRS. Issue https://github.com/inasafe/inasafe/issues/3183 :param layer: The layer to reproject. :type layer: QgsVectorLayer :param output_crs: The destination CRS. :type output_crs: QgsCoordinateReferen...
python
{ "resource": "" }
q243828
StepFcHazLayerFromBrowser.set_widgets
train
def set_widgets(self): """Set widgets on the Hazard Layer From Browser tab.""" self.tvBrowserHazard_selection_changed() # Set icon hazard = self.parent.step_fc_functions1.selected_value(
python
{ "resource": "" }
q243829
SaveScenarioDialog.validate_input
train
def validate_input(self): """Validate the input before saving a scenario. Those validations are: 1. self.exposure_layer must be not None 2. self.hazard_layer must be not None 3. self.function_id is not an empty string or None """ self.exposure_layer = layer_from_...
python
{ "resource": "" }
q243830
SaveScenarioDialog.save_scenario
train
def save_scenario(self, scenario_file_path=None): """Save current scenario to a text file. You can use the saved scenario with the batch runner. :param scenario_file_path: A path to the scenario file. :type scenario_file_path: str """ # Validate Input warning_ti...
python
{ "resource": "" }
q243831
SaveScenarioDialog.relative_path
train
def relative_path(reference_path, input_path): """Get the relative path to input_path from reference_path. :param reference_path: The reference path. :type reference_path: str :param input_path: The input path. :type input_path: str """ start_path = os.path.dirn...
python
{ "resource": "" }
q243832
ReportComponentsMetadata.info
train
def info(self): """Short info about the component. :return: Returned dictionary of information about the component. :rtype: dict """ return { 'key': self.key, 'processor': self.processor,
python
{ "resource": "" }
q243833
QgisComposerComponentsMetadata.info
train
def info(self): """Short info of the metadata. :return: Returned dictionary of information about the component. :rtype: dict """
python
{ "resource": "" }
q243834
ReportMetadata.component_by_key
train
def component_by_key(self, key): """Retrieve component by its key. :param key: Component key :type key: str :return: ReportComponentsMetadata :rtype: ReportComponentsMetadata .. versionadded:: 4.0 """
python
{ "resource": "" }
q243835
ReportMetadata.component_by_tags
train
def component_by_tags(self, tags): """Retrieve components by tags. :param tags: List of tags :type tags: list :return: List of ReportComponentsMetadata :rtype: list[ReportComponentsMetadata] .. versionadded:: 4.0 """ tags_keys
python
{ "resource": "" }
q243836
_normalize_field_name
train
def _normalize_field_name(value): """Normalizing value string used as key and field name. :param value: String to normalize :type value: str :return: normalized string :rtype: str """ # Replace
python
{ "resource": "" }
q243837
_initializes_minimum_needs_fields
train
def _initializes_minimum_needs_fields(): """Initialize minimum needs fields. Minimum needs definitions are taken from currently used profile. """ needs_profile = NeedsProfile() needs_profile.load() fields = [] needs_parameters = needs_profile.get_needs_parameters() for need_parameter ...
python
{ "resource": "" }
q243838
minimum_needs_parameter
train
def minimum_needs_parameter(field=None, parameter_name=None): """Get minimum needs parameter from a given field. :param field: Field provided :type field: dict :param parameter_name: Need parameter's name :type parameter_name: str :return: Need paramter :rtype: ResourceParameter """ ...
python
{ "resource": "" }
q243839
WizardStep.step_type
train
def step_type(self): """Whether it's a IFCW step or Keyword Wizard Step.""" if 'stepfc' in self.__class__.__name__.lower(): return STEP_FC
python
{ "resource": "" }
q243840
WizardStep.help
train
def help(self): """Return full help message for the step wizard. :returns: A message object contains help text. :rtype: m.Message """ message = m.Message() message.add(m.Brand())
python
{ "resource": "" }
q243841
WizardStep.help_heading
train
def help_heading(self): """Helper method that returns just the header. :returns: A heading object. :rtype: safe.messaging.heading.Heading
python
{ "resource": "" }
q243842
get_help_html
train
def get_help_html(message=None): """Create the HTML content for the help dialog or for external browser :param message: An optional message object to display in the dialog. :type message: Message.Message :return: the help HTML content :rtype: str """ html =
python
{ "resource": "" }
q243843
show_help
train
def show_help(message=None): """Open an help message in the user's browser :param message: An optional message object to display in the dialog. :type message: Message.Message """ help_path = mktemp('.html') with open(help_path, 'wb+') as f: help_html = get_help_html(message)
python
{ "resource": "" }
q243844
definitions_help
train
def definitions_help(): """Help message for Definitions. .. versionadded:: 4.0.0 :returns: A message object containing helpful information. :rtype: messaging.message.Message """ message
python
{ "resource": "" }
q243845
_make_defaults_hazard_table
train
def _make_defaults_hazard_table(): """Build headers for a table related to hazard classes. :return: A table with headers. :rtype: m.Table """ table = m.Table(style_class='table table-condensed table-striped') row = m.Row() # first row is for colour - we dont use a header here as some tables...
python
{ "resource": "" }
q243846
_make_defaults_exposure_table
train
def _make_defaults_exposure_table(): """Build headers for a table related to exposure classes. :return: A table with headers. :rtype: m.Table """ table = m.Table(style_class='table table-condensed table-striped')
python
{ "resource": "" }
q243847
_add_dict_to_bullets
train
def _add_dict_to_bullets(target, value): """Add notes and actions in dictionary to the bullets :param target: Target bullets :type target: Bullets :param value: Dictionary that contains actions or notes :type value: dict :return: Updated bullets :rtype: Bullets """ actions = value...
python
{ "resource": "" }
q243848
StepFcExpLayerFromCanvas.selected_canvas_explayer
train
def selected_canvas_explayer(self): """Obtain the canvas exposure layer selected by user. :returns: The currently selected map layer in the list. :rtype: QgsMapLayer """ if self.lstCanvasExpLayers.selectedItems():
python
{ "resource": "" }
q243849
StepFcExpLayerFromCanvas.set_widgets
train
def set_widgets(self): """Set widgets on the Exposure Layer From Canvas 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_lay...
python
{ "resource": "" }
q243850
IP_verified
train
def IP_verified(directory, extensions_to_ignore=None, directories_to_ignore=None, files_to_ignore=None, verbose=False): """Find and audit potential data files that might violate IP This is the public function to be used to ascertain that all d...
python
{ "resource": "" }
q243851
identify_datafiles
train
def identify_datafiles(root, extensions_to_ignore=None, directories_to_ignore=None, files_to_ignore=None): """ Identify files that might contain data See function IP_verified() for details about optinoal parmeters """ for dirpath, di...
python
{ "resource": "" }
q243852
ProfileWidget.data
train
def data(self): """Get the data from the current state of widgets. :returns: Profile data in dictionary. :rtype: dict """ if len(self.widget_items) == 0: return data = {} for hazard_item in self.widget_items: hazard = hazard_item.data(0, Q...
python
{ "resource": "" }
q243853
ProfileWidget.data
train
def data(self, profile_data): """Set data for the widget. :param profile_data: profile data. :type profile_data: dict It will replace the previous data. """ default_profile = generate_default_profile() self.clear() for hazard in sorted(default_profile.ke...
python
{ "resource": "" }
q243854
StepFcFunctions2.selected_functions_2
train
def selected_functions_2(self): """Obtain functions available for hazard and exposure selected by user. :returns: List of the available functions metadata.
python
{ "resource": "" }
q243855
StepFcFunctions2.set_widgets
train
def set_widgets(self): """Set widgets on the Impact Functions Table 2 tab.""" self.tblFunctions2.clear() hazard, exposure, _, _ = self.parent.\ selected_impact_function_constraints() hazard_layer_geometries = get_allowed_geometries( layer_purpose_hazard['key']) ...
python
{ "resource": "" }
q243856
PercentageSpinBox.setValue
train
def setValue(self, p_float): """Override method to set a value to show it as 0 to 100. :param p_float: The float
python
{ "resource": "" }
q243857
MessageViewer.impact_path
train
def impact_path(self, value): """Setter to impact path. :param value: The impact path. :type value: str """ self._impact_path = value if value is None: self.action_show_report.setEnabled(False) self.action_show_log.setEnabled(False) se...
python
{ "resource": "" }
q243858
MessageViewer.contextMenuEvent
train
def contextMenuEvent(self, event): """Slot automatically called by Qt on right click on the WebView. :param event: the event that caused the context menu to be called. """ context_menu = QMenu(self) # add select all action_select_all = self.page().action( Q...
python
{ "resource": "" }
q243859
MessageViewer.static_message_event
train
def static_message_event(self, sender, message): """Static message event handler - set message state based on event. Static message events will clear the message buffer before displaying themselves. :param sender: Unused - the object that sent the message. :type sender: Object,...
python
{ "resource": "" }
q243860
MessageViewer.dynamic_message_event
train
def dynamic_message_event(self, sender, message): """Dynamic event handler - set message state based on event. Dynamic messages don't clear the message buffer. :param sender: Unused - the object that sent the message. :type sender: Object, None
python
{ "resource": "" }
q243861
MessageViewer.to_message
train
def to_message(self): """Collate all message elements to a single message.""" my_message = m.Message() if self.static_message is not None: my_message.add(self.static_message)
python
{ "resource": "" }
q243862
MessageViewer.save_report_to_html
train
def save_report_to_html(self): """Save report in the dock to html.""" html = self.page().mainFrame().toHtml() if self.report_path is not None:
python
{ "resource": "" }
q243863
MessageViewer.save_log_to_html
train
def save_log_to_html(self): """Helper to write the log out as an html file.""" html = html_header() html += ( '<img src="file:///%s/img/logos/inasafe-logo-url.png" ' 'title="InaSAFE Logo" alt="InaSAFE Logo" />' % resources_path()) html += ('<h5 class="info"><i cla...
python
{ "resource": "" }
q243864
MessageViewer.show_report
train
def show_report(self): """Show report.""" self.action_show_report.setEnabled(False)
python
{ "resource": "" }
q243865
MessageViewer.show_log
train
def show_log(self): """Show log.""" self.action_show_report.setEnabled(True)
python
{ "resource": "" }
q243866
MessageViewer.open_current_in_browser
train
def open_current_in_browser(self): """Open current selected impact report in browser.""" if self.impact_path is None: html = self.page().mainFrame().toHtml() html_to_file(html, open_browser=True) else: if self.action_show_report.isEnabled():
python
{ "resource": "" }
q243867
MessageViewer.generate_pdf
train
def generate_pdf(self): """Generate a PDF from the displayed content.""" printer = QtGui.QPrinter(QtGui.QPrinter.HighResolution) printer.setPageSize(QtGui.QPrinter.A4) printer.setColorMode(QtGui.QPrinter.Color) printer.setOutputFormat(QtGui.QPrinter.PdfFormat) report_path...
python
{ "resource": "" }
q243868
MessageViewer.load_html
train
def load_html(self, mode, html): """Load HTML to this class with the mode specified. There are two modes that can be used: * HTML_FILE_MODE: Directly from a local HTML file. * HTML_STR_MODE: From a valid HTML string. :param mode: The mode. :type mode: int ...
python
{ "resource": "" }
q243869
ErrorMessage.standard_suggestions
train
def standard_suggestions(self): """Standard generic suggestions. :return: List of standard suggestions for users who encounter errors. :rtype: BulletedList """ suggestions = BulletedList() suggestions.add( 'Check that you have the latest version of InaSAFE in...
python
{ "resource": "" }
q243870
ErrorMessage._render
train
def _render(self): """Create a Message version of this ErrorMessage Args: none Returns: the Message instance of this ErrorMessage Raises: Errors are propagated """ message = Message() message.add(Heading(tr('Problem'), **ORAN...
python
{ "resource": "" }
q243871
ErrorMessage.append
train
def append(self, error_message): """Add an ErrorMessage to the end of the queue. Tracebacks are not appended. :param error_message: An element to add to the message. :type error_message: ErrorMessage """ self.problems = self.problems + error_message.problems se...
python
{ "resource": "" }
q243872
ErrorMessage.prepend
train
def prepend(self, error_message): """Add an ErrorMessage to the beginning of the queue. Tracebacks are not prepended. :param error_message: An element to add to the message. :type error_message: ErrorMessage """ self.problems = error_message.problems + self.problems ...
python
{ "resource": "" }
q243873
ErrorMessage.clear
train
def clear(self): """Clear ErrorMessage. """ self.problems = [] self.details = []
python
{ "resource": "" }
q243874
Folder.layers
train
def layers(self): """Return a list of layers available. :return: List of layers available in the datastore. :rtype: list .. versionadded:: 4.0 """ extensions = ['*.%s' % f for f in EXTENSIONS] self.uri.setNameFilters(extensions)
python
{ "resource": "" }
q243875
Folder._add_tabular_layer
train
def _add_tabular_layer(self, tabular_layer, layer_name, save_style=False): """Add a tabular layer to the folder. :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
{ "resource": "" }
q243876
Folder._add_vector_layer
train
def _add_vector_layer(self, vector_layer, layer_name, save_style=False): """Add a vector layer to the folder. :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 :par...
python
{ "resource": "" }
q243877
StepFcExpLayerFromBrowser.set_widgets
train
def set_widgets(self): """Set widgets on the Exposure Layer From Browser tab.""" self.tvBrowserExposure_selection_changed() # Set icon exposure = self.parent.step_fc_functions1.selected_value(
python
{ "resource": "" }
q243878
Paragraph.to_html
train
def to_html(self): """Render a Paragraph MessageElement as html :returns: The html representation of the Paragraph MessageElement """ if self.text is None: return
python
{ "resource": "" }
q243879
MetadataDbIO.open_connection
train
def open_connection(self): """Open an sqlite connection to the metadata database. By default the metadata database will be used in the plugin dir, unless an explicit path has been set using setmetadataDbPath, or overridden in QSettings. If the db does not exist it will be create...
python
{ "resource": "" }
q243880
MetadataDbIO.get_cursor
train
def get_cursor(self): """Get a cursor for the active connection. The cursor can be used to execute arbitrary queries against the database. This method also checks that the metadata table exists in the schema, and if not, it creates it. :returns: A valid cursor opened against th...
python
{ "resource": "" }
q243881
MetadataDbIO.hash_for_datasource
train
def hash_for_datasource(data_source): """Given a data_source, return its hash. :param data_source: The data_source name from a layer. :type data_source: str :returns: An md5 hash for the data source name. :rtype: str
python
{ "resource": "" }
q243882
MetadataDbIO.delete_metadata_for_uri
train
def delete_metadata_for_uri(self, uri): """Delete metadata for a URI in the metadata database. A hash will be constructed from the supplied uri and a lookup made in a local SQLITE database for the metadata. If there is an existing record for the hash, the entire record will be erased. ...
python
{ "resource": "" }
q243883
MetadataDbIO.write_metadata_for_uri
train
def write_metadata_for_uri(self, uri, json=None, xml=None): """Write metadata for a URI into the metadata database. All the metadata for the uri should be written in a single operation. A hash will be constructed from the supplied uri and a lookup made in a local SQLite database for the ...
python
{ "resource": "" }
q243884
MetadataDbIO.read_metadata_from_uri
train
def read_metadata_from_uri(self, uri, metadata_format): """Try to get metadata from the DB entry associated with a URI. This is used for layers that are non local layer (e.g. postgresql connection) and so we need to retrieve the metadata from the sqlite metadata db. A hash will...
python
{ "resource": "" }
q243885
report_on_field
train
def report_on_field(layer): """Helper function to set on which field we are going to report. The return might be empty if we don't report on a field. :param layer: The vector layer. :type layer: QgsVectorLayer :return: The field index on which we should report. :rtype: int """ source_...
python
{ "resource": "" }
q243886
StepFcExpLayerOrigin.set_widgets
train
def set_widgets(self): """Set widgets on the Exposure Layer Origin Type tab.""" # First, list available layers in order to check if there are # any available layers. Note This will be repeated in # set_widgets_step_fc_explayer_from_canvas because we need # to list them again afte...
python
{ "resource": "" }
q243887
check_input_layer
train
def check_input_layer(layer, purpose): """Function to check if the layer is valid. The function will also set the monkey patching if needed. :param layer: The layer to test. :type layer: QgsMapLayer :param purpose: The expected purpose of the layer. :type purpose: basestring :return: A t...
python
{ "resource": "" }
q243888
report_urls
train
def report_urls(impact_function): """Get report urls for all report generated by the ImpactFunction. :param impact_function: The ImpactFunction :type impact_function: ImpactFunction :return: Dictionary of all generated report urls by its product type eg: { 'html...
python
{ "resource": "" }
q243889
developer_help
train
def developer_help(): """Help message for developers. .. versionadded:: 4.1.0 :returns: A message object containing helpful information. :rtype: messaging.message.Message """
python
{ "resource": "" }
q243890
_get_definition_from_module
train
def _get_definition_from_module(definitions_module, symbol): """Given a python module fetch the declaration of a variable.""" path = definitions_module.__file__ path = path.replace('.pyc', '.py') source = open(path, encoding='utf-8').readlines() text = None for line in source: if symbol ...
python
{ "resource": "" }
q243891
gaussian_kernel
train
def gaussian_kernel(sigma, truncate=4.0): """Return Gaussian that truncates at the given number of std deviations. Adapted from https://github.com/nicjhan/gaussian-filter
python
{ "resource": "" }
q243892
tile_and_reflect
train
def tile_and_reflect(input): """Make 3x3 tiled array. Central area is 'input', surrounding areas are reflected. Adapted from https://github.com/nicjhan/gaussian-filter """ tiled_input = np.tile(input, (3, 3)) rows = input.shape[0] cols = input.shape[1] # Now we have a 3x3 tiles - do...
python
{ "resource": "" }
q243893
convolve
train
def convolve(input, weights, mask=None, slow=False): """2 dimensional convolution. This is a Python implementation of what will be written in Fortran. Borders are handled with reflection. Masking is supported in the following way: * Masked points are skipped. * Parts of the input whic...
python
{ "resource": "" }
q243894
create_smooth_contour
train
def create_smooth_contour( shakemap_layer, output_file_path='', active_band=1, smoothing_method=NUMPY_SMOOTHING, smoothing_sigma=0.9): """Create contour from a shake map layer by using smoothing method. :param shakemap_layer: The shake map raster layer. :type shakema...
python
{ "resource": "" }
q243895
smooth_shakemap
train
def smooth_shakemap( shakemap_layer_path, output_file_path='', active_band=1, smoothing_method=NUMPY_SMOOTHING, smoothing_sigma=0.9): """Make a smoother shakemap layer from a shake map. :param shakemap_layer_path: The shake map raster layer path. :type shakemap_layer...
python
{ "resource": "" }
q243896
shakemap_contour
train
def shakemap_contour(shakemap_layer_path, output_file_path='', active_band=1): """Creating contour from a shakemap layer. :param shakemap_layer_path: The shake map raster layer path. :type shakemap_layer_path: basestring :param output_file_path: The path where the contour will be saved. :type outp...
python
{ "resource": "" }
q243897
set_contour_properties
train
def set_contour_properties(contour_file_path): """Set the X, Y, RGB, ROMAN attributes of the contour layer. :param contour_file_path: Path of the contour layer. :type contour_file_path: str :raise: InvalidLayerError if anything is amiss with the layer. """ LOGGER.debug( 'Set_contour_pr...
python
{ "resource": "" }
q243898
create_contour_metadata
train
def create_contour_metadata(contour_path): """Create metadata file for contour layer. :param contour_path: Path where the contour is located. :type contour_path: basestring """ metadata = { 'title': tr('Earthquake Contour'), 'layer_purpose': layer_purpose_earthquake_contour['key'],
python
{ "resource": "" }
q243899
StepFcAggLayerOrigin.is_ready_to_next_step
train
def is_ready_to_next_step(self): """Check if the step is complete. If so, there is no reason to block the Next button. :returns: True if new step may be enabled. :rtype: bool """ return (bool(self.rbAggLayerFromCanvas.isChecked()
python
{ "resource": "" }