Writes current GUI acceptance criteria to criteria.txt or
        pmag_criteria.txt depending on data model
172387
def write_acceptance_criteria_to_file(self):
        
        crit_list = list(self.acceptance_criteria.keys())
        crit_list.sort()
        rec = {}
        rec['pmag_criteria_code'] = "ACCEPT"
        # rec['criteria_definition']=""
        rec['criteria_definition'] = "acceptance criteria for study"
        rec['er_citation_names'] = "This study"

        for crit in crit_list:
            if type(self.acceptance_criteria[crit]['value']) == str:
                if self.acceptance_criteria[crit]['value'] != "-999" and self.acceptance_criteria[crit]['value'] != "":
                    rec[crit] = self.acceptance_criteria[crit]['value']
            elif type(self.acceptance_criteria[crit]['value']) == int:
                if self.acceptance_criteria[crit]['value'] != -999:
                    rec[crit] = "%.i" % (
                        self.acceptance_criteria[crit]['value'])
            elif type(self.acceptance_criteria[crit]['value']) == float:
                if float(self.acceptance_criteria[crit]['value']) == -999:
                    continue
                decimal_points = self.acceptance_criteria[crit]['decimal_points']
                if decimal_points != -999:
                    command = "rec[crit]='%%.%sf'%%(self.acceptance_criteria[crit]['value'])" % (
                        decimal_points)
                    exec(command)
                else:
                    rec[crit] = "%e" % (
                        self.acceptance_criteria[crit]['value'])
        pmag.magic_write(os.path.join(self.WD, "pmag_criteria.txt"), [
                         rec], "pmag_criteria")
681779
def On_close_criteria_box(self, dia):
        
        criteria_list = list(self.acceptance_criteria.keys())
        criteria_list.sort()

        #---------------------------------------
        # check if averaging by sample or by site
        # and intialize sample/site criteria
        #---------------------------------------
        avg_by = dia.set_average_by_sample_or_site.GetValue()
        if avg_by == 'sample':
            for crit in ['site_int_n', 'site_int_sigma', 'site_int_sigma_perc', 'site_aniso_mean', 'site_int_n_outlier_check']:
                self.acceptance_criteria[crit]['value'] = -999

        if avg_by == 'site':
            for crit in ['sample_int_n', 'sample_int_sigma', 'sample_int_sigma_perc', 'sample_aniso_mean', 'sample_int_n_outlier_check']:
                self.acceptance_criteria[crit]['value'] = -999

        #---------
        # get value for each criterion
        for i in range(len(criteria_list)):
            crit = criteria_list[i]
            value, accept = dia.get_value_for_crit(crit, self.acceptance_criteria)
            if accept:
                self.acceptance_criteria.update(accept)
        #---------
        # thellier interpreter calculation type
        if dia.set_stdev_opt.GetValue() == True:
            self.acceptance_criteria['interpreter_method']['value'] = 'stdev_opt'
        elif dia.set_bs.GetValue() == True:
            self.acceptance_criteria['interpreter_method']['value'] = 'bs'
        elif dia.set_bs_par.GetValue() == True:
            self.acceptance_criteria['interpreter_method']['value'] = 'bs_par'

        #  message dialog
        dlg1 = wx.MessageDialog(
            self, caption="Warning:", message="changes are saved to the criteria file\n ", style=wx.OK)
        result = self.show_dlg(dlg1)
        if result == wx.ID_OK:
            try:
                self.clear_boxes()
            except IndexError:
                pass
            try:
                self.write_acceptance_criteria_to_boxes()
            except IOError:
                pass
            if self.data_model == 3:
                crit_file = 'criteria.txt'
            else:
                crit_file = 'pmag_criteria.txt'
            try:
                pmag.write_criteria_to_file(os.path.join(
                    self.WD, crit_file), self.acceptance_criteria, data_model=self.data_model, prior_crits=self.crit_data)
            except AttributeError as ex:
                print(ex)
                print("no criteria given to save")
            dlg1.Destroy()
            dia.Destroy()

        self.fig4.texts[0].remove()
        txt = "{} data".format(avg_by).capitalize()
        self.fig4.text(0.02, 0.96, txt, {
                       'family': self.font_type, 'fontsize': 10, 'style': 'normal', 'va': 'center', 'ha': 'left'})
        self.recalculate_satistics()
        try:
            self.update_GUI_with_new_interpretation()
        except KeyError:
            pass
