Convenience wrapper for new_param() that constructs a Param element
	from an instance of a Python builtin type.  See new_param() for a
	description of the valid keyword arguments.
10882
def from_pyvalue(name, value, **kwargs):
	
	return new_param(name, ligolwtypes.FromPyType[type(value)], value, **kwargs)
1219717
def new_with_params(self, param_groups:Collection[Collection[nn.Parameter]]):
        ""
        opt_func = getattr(self, 'opt_func', self.opt.__class__)
        opt = opt_func([{'params': p, 'lr':0} for p in param_groups])
        opt = self.__class__(opt, wd=self.wd, true_wd=self.true_wd, bn_wd=self.bn_wd)
        opt.lr,opt.opt_func,opt.mom,opt.beta = self.lr,opt_func,self.mom,self.beta
        return opt
1071134
def add_param(self, param_key, param_val):
        
        self.params.append([param_key, param_val])
        if param_key == '__success_test':
            self.success = param_val
1225196
def new(cls, ver_key: VerKey, sign_key: SignKey) -> 'ProofOfPossession':
        
        logger = logging.getLogger(__name__)
        logger.debug("ProofOfPossession::new: >>>")

        c_instance = c_void_p()
        do_call(cls.new_handler, ver_key.c_instance, sign_key.c_instance, byref(c_instance))

        res = cls(c_instance)

        logger.debug("ProofOfPossession::new: <<< res: %r", res)
        return res
182952
def new_plugin(self, config, *args, **kwargs):
        
        typ = None
        obj = None

        # if type is defined, create a new instance
        if 'type' in config:
            typ = config['type']

        # single key is overriding an existing plugin instance
        elif isinstance(config, collections.Mapping) and len(config) == 1:
            # get type name and shift out config to parent level
            (typ, config) = list(config.items())[0]

        obj = self._ctor(typ, config, *args, **kwargs)

        # store if named
        if 'name' in config:
            self._instance[config['name']] = obj
        else:
            # this could dupe on .name, make name=''?
            config['name'] = typ

        return obj
7750
def create_new_post(params)      
      post_title = params['post']['title']
      post_date  = (Time.now).strftime("%Y-%m-%d")

      content    = yaml_data(post_title).to_yaml + "---\n" + params[:post][:content]
      post_file  = (post_date + " " + post_title).to_url + '.md'
      file       = File.join(jekyll_site.source, *%w[_posts], post_file)
      File.open(file, 'w') { |file| file.write(content)}
      post_file
    end
105287
def new(*args, &block)
      procedure = find_procedure(:new)
      # in case of collections pass array of elements as one argument for constructor
      if collection? && !(args.size == 1 && args[0].is_a?(Array))
        args = [args]
      end
      result = procedure.exec_with_options(args, { skip_self: true }, &block)
      # TODO: collection constructor should return Array of ObhjectInstance objects
      if collection?
        result
      else
        # TODO: what to do if block is passed to constructor?
        ObjectInstance.create(self, result)
      end
    end
442667
def add_parameter(self, param_name, description=None, default=0, unit=None):
        

        if description is None:
            description = "Parameter called {}".format(param_name)

        if unit is None:
            unit = "-"
        
        name_check = lambda x: x['name'] == param_name
        name_check_list = list(filter(name_check, self.ext_params))
        if len(name_check_list) == 0:
            self.ext_params.append({'name': param_name, 'description': description, 'default': default, 'unit': unit})
        else:
            print('{} already exists - choose a different name'.format(param_name))
1306745
def explainParam(self, param):
        
        param = self._resolveParam(param)
        values = []
        if self.isDefined(param):
            if param in self._defaultParamMap:
                values.append("default: %s" % self._defaultParamMap[param])
            if param in self._paramMap:
                values.append("current: %s" % self._paramMap[param])
        else:
            values.append("undefined")
        valueStr = "(" + ", ".join(values) + ")"
        return "%s: %s %s" % (param.name, param.doc, valueStr)
376678
def instantiate(params)
      instance = Instance.new( *interpolate(params), @parent )
      instance.apply_resource_type
      instance
    end
324698
def new(cls, nsptagname, val):
        
        return OxmlElement(nsptagname, attrs={qn('w:val'): str(val)})
171022
function newParam (columnName) {
    var i = 0
    // get placeholder name based on column name with counter
    // added if the same column name is used multiple times
    while (i < 99) {
        // use column name as base for param name
        var paramName = columnName+i
        // if param name is not in use then use it - caller will add
        // param to params map with value for substitution
        if (this.params[paramName] === undefined) {
            return paramName
        }
        // try next number
        i++
    }
    // if placeholder could not be found throw error
    throw new Error('max paramName exceeded '+columName)
}
389798
def new_figure_manager(num, *args, **kwargs):
    
    # in order to expose the Figure constructor to the pylab
    # interface we need to create the figure here
    DEBUG_MSG("new_figure_manager()", 3, None)
    _create_wx_app()

    FigureClass = kwargs.pop('FigureClass', Figure)
    fig = FigureClass(*args, **kwargs)
    return new_figure_manager_given_figure(num, fig)
1145057
def construct_arg(cls, name, params):
        
        use_snippet = params.pop('use', None)
        if use_snippet:
            # if snippet is used, take this parameter from snippet and update
            # it with current params, if any
            try:
                problem = None
                snippet = yaml_snippet_loader.YamlSnippetLoader.get_snippet_by_name(use_snippet)
                # this works much like snippet.args.pop(arg_name).update(arg_params),
                # but unlike it, this actually returns the updated dict
                params = dict(snippet.args.pop(name), **params)
                # if there is SnippetNotFoundException, just let it be raised
            except KeyError:  # snippet doesn't have the requested argument
                problem = 'Couldn\'t find arg {arg} in snippet {snip}.'.\
                    format(arg=name, snip=snippet.name)
                raise exceptions.ExecutionException(problem)

        if 'flags' not in params:
            msg = 'Couldn\'t find "flags" in arg {arg}'.format(arg=name)
            raise exceptions.ExecutionException(msg)
        return cls(name, *params.pop('flags'), **params)
29522
def from_callable_parameter(cls, parameter):
        
        if parameter.kind == parameter.KEYWORD_ONLY or \
                parameter.kind == parameter.POSITIONAL_OR_KEYWORD and parameter.default is not parameter.empty:
            if parameter.annotation is not parameter.empty:
                constraint = parameter.annotation
            else:
                constraint = Parameter.constraint_from_type(parameter.default)
            return cls(
                name=parameter.name,
                value=parameter.default,
                constraint=constraint,
            )
        else:
            raise ParameterError('Only keyword parameters are supported')
250926
def add_params(self, **kw):
        
        for k, v in kw.items():
            if (k not in self.params) and (k not in self.specific_params):
                raise ParameterError('"%s" is not a valid parameter for %s'
                                     % (k, self.__class__.__name__))
            try:
                self.params[k].validate(v)
            except KeyError:
                self.specific_params[k].validate(v)

        self._orig_kwargs.update(kw)
        self.kwargs = self._orig_kwargs.copy()
658524
def from_parameter(cls: Type[XHXParameterType], parameter: str) -> Optional[XHXParameterType]:
        
        xhx = XHXParameter.re_xhx.match(parameter)
        if xhx:
            return cls(int(xhx.group(1)))

        return None