Try importing a parameter dictionary from file.

    We expect values in parameters_file to be defined as follows:
        param1: value1
        param2: [value2, value3]
167067
def import_parameters_from_file(parameters_file):
    
    params = {}

    with open(parameters_file, 'r') as f:
        matches = re.findall('(.*): (.*)', f.read())

    for m in matches:
        params[m[0]] = ast.literal_eval(m[1])

    return params
1117515
def load_parameters(self, path):
        
        nn.load_parameters(path)
        for v in self.get_modules():
            if not isinstance(v, tuple):
                continue
            prefix, module = v
            for k, v in module.__dict__.items():
                if not isinstance(v, nn.Variable):
                    continue
                pname = k
                name = "{}/{}".format(prefix, pname)
                # Substitute
                param0 = v
                param1 = nn.parameter.pop_parameter(name)
                if param0 is None:
                    raise ValueError(
                        "Model does not have {} parameter.".format(name))
                param0.d = param1.d.copy()
                nn.logger.info("`{}` loaded.)".format(name))
719207
def cmdline_params(self, structure_file_name, surface_sample_file_name):
        
        parameters = []

        parameters += [structure_file_name]
        parameters += [surface_sample_file_name]

        pm_dict = self.get_dict()

        # replace sampling method string by number
        pm_dict['sampling_method'] = sampling_methods[pm_dict[
            'sampling_method']]

        # order matters here!
        for key in [
                'accessible_surface_area',
                'sampling_density',
                'output_surface',
                'target_volume',
                'sampling_method',
                'cubic_target',
        ]:
            parameters.append(pm_dict[key])

        return map(str, parameters)
876519
def p_params(self, p):
        ''
        p[0] = p[1] + (p[2],)
        p.set_lineno(0, p.lineno(1))
1124560
def write_params(path, *args, **dicts):
    
    path = Path(path)
    if not path.parent.is_dir():
        path.parent.mkdir(parents=True)
    if len(args) == 1:
        d = args[0]
        with path.open('w') as f:
            for key in d:
                f.write(key + ' = ' + str(d[key]) + '\n')
    else:
        with path.open('w') as f:
            for k, d in dicts.items():
                f.write('[' + k + ']\n')
                for key, val in d.items():
                    f.write(key + ' = ' + str(val) + '\n')
816287
def get_params(self, param_list=None, get_path=False, merged=False, raw=False):
        
        # Convert parameter name to list
        if param_list and isinstance(param_list, str):
            param_list = [param_list]
        if param_list and isinstance(param_list, (list, tuple)):
            result = {k: v for k, v in self._params_found.items() if k in param_list}
            result.update({k: v for k, v in self._params.items() if (k in param_list and k not in result)})
        else:
            result = {k: v for k, v in self._params_found.items()}
            result.update({k: v for k, v in self._params.items() if k not in result})
        if get_path:
            result['path'] = self.unpacked_path
        if merged:
            result.update(self._parser.merge_valued(result))
        if raw:
            result.update({k: v for k, v in self._params_found_raw.items()})
        return result
773881
def parse_params(params, key_word)
      body = params.has_key?(:path) ? load_file(params[:path], key_word) : params
      body = { key_word => body } unless body.has_key?(key_word.to_sym)
      body
    end
35283
def p_param_definition(p):
    
    p[0] = p[1]
    if p[0] is not None:
        p[0].byref = OPTIONS.byref.value
557067
def parameters(self, value):
        

        assert len(value) == self.n_parameters
        i = 0
        for task in self.tasks:
            task.parameters = value[i:i + task.n_parameters]
            i += task.n_parameters
273409
def add_param(param):
    # type: (Param) -> Callable
    
    def inner(o):
        try:
            getattr(o, 'parameters').add(param)
        except AttributeError:
            setattr(o, 'parameters', {param})
        return o
    return inner
240585
def prepare_post_parameters(self, post_params=None, files=None):
        
        params = post_params or []
        for key, values in (files or {}).items():
            for maybe_file_or_path in values if isinstance(values, list) else [values]:
                try:
                    # use the parameter as if it was an open file object
                    data = maybe_file_or_path.read()
                    maybe_file_or_path = maybe_file_or_path.name
                except AttributeError:
                    # then it is presumably a file path
                    with open(maybe_file_or_path, 'rb') as fh:
                        data = fh.read()
                basepath = os.path.basename(maybe_file_or_path)
                mimetype = mimetypes.guess_type(basepath)[0] or 'application/octet-stream'
                params.append((key, (basepath, data, mimetype)))
        return params
1130615
def save_params_to_file(self, fname: str):
        
        arg_params, aux_params = self.module.get_params()
        self.module.set_params(arg_params, aux_params)
        self.params = arg_params
        self.aux_params = aux_params
        super().save_params_to_file(fname)
544324
def parameters(self, parameters):
        """"""
        # pylint: disable=attribute-defined-outside-init
        self._parameters = NocaseDict()
        if parameters:
            try:
                # This is used for iterables:
                iterator = parameters.items()
            except AttributeError:
                # This is used for dictionaries:
                iterator = parameters
            for item in iterator:
                if isinstance(item, CIMParameter):
                    key = item.name
                    value = item
                elif isinstance(item, tuple):
                    key, value = item
                else:
                    raise TypeError(
                        _format("Input object for parameters has invalid item "
                                "in iterable: {0!A}", item))
                self.parameters[key] = value
62092
def read_parameters(self):
        
        param_fname = join(self.out_dir, "PARAMETERS.OUT")

        if not exists(param_fname):
            raise FileNotFoundError("No PARAMETERS.OUT found")

        with open(param_fname) as nml_file:
            parameters = dict(f90nml.read(nml_file))
            for group in ["nml_years", "nml_allcfgs", "nml_outputcfgs"]:
                parameters[group] = dict(parameters[group])
                for k, v in parameters[group].items():
                    parameters[group][k] = _clean_value(v)
                parameters[group.replace("nml_", "")] = parameters.pop(group)
            self.config = parameters
        return parameters
692531
def merge_parameter_lists(*parameter_definitions):
    
    merged_parameters = {}
    for parameter_list in parameter_definitions:
        for parameter in parameter_list:
            key = (parameter['name'], parameter['in'])
            merged_parameters[key] = parameter
    return merged_parameters.values()
691278
def _input_as_parameter(self, data):
        
        self.Parameters['-i'].on(data)
        # access data through self.Parameters so we know it's been cast
        # to a FilePath
        input_filepath = self.Parameters['-i'].Value
        input_file_dir, input_filename = split(input_filepath)
        input_file_base, input_file_ext = splitext(input_filename)
        # FIXME: the following all other options
        # formatdb ignores the working directory if not name is passed.
        self.Parameters['-l'].on(FilePath('%s.log') % input_filename)
        self.Parameters['-n'].on(FilePath(input_filename))
        return ''
1332471
def p_ParamList(p):
    '''
    
    '''
    if len(p) == 1:
        p[0] = ParamList(None, None)
    elif len(p) == 2:
        p[0] = ParamList(None, p[1])
    else:
        p[0] = ParamList(p[1], p[3])