1141780
private void writeAvailability(Project.Resources.Resource xml, Resource mpx)
   {
      AvailabilityPeriods periods = m_factory.createProjectResourcesResourceAvailabilityPeriods();
      xml.setAvailabilityPeriods(periods);
      List<AvailabilityPeriod> list = periods.getAvailabilityPeriod();
      for (Availability availability : mpx.getAvailability())
      {
         AvailabilityPeriod period = m_factory.createProjectResourcesResourceAvailabilityPeriodsAvailabilityPeriod();
         list.add(period);
         DateRange range = availability.getRange();

         period.setAvailableFrom(range.getStart());
         period.setAvailableTo(range.getEnd());
         period.setAvailableUnits(DatatypeConverter.printUnits(availability.getUnits()));
      }
   }
277528
def write_acceptance_criteria_to_boxes(self):
        

        self.ignore_parameters, value = {}, ''
        for crit_short_name in self.preferences['show_statistics_on_gui']:
            crit = "specimen_" + crit_short_name
            if self.acceptance_criteria[crit]['value'] == -999:
                self.threshold_windows[crit_short_name].SetValue("")
                self.threshold_windows[crit_short_name].SetBackgroundColour(
                    wx.Colour(128, 128, 128))
                self.ignore_parameters[crit] = True
                continue
            elif crit == "specimen_scat":
                if self.acceptance_criteria[crit]['value'] in ['g', 1, '1', True, "True", "t"]:
                    value = "True"
                    value = "t"
                    #self.scat_threshold_window.SetBackgroundColour(wx.SetBackgroundColour(128, 128, 128))
                else:
                    value = ""
                    value = "f"
                    self.threshold_windows['scat'].SetBackgroundColour(
                        (128, 128, 128))
                    #self.scat_threshold_window.SetBackgroundColour((128, 128, 128))

            elif type(self.acceptance_criteria[crit]['value']) == int:
                value = "%i" % self.acceptance_criteria[crit]['value']
            elif type(self.acceptance_criteria[crit]['value']) == float:
                if self.acceptance_criteria[crit]['decimal_points'] == -999:
                    value = "%.3e" % self.acceptance_criteria[crit]['value']
                else:
                    value = "{:.{}f}".format(self.acceptance_criteria[crit]['value'],
                                             self.acceptance_criteria[crit]['decimal_points'])
            else:
                continue

            self.threshold_windows[crit_short_name].SetValue(value)
            self.threshold_windows[crit_short_name].SetBackgroundColour(
                wx.WHITE)
