:param oqparam: an OqParam instance
    :param hazard: if True, consider only the hazard files
    :returns: input path names in a specific order
431701
def get_input_files(oqparam, hazard=False):
    
    fnames = []  # files entering in the checksum
    for key in oqparam.inputs:
        fname = oqparam.inputs[key]
        if hazard and key not in ('site_model', 'source_model_logic_tree',
                                  'gsim_logic_tree', 'source'):
            continue
        # collect .hdf5 tables for the GSIMs, if any
        elif key == 'gsim_logic_tree':
            gsim_lt = get_gsim_lt(oqparam)
            for gsims in gsim_lt.values.values():
                for gsim in gsims:
                    table = getattr(gsim, 'GMPE_TABLE', None)
                    if table:
                        fnames.append(table)
            fnames.append(fname)
        elif key == 'source_model':  # UCERF
            f = oqparam.inputs['source_model']
            fnames.append(f)
            fname = nrml.read(f).sourceModel.UCERFSource['filename']
            fnames.append(os.path.join(os.path.dirname(f), fname))
        elif key == 'exposure':  # fname is a list
            for exp in asset.Exposure.read_headers(fname):
                fnames.extend(exp.datafiles)
            fnames.extend(fname)
        elif isinstance(fname, dict):
            fnames.extend(fname.values())
        elif isinstance(fname, list):
            for f in fname:
                if f == oqparam.input_dir:
                    raise InvalidFile('%s there is an empty path in %s' %
                                      (oqparam.inputs['job_ini'], key))
            fnames.extend(fname)
        elif key == 'source_model_logic_tree':
            for smpaths in logictree.collect_info(fname).smpaths.values():
                fnames.extend(smpaths)
            fnames.append(fname)
        else:
            fnames.append(fname)
    return sorted(fnames)
1334189
def _get_path_params(match):
    
    result = {}
    for var_name, value in match.groupdict().iteritems():
      actual_var_name = ApiConfigManager._from_safe_path_param_name(var_name)
      result[actual_var_name] = urllib.unquote_plus(value)
    return result
669373
def _get_fqn(cls, path):
        
        name_list = [path.stem]
        current_path = path
        # move to parent path until parent path is a python package
        while cls.is_pkg(current_path.parent):
            name_list.append(current_path.parent.name)
            current_path = current_path.parent
        return list(reversed(name_list))
458139
def get_record_params(args):
    
    name, rtype, content, ttl, priority = (
        args.name, args.rtype, args.content, args.ttl, args.priority)
    return name, rtype, content, ttl, priority
1232154
def run_calc(job_id, oqparam, exports, hazard_calculation_id=None, **kw):
    
    setproctitle('oq-job-%d' % job_id)
    calc = base.calculators(oqparam, calc_id=job_id)
    logging.info('%s running %s [--hc=%s]',
                 getpass.getuser(),
                 calc.oqparam.inputs['job_ini'],
                 calc.oqparam.hazard_calculation_id)
    logging.info('Using engine version %s', __version__)
    msg = check_obsolete_version(oqparam.calculation_mode)
    if msg:
        logs.LOG.warn(msg)
    if OQ_DISTRIBUTE.startswith(('celery', 'zmq')):
        set_concurrent_tasks_default(job_id)
    calc.from_engine = True
    tb = 'None\n'
    try:
        if not oqparam.hazard_calculation_id:
            if 'input_zip' in oqparam.inputs:  # starting from an archive
                with open(oqparam.inputs['input_zip'], 'rb') as arch:
                    data = numpy.array(arch.read())
            else:
                logs.LOG.info('zipping the input files')
                bio = io.BytesIO()
                oqzip.zip_job(oqparam.inputs['job_ini'], bio, (), oqparam,
                              logging.debug)
                data = numpy.array(bio.getvalue())
                del bio
            calc.datastore['input/zip'] = data
            calc.datastore.set_attrs('input/zip', nbytes=data.nbytes)
            del data  # save memory

        poll_queue(job_id, _PID, poll_time=15)
        t0 = time.time()
        calc.run(exports=exports,
                 hazard_calculation_id=hazard_calculation_id,
                 close=False, **kw)
        logs.LOG.info('Exposing the outputs to the database')
        expose_outputs(calc.datastore)
        duration = time.time() - t0
        calc._monitor.flush()
        records = views.performance_view(calc.datastore)
        logs.dbcmd('save_performance', job_id, records)
        calc.datastore.close()
        logs.LOG.info('Calculation %d finished correctly in %d seconds',
                      job_id, duration)
        logs.dbcmd('finish', job_id, 'complete')
    except BaseException as exc:
        if isinstance(exc, MasterKilled):
            msg = 'aborted'
        else:
            msg = 'failed'
        tb = traceback.format_exc()
        try:
            logs.LOG.critical(tb)
            logs.dbcmd('finish', job_id, msg)
        except BaseException:  # an OperationalError may always happen
            sys.stderr.write(tb)
        raise
    finally:
        # if there was an error in the calculation, this part may fail;
        # in such a situation, we simply log the cleanup error without
        # taking further action, so that the real error can propagate
        try:
            if OQ_DISTRIBUTE.startswith('celery'):
                celery_cleanup(TERMINATE)
        except BaseException:
            # log the finalization error only if there is no real error
            if tb == 'None\n':
                logs.LOG.error('finalizing', exc_info=True)
    return calc
