number of any default values for positional or keyword parameters
357930
def _ndefs(f):
    '''
        
    '''
    if isinstance(f, Function):
        return f.ndefs
    spec = inspect.getfullargspec(f)
    if spec.defaults is None:
        return 0
    return len(spec.defaults)
1318382
def print_all_param_defaults():
    """"""
    print("_______________________________________________________________________________")
    print("")
    print("                           Parameter Default Values")
    print("")
    classes = descendents(Parameterized)
    classes.sort(key=lambda x:x.__name__)
    for c in classes:
        c.print_param_defaults()
    print("_______________________________________________________________________________")
877225
function applyDefaultValuesForOptionsArguments( options, def ) {
    Object.keys( options ).forEach( function ( cmdName ) {
        const
            cmdOpts = options[ cmdName ],
            defOpts = def[ cmdName ].opts;
        if ( defOpts ) {
            Object.keys( defOpts ).forEach( function ( defOptName ) {
                if ( cmdOpts[ defOptName ] ) return;
                const defOptValue = defOpts[ defOptName ];
                if ( countArgs( defOptValue ) > 0 ) {
                    cmdOpts[ defOptName ] = defOptValue.args;
                }
            } );
        }
    } );
}
935584
def _VAR_DECL_value(self, cursor, _type):
        """"""
        # always expect list [(k,v)] as init value.from list(cursor.get_children())
        # get the init_value and special cases
        init_value = self._get_var_decl_init_value(cursor.type,
                                                   list(cursor.get_children()))
        _ctype = cursor.type.get_canonical()
        if self.is_unexposed_type(_ctype):
            # string are not exposed
            init_value = '%s # UNEXPOSED TYPE. PATCH NEEDED.' % (init_value)
        elif (self.is_pointer_type(_ctype) and
                      _ctype.get_pointee().kind == TypeKind.FUNCTIONPROTO):
            # Function pointers argument are handled at type creation time
            # but we need to put a CFUNCTYPE as a value of the name variable
            init_value = _type
        elif self.is_array_type(_ctype):
            # an integer litteral will be the size
            # an string litteral will be the value
            # any list member will be children of a init_list_expr
            # FIXME Move that code into typedesc
            def countof(k, l):
                return [item[0] for item in l].count(k)

            if (countof(CursorKind.INIT_LIST_EXPR, init_value) == 1):
                init_value = dict(init_value)[CursorKind.INIT_LIST_EXPR]
            elif (countof(CursorKind.STRING_LITERAL, init_value) == 1):
                # we have a initialised c_array
                init_value = dict(init_value)[CursorKind.STRING_LITERAL]
            else:
                # ignore size alone
                init_value = []
            # check the array size versus elements.
            if _type.size < len(init_value):
                _type.size = len(init_value)
        elif init_value == []:
            # catch case.
            init_value = None
        else:
            log.debug('VAR_DECL: default init_value: %s', init_value)
            if len(init_value) > 0:
                init_value = init_value[0][1]
        return init_value
782338
def _system_parameters(**kwargs):
    
    return {key: value for key, value in kwargs.items()
            if (value is not None or value == {})}
882693
def params(self):
        
        def fmt_param(el):
            if isinstance(el, str) or isinstance(el, unicode):
                return el
            else:
                return '(%s)' % (', '.join(map(fmt_param, el)))
        try:
            getspec = getattr(inspect, 'getfullargspec', inspect.getargspec)
            s = getspec(self.func)
        except TypeError:
            # I guess this is for C builtin functions?
            return ['...']

        params = []
        for i, param in enumerate(s.args):
            if param.lower() == 'self':
                continue
            if s.defaults is not None and len(s.args) - i <= len(s.defaults):
                defind = len(s.defaults) - (len(s.args) - i)
                default_value = s.defaults[defind]
                value = repr(default_value).strip()
                if value[0] == '<' and value[-1] == '>':
                    if type(default_value) == types.TypeType:
                        value = default_value.__name__
                    elif type(default_value) == types.ObjectType:
                        value = '%s()'%(default_value.__class__.__name__)
                params.append('%s=%s' % (param, value))
            else:
                params.append(fmt_param(param))
        if s.varargs is not None:
            params.append('*%s' % s.varargs)

        # TODO: This needs to be adjusted in Python 3. There's more stuff
        #       returned from getfullargspec than what we're looking at here.
        keywords = getattr(s, 'varkw', getattr(s, 'keywords', None))
        if keywords is not None:
            params.append('**%s' % keywords)
        return params