153530
def accept(self):
        """"""
        error_dialog_title = self.tr('InaSAFE OpenStreetMap Downloader Error')

        # Lock the bounding_box_group
        self.bounding_box_group.setDisabled(True)

        # Get the extent
        y_minimum = self.y_minimum.value()
        y_maximum = self.y_maximum.value()
        x_minimum = self.x_minimum.value()
        x_maximum = self.x_maximum.value()
        extent = [x_minimum, y_minimum, x_maximum, y_maximum]

        # Validate extent
        valid_flag = validate_geo_array(extent)
        if not valid_flag:
            message = self.tr(
                'The bounding box is not valid. Please make sure it is '
                'valid or check your projection!')
            # noinspection PyCallByClass,PyTypeChecker,PyArgumentList
            display_warning_message_box(self, error_dialog_title, message)
            # Unlock the bounding_box_group
            self.bounding_box_group.setEnabled(True)
            return

        # Validate features
        feature_types = self.get_checked_features()
        if len(feature_types) < 1:
            message = self.tr(
                'No feature selected. '
                'Please make sure you have checked one feature.')
            # noinspection PyCallByClass,PyTypeChecker,PyArgumentList
            display_warning_message_box(self, error_dialog_title, message)
            # Unlock the bounding_box_group
            self.bounding_box_group.setEnabled(True)
            return

        if self.radio_custom.isChecked():
            server_url = self.line_edit_custom.text()
            if not server_url:
                # It's the place holder.
                server_url = STAGING_SERVER
        else:
            server_url = PRODUCTION_SERVER

        try:
            self.save_state()
            self.require_directory()

            # creating progress dialog for download
            self.progress_dialog = QProgressDialog(self)
            self.progress_dialog.setAutoClose(False)
            self.progress_dialog.setWindowTitle(self.windowTitle())

            for feature_type in feature_types:

                output_directory = self.output_directory.text()
                if output_directory == '':
                    output_directory = temp_dir(sub_dir='work')
                output_prefix = self.filename_prefix.text()
                overwrite = self.overwrite_flag.isChecked()
                output_base_file_path = self.get_output_base_path(
                    output_directory, output_prefix, feature_type, overwrite)

                # noinspection PyTypeChecker
                download(
                    feature_type,
                    output_base_file_path,
                    extent,
                    self.progress_dialog,
                    server_url
                )

                try:
                    self.load_shapefile(feature_type, output_base_file_path)
                except FileMissingError as exception:
                    display_warning_message_box(
                        self,
                        error_dialog_title,
                        str(exception))
            self.done(QDialog.Accepted)
            self.rectangle_map_tool.reset()

        except CanceledImportDialogError:
            # don't show anything because this exception raised
            # when user canceling the import process directly
            pass
        except Exception as exception:  # pylint: disable=broad-except
            # noinspection PyCallByClass,PyTypeChecker,PyArgumentList
            display_warning_message_box(
                self, error_dialog_title, str(exception))

            self.progress_dialog.cancel()
            self.progress_dialog.deleteLater()

        finally:
            # Unlock the bounding_box_group
            self.bounding_box_group.setEnabled(True)
74917
def __generic_save(self):
        """"""
        page = self._get_page()
        f = page.editor.f
        if not f:
            return True
        if not page.editor.flag_valid:
            a99.show_error("Cannot save, {0!s} has error(s)!".format(f.description))
            return True
        if f.filename:
            f.save_as()

            self.add_log("Saved '{}'".format(f.filename))
            page.flag_changed = False
            self._update_gui_text_tabs()

            if hasattr(page.editor, "update_gui_label_fn"):
                page.editor.update_gui_label_fn()  # duck typing
            return True
        else:
            return self.__generic_save_as()
1283847
def export(self, version, export_dir):
        

        atts = [
            (PROV['type'], self.type),
            (PROV['label'], self.label),
        ]

        if version['num'] == "1.0.0":
            atts += [
                (NIDM_USER_SPECIFIED_THRESHOLD_TYPE, self.user_threshold_type),
                (PROV['value'], self.stat_threshold),
                (NIDM_P_VALUE_UNCORRECTED, self.p_uncorr_threshold),
                (NIDM_P_VALUE_FWER, self.p_corr_threshold)
                ]
        else:
            atts += [
                (PROV['type'], self.threshold_type),
                (PROV['value'], self.value)
                ]

        if self.equiv_thresh is not None:
            for equiv in self.equiv_thresh:
                atts += [
                    (NIDM_EQUIVALENT_THRESHOLD, equiv.id)
                ]

        self.add_attributes([(k, v) for k, v in atts if v is not None])
470138
def accept(self):
        """"""
        configurations = []
        for index in range(self.stack.count()):
            filename = to_text_string(self.combo.itemText(index))
            runconfigoptions = self.stack.widget(index)
            if index == self.stack.currentIndex() and\
               not runconfigoptions.is_valid():
                return
            options = runconfigoptions.get()
            configurations.append( (filename, options) )
        _set_run_configurations(configurations)
        QDialog.accept(self)
640875
public void submit(CmsUser user, CmsObject cms, Runnable afterWrite, boolean force) {

        try {
            if (isValid() | force) {
                if (force) {
                    removeValidators();
                }
                m_binder.commit();
                PropertyUtilsBean propUtils = new PropertyUtilsBean();
                for (CmsAccountInfo info : OpenCms.getWorkplaceManager().getAccountInfos()) {
                    boolean editable = (m_editLevel == EditLevel.all)
                        || ((m_editLevel == EditLevel.configured) && info.isEditable());
                    if (editable) {
                        if (info.isAdditionalInfo()) {
                            user.setAdditionalInfo(info.getAddInfoKey(), m_infos.getItemProperty(info).getValue());
                        } else {
                            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(
                                (String)m_infos.getItemProperty(info).getValue())) {
                                propUtils.setProperty(
                                    user,
                                    info.getField().name(),
                                    m_infos.getItemProperty(info).getValue());
                            }
                        }
                    }
                }
                cms.writeUser(user);
                afterWrite.run();
            }
        } catch (CmsException | CommitException | IllegalAccessException | InvocationTargetException
        | NoSuchMethodException e) {
            LOG.error("Unable to commit changes to user..", e);
        }
    }