17094
def get_params(self, *args, **kwargs):
        '''
        
        '''
        kwargs.update(self._data)
        if args and kwargs:
            raise ValueError('Cannot mix positional and named parameters')
        if args:
            return list(args)
        else:
            return kwargs
1078918
def get_risk_model(oqparam):
    
    tmap = _get_taxonomy_mapping(oqparam.inputs)
    fragdict = get_risk_models(oqparam, 'fragility')
    vulndict = get_risk_models(oqparam, 'vulnerability')
    consdict = get_risk_models(oqparam, 'consequence')
    if not tmap:  # the risk ids are the taxonomies already
        d = dict(ids=['?'], weights=[1.0])
        for risk_id in set(fragdict) | set(vulndict) | set(consdict):
            tmap[risk_id] = dict(
                fragility=d, consequence=d, vulnerability=d)
        for risk_id in consdict:
            cdict, fdict = consdict[risk_id], fragdict[risk_id]
            for loss_type, _ in cdict:
                c = cdict[loss_type, 'consequence']
                f = fdict[loss_type, 'fragility']
                csq_dmg_states = len(c.params)
                if csq_dmg_states != len(f):
                    raise ValueError(
                        'The damage states in %s are different from the '
                        'damage states in the fragility functions, %s'
                        % (c, fragdict.limit_states))
    dic = {}
    dic.update(fragdict)
    dic.update(vulndict)
    oqparam.set_risk_imtls(dic)
    if oqparam.calculation_mode.endswith('_bcr'):
        retro = get_risk_models(oqparam, 'vulnerability_retrofitted')
    else:
        retro = {}
    return riskinput.CompositeRiskModel(
        oqparam, tmap, fragdict, vulndict, consdict, retro)
412181
public static String pathParam(String param, ContainerRequestContext ctx) {
		return ctx.getUriInfo().getPathParameters().getFirst(param);
	}
52977
public ImmutableList<File> getExistingDirectories(String param) {
    final List<String> fileStrings = getStringList(param);
    final ImmutableList.Builder<File> ret = ImmutableList.builder();

    for (final String dirName : fileStrings) {
      final File dir = new File(dirName.trim());
      if (!dir.isDirectory()) {
        throw new ParameterValidationException(fullString(param), dirName,
            "path does not exist or is not a directory");
      }
      ret.add(dir);
    }

    return ret.build();
  }
1069777
def hazard_curve_name(dstore, ekey, kind, rlzs_assoc):
    
    key, fmt = ekey
    prefix = {'hcurves': 'hazard_curve', 'hmaps': 'hazard_map',
              'uhs': 'hazard_uhs'}[key]
    if kind.startswith('quantile-'):  # strip the 7 characters 'hazard_'
        fname = dstore.build_fname('quantile_' + prefix[7:], kind[9:], fmt)
    else:
        fname = dstore.build_fname(prefix, kind, fmt)
    return fname
118910
def validate_path_parameters(target_path, api_path, path_parameters, context):
    
    base_path = context.get('basePath', '')
    full_api_path = re.sub(NORMALIZE_SLASH_REGEX, '/', base_path + api_path)
    parameter_values = get_path_parameter_values(
        target_path, full_api_path, path_parameters, context,
    )
    validate_parameters(parameter_values, path_parameters, context=context)
137672
def params(self):
        
        if self._params is None:
            self._params = self.arg_container()

            data = compat.parse_qs(self.environ('QUERY_STRING') or '')
            for k, v in data.items():
                self._params[k] = v[0]

        return self._params
695414
def _get_output_path(self):
        """"""
        if self.Parameters['-o'].isOn():
            output_path = self._absolute(str(self.Parameters['-o'].Value))
        else:
            raise ValueError("No output path specified.")
        return output_path
167244
def prepare_post_parameters(self, post_params=None, files=None):
        
        params = []

        if post_params:
            params = post_params

        if files:
            for k, v in six.iteritems(files):
                if not v:
                    continue
                file_names = v if type(v) is list else [v]
                for n in file_names:
                    with open(n, 'rb') as f:
                        filename = os.path.basename(f.name)
                        filedata = f.read()
                        mimetype = (mimetypes.guess_type(filename)[0] or
                                    'application/octet-stream')
                        params.append(
                            tuple([k, tuple([filename, filedata, mimetype])]))

        return params
539360
def parameter_list(data):
        
        items = []
        for item in data:
            param = Parameter(item['name'], item['value'])
            if 'meta' in item: param.meta = item['meta']
            items.append(param)
        return items
833650
def param_value(param_values, slug):
    
    for val in param_values:
        if val.param.slug == slug:
            return val.value
    return None
771018
def path_to_pattern(api_path, parameters):
    
    parts = re.split(PARAMETER_REGEX, api_path)
    pattern = ''.join((process_path_part(part, parameters) for part in parts))

    if not pattern.startswith('^'):
        pattern = "^{0}".format(pattern)
    if not pattern.endswith('$'):
        pattern = "{0}$".format(pattern)

    return pattern