1101735
def defaults(values={}):
    """"""
    if values: return values
    save_types = basestring, int, float, tuple, list, dict, type(None)
    for k, v in globals().items():
        if isinstance(v, save_types) and not k.startswith("_"): values[k] = v
    return values
690491
def defaults(self_):
        
        self = self_.self
        d = {}
        for param_name,param in self.param.objects('existing').items():
            if param.constant:
                pass
            elif param.instantiate:
                self.param._instantiate_param(param,dict_=d,key=param_name)
            else:
                d[param_name]=param.default
        return d
230015
@Override
    public long numParams() {
        int ret = 0;
        for (INDArray val : params.values())
            ret += val.length();
        return ret;
    }
361140
def p_default_clause(self, p):
        """"""
        p[0] = self.asttypes.Default(elements=p[3])
        p[0].setpos(p)
20689
def _ctypes_code_parameter(lines, parameter, position):
    
    mdict = {
        'indices': _ctypes_indices,
        'variable': _ctypes_variables,
        'out': _ctypes_out,
        'regular': _ctypes_regular,
        'saved': _ctypes_saved,
        'assign': _ctypes_assign,
        'clean': _ctypes_clean
    }
    line = mdict[position](parameter)
    if line is not None:
        value, blank = line
        lines.append(value)
        if blank:
            lines.append("")
1078504
def print_param_defaults(self_):
        """"""
        cls = self_.cls
        for key,val in cls.__dict__.items():
            if isinstance(val,Parameter):
                print(cls.__name__+'.'+key+ '='+ repr(val.default))
382675
def number_of_values(self):
    """"""
    if not self._registry_key and self._registry:
      self._GetKeyFromRegistry()

    if self._registry_key:
      return self._registry_key.number_of_values

    return 0
1092510
def default(self, value):
        """"""

        if value is None:
            if self:
                value = list(self.keys())[0]

        elif not isinstance(value, string_types):
            value = register(exprresolver=value, reg=self)

        elif value not in self:
            raise KeyError(
                '{0} not registered in {1}'.format(value, self)
            )

        self._default = value
818647
def get_offset_with_default(cursor=None, default_offset=0):
    '''
    
    '''
    if not is_str(cursor):
        return default_offset

    offset = cursor_to_offset(cursor)
    try:
        return int(offset)
    except:
        return default_offset
1337807
def _init_params_default(self):
        
        # if there are some nan -> mean impute
        Yimp = self.Y.copy()
        Inan = sp.isnan(Yimp)
        Yimp[Inan] = Yimp[~Inan].mean()
        if self.P==1:   C = sp.array([[Yimp.var()]])
        else:           C = sp.cov(Yimp.T)
        C /= float(self.n_randEffs)
        for ti in range(self.n_randEffs):
            self.getTraitCovarFun(ti).setCovariance(C)
1020250
def update_without_overwrite(d, *args, **kwds):
    
    if args:
        assert len(args) == 1, \
            'At most one positional parameter is allowed: {0!r}'.format(args)

        (other,) = args
        if isinstance(other, Mapping):
            for key in other:
                setitem_without_overwrite(d, key, other[key])
        elif hasattr(other, "keys"):
            for key in other.keys():
                setitem_without_overwrite(d, key, other[key])
        else:
            for key, value in other:
                setitem_without_overwrite(d, key, value)

    for key, value in kwds.items():
        setitem_without_overwrite(d, key, value)