1353922
def _check_ui_parameters(self):
        
        if isinstance(self.PARAMETER_UI_STUFF, dict):
            for param in self.PARAMETER_UI_STUFF.keys():
                # check parameter value can be found
                if not hasattr(self, param) and not hasattr(Task, param):
                    raise TaskValidationError('task "{}" defines parameter "{}" but a task attribute with that name '
                                              'could not be found'.format(self.NAME, param))

                # parameter cannot be None if not explicitly allowed
                if (getattr(self, param) is None
                    and (KEY_NONE_ALLOWED not in self.PARAMETER_UI_STUFF[param]
                         or not self.PARAMETER_UI_STUFF[param][KEY_NONE_ALLOWED])):
                    raise TaskValidationError('parameter "{}" is None and None is not explicitly allowed'
                                              ''.format(param))
40558
void submit() {

        try {
            OpenCms.getSiteManager().updateGeneralSettings(
                m_cms,
                ((CmsSite)m_fieldDefaultURI.getValue()).getSiteRoot(),
                getWebserverList(),
                "/" + (String)m_fieldSharedFolder.getValue() + "/");
            if (!CmsEditSiteForm.FORBIDDEN_FOLDER_NAMES.isEmpty()) {
                CmsEditSiteForm.FORBIDDEN_FOLDER_NAMES.set(1, (String)m_fieldSharedFolder.getValue());
            }
            // write the system configuration
            OpenCms.writeConfiguration(CmsSitesConfiguration.class);
        } catch (CmsException e) {
            //
        }

    }
280114
def accept(self):
        
        # set parameter from dialog
        input_layer = self.layer.currentLayer()
        output_path = self.output_form.text()
        radius = self.get_classification()
        # monkey patch keywords so layer works on multi buffering function
        input_layer.keywords = {'inasafe_fields': {}}

        # run multi buffering
        self.output_layer = multi_buffering(input_layer, radius)

        # save output layer to data store and check whether user
        # provide the output path.
        if output_path:
            self.output_directory, self.output_filename = (
                os.path.split(output_path))
            self.output_filename, self.output_extension = (
                os.path.splitext(self.output_filename))

        # if user do not provide the output path, create a temporary file.
        else:
            self.output_directory = temp_dir(sub_dir='work')
            self.output_filename = (
                unique_filename(
                    prefix='hazard_layer',
                    suffix='.geojson',
                    dir=self.output_directory))
            self.output_filename = os.path.split(self.output_filename)[1]
            self.output_filename, self.output_extension = (
                os.path.splitext(self.output_filename))

        self.data_store = Folder(self.output_directory)
        if self.output_extension == '.shp':
            self.data_store.default_vector_format = 'shp'
        elif self.output_extension == '.geojson':
            self.data_store.default_vector_format = 'geojson'
        self.data_store.add_layer(self.output_layer, self.output_filename)

        # add output layer to map canvas
        self.output_layer = self.data_store.layer(self.output_filename)

        QgsProject.instance().addMapLayers(
            [self.output_layer])
        self.iface.setActiveLayer(self.output_layer)
        self.iface.zoomToActiveLayer()
        self.done(QtWidgets.QDialog.Accepted)

        if self.keyword_wizard_checkbox.isChecked():
            self.launch_keyword_wizard()
558117
def _write(self, session, openFile, replaceParamFile):
        
        # Retrieve TargetParameter objects
        targets = self.targetParameters

        # Write lines
        openFile.write('%s\n' % self.numParameters)

        for target in targets:
            openFile.write('%s %s\n' % (target.targetVariable, target.varFormat))
1352233
def do_it(self, dbg):
        '''  '''
        try:
            xml = StringIO.StringIO()
            xml.write("<xml>")
            _typeName, val_dict = pydevd_vars.resolve_compound_variable_fields(
                dbg, self.thread_id, self.frame_id, self.scope, self.attributes)
            if val_dict is None:
                val_dict = {}

            # assume properly ordered if resolver returns 'OrderedDict'
            # check type as string to support OrderedDict backport for older Python
            keys = dict_keys(val_dict)
            if not (_typeName == "OrderedDict" or val_dict.__class__.__name__ == "OrderedDict" or IS_PY36_OR_GREATER):
                keys.sort(key=compare_object_attrs_key)

            for k in keys:
                val = val_dict[k]
                evaluate_full_value = pydevd_xml.should_evaluate_full_value(val)
                xml.write(pydevd_xml.var_to_xml(val, k, evaluate_full_value=evaluate_full_value))

            xml.write("</xml>")
            cmd = dbg.cmd_factory.make_get_variable_message(self.sequence, xml.getvalue())
            xml.close()
            dbg.writer.add_command(cmd)
        except Exception:
            cmd = dbg.cmd_factory.make_error_message(
                self.sequence, "Error resolving variables %s" % (get_exception_traceback_str(),))
            dbg.writer.add_command(cmd)
152793
def main(args):
  
  print_in_box('Validating submission ' + args.submission_filename)
  random.seed()
  temp_dir = args.temp_dir
  delete_temp_dir = False
  if not temp_dir:
    temp_dir = tempfile.mkdtemp()
    logging.info('Created temporary directory: %s', temp_dir)
    delete_temp_dir = True
  validator = submission_validator_lib.SubmissionValidator(temp_dir,
                                                           args.use_gpu)
  if validator.validate_submission(args.submission_filename,
                                   args.submission_type):
    print_in_box('Submission is VALID!')
  else:
    print_in_box('Submission is INVALID, see log messages for details')
  if delete_temp_dir:
    logging.info('Deleting temporary directory: %s', temp_dir)
    subprocess.call(['rm', '-rf', temp_dir])
948336
def prompt_filetype(args):
    """"""
    valid_types = ('print', 'text', 'csv', 'pdf', 'html')
    if not any(args[x] for x in valid_types):
        try:
            filetype = input('Print or save output as ({0}): '
                             .format(', '.join(valid_types))).lower()
            while filetype not in valid_types:
                filetype = input('Invalid entry. Choose from ({0}): '
                                 .format(', '.join(valid_types))).lower()
        except (KeyboardInterrupt, EOFError):
            return
        args[filetype] = True
1158724
def cli(yaml_paths, pptx_template_path, font_size, master_slide_idx, slide_layout_idx, dst_dir, font_name,
        slide_txt_alignment, validate):
    

    dst_dir = Path(dst_dir)

    pptx_template_path = Path(pptx_template_path)
    pptx_template = pick_master_slide(pptx_template_path)

    yamlfiles = []
    for yaml_path in yaml_paths:
        yaml_path = Path(yaml_path)
        if yaml_path.is_dir():
            yamlfiles.extend([yml for yml in yaml_path.iterdir()])
        else:
            yamlfiles.append(yaml_path)

    if validate:
        exit_fail = False
        for yamlfile in yamlfiles:
            try:
                validate_yaml_file(SCHEMA_FOR_YAML, Path(yamlfile))
                msg = f"VALIDATE: Validation of {yamlfile} passed"
                click.echo(click.style(msg, fg="blue"))
            except jsonschema.exceptions.ValidationError as err:
                msg = f"ERR: {yamlfile} {str(err.message)} {err.path}"
                click.echo(click.style(msg, fg="red"), nl=True)
                exit_fail = True
            except Exception:
                raise
        if exit_fail:
            sys.exit(1)

    for yamlfile in yamlfiles:
        try:
            r = build_slide(
                    Path(yamlfile),
                    pptx_template,
                    master_slide_idx,
                    slide_layout_idx,
                    font_size,
                    dst_dir,
                    font_name,
                    slide_txt_alignment
                )
            msg = f"PPTX: {r}"
            click.echo(click.style(msg, fg="green"))
        except Exception:
            raise