Wrapper for opj_set_default_decoder_parameters.
432460
def set_default_decoder_parameters(dparams_p):
    
    argtypes = [ctypes.POINTER(DecompressionParametersType)]
    OPENJPEG.opj_set_default_decoder_parameters.argtypes = argtypes
    OPENJPEG.opj_set_default_decoder_parameters(dparams_p)
1131286
def set( self, params ):
        """"""
        if self._parameters is not None:
            self.deconfigure()
        self.configure(params)
        return self
1328160
def get_kwargs_defaults(argspec):
    """"""
    arg_names = tuple(argspec.args)
    defaults = argspec.defaults or ()
    num_args = len(argspec.args) - len(defaults)
    kwargs_defaults = {}
    for i, default_value in enumerate(defaults):
        kwargs_defaults[arg_names[num_args + i]] = default_value
    if getattr(argspec, "kwonlydefaults", None):
        kwargs_defaults.update(argspec.kwonlydefaults)
    return kwargs_defaults
1351635
def custom_decode(encoding):
    """"""
    encoding = encoding.lower()
    alternates = {
        'big5': 'big5hkscs',
        'gb2312': 'gb18030',
        'ascii': 'utf-8',
        'MacCyrillic': 'cp1251',
    }
    if encoding in alternates:
        return alternates[encoding]
    else:
        return encoding
975650
def set_defaults(self):
        
        self['mswitch'] = 1
        self['elem'] = '../grid/elem.dat'
        self['elec'] = '../grid/elec.dat'
        self['volt'] = '../mod/volt.dat'
        self['inv_dir'] = '../inv'
        self['diff_inv'] = 'F ! difference inversion?'
        self['iseed_var'] = 'iseed variance'
        self['cells_x'] = '0    ! # cells in x-direction'
        self['cells_z'] = '-1    ! # cells in z-direction'
        self['ani_x'] = '1.000  ! smoothing parameter in x-direction'
        self['ani_z'] = '1.000  ! smoothing parameter in z-direction'
        self['max_it'] = '20    ! max. nr of iterations'
        self['dc_inv'] = 'F     ! DC inversion?'
        self['robust_inv'] = 'T     ! robust inversion?'
        self['fpi_inv'] = 'F     ! final phase improvement?'
        self['mag_rel'] = '5'
        self['mag_abs'] = '1e-3'
        self['pha_a1'] = 0
        self['pha_b'] = 0
        self['pha_rel'] = 0
        self['pha_abs'] = 0
        self['hom_bg'] = 'F'
        self['hom_mag'] = '10.00'
        self['hom_pha'] = '0.00'
        self['another_ds'] = 'F'
        self['d2_5'] = '1'
        self['fic_sink'] = 'F'
        self['fic_sink_node'] = '10000'
        self['boundaries'] = 'F'
        self['boundaries_file'] = 'boundary.dat'
        self['mswitch2'] = '1'
        self['lambda'] = 'lambda'
102971
def read_parameters(request, view_kwargs=None, capture_errors=False):  # noqa: C901
    
    if view_kwargs is None:
        view_kwargs = {}
    params = {}
    errors = {}
    for param in request.api_info.operation.parameters:
        try:
            value = param.get_value(request, view_kwargs)
            if value is NO_VALUE:
                if param.has_default:
                    params[param.name] = param.default
                elif param.required:  # Required but missing
                    errors[param.name] = MissingParameter('parameter %s is required but missing' % param.name)
                continue  # No value, or a default was added, or an error was added.
            params[param.name] = param.cast(request.api_info.api, value)
        except (NotImplementedError, ImproperlyConfigured):
            raise
        except Exception as e:
            if not capture_errors:
                raise
            errors[param.name] = e
    if errors:
        raise ErroneousParameters(errors, params)
    return params
152321
protected int decodeMandatoryParameters(ISUPParameterFactory parameterFactory, byte[] b, int index)
            throws ParameterException {
        int localIndex = index;
        index += super.decodeMandatoryParameters(parameterFactory, b, index);
        if (b.length - index > 1) {

            try {
                byte[] informationInd = new byte[2];
                informationInd[0] = b[index++];
                informationInd[1] = b[index++];
                InformationIndicators bci = parameterFactory.createInformationIndicators();
                ((AbstractISUPParameter) bci).decode(informationInd);
                this.setInformationIndicators(bci);
            } catch (Exception e) {
                // AIOOBE or IllegalArg
                throw new ParameterException("Failed to parse BackwardCallIndicators due to: ", e);
            }

            // return 3;
            return index - localIndex;
        } else {
            throw new IllegalArgumentException("byte[] must have atleast 2 octets");
        }
    }
1095082
def json_encoder_default(obj):
    
    if np is not None and hasattr(obj, 'size') and hasattr(obj, 'dtype'):
        if obj.size == 1:
            if np.issubdtype(obj.dtype, np.integer):
                return int(obj)
            elif np.issubdtype(obj.dtype, np.floating):
                return float(obj)

    if isinstance(obj, set):
        return list(obj)
    elif hasattr(obj, 'to_native'):
        # DatastoreList, DatastoreDict
        return obj.to_native()
    elif hasattr(obj, 'tolist') and hasattr(obj, '__iter__'):
        # for np.array
        return obj.tolist()

    return obj
969811
def json_encoder_default(obj):
    """"""
    if isinstance(obj, numbers.Integral) and (obj < min_safe_integer or obj > max_safe_integer):
        return str(obj)
    if isinstance(obj, np.integer):
        return str(obj)
    elif isinstance(obj, np.floating):
        return float(obj)
    elif isinstance(obj, np.ndarray):
        return list(obj)
    elif isinstance(obj, (set, frozenset)):
        return list(obj)
    raise TypeError
528107
private DecompilerSettings getDefaultSettings(File outputDir)
    {
        DecompilerSettings settings = new DecompilerSettings();
        procyonConf.setDecompilerSettings(settings);
        settings.setOutputDirectory(outputDir.getPath());
        settings.setShowSyntheticMembers(false);
        settings.setForceExplicitImports(true);

        if (settings.getTypeLoader() == null)
            settings.setTypeLoader(new ClasspathTypeLoader());
        return settings;
    }
926297
def params(self):
    """"""
    if hasattr(self, '_params_decoded'):
      return self._params_decoded

    if self.params_blob is not None:
      value_encoded = self.params_blob.open().read()
    else:
      value_encoded = self.params_text

    value = json.loads(value_encoded, cls=util.JsonDecoder)
    if isinstance(value, dict):
      kwargs = value.get('kwargs')
      if kwargs:
        adjusted_kwargs = {}
        for arg_key, arg_value in kwargs.iteritems():
          # Python only allows non-unicode strings as keyword arguments.
          adjusted_kwargs[str(arg_key)] = arg_value
        value['kwargs'] = adjusted_kwargs

    self._params_decoded = value
    return self._params_decoded
1100282
public function setDefaultJsonDecoder()
    {
        $args = func_get_args();
        $this->jsonDecoder = function ($response) use ($args) {
            array_unshift($args, $response);

            // Call json_decode() without the $options parameter in PHP
            // versions less than 5.4.0 as the $options parameter was added in
            // PHP version 5.4.0.
            if (version_compare(PHP_VERSION, '5.4.0', '<')) {
                $args = array_slice($args, 0, 3);
            }

            $json_obj = call_user_func_array('json_decode', $args);
            if (!($json_obj === null)) {
                $response = $json_obj;
            }
            return $response;
        };
    }
61767
protected function setDefaultParams()
    {
        foreach ($this->allowedParams as $param => $options) {
            $this->params[$param] = null;
            if (! empty($options['arguments'])) {
                $this->params[$param] = array();
                foreach ($options['arguments'] as $arg => $opts) {
                    if (! empty($opts['default'])) {
                        $cast = ! empty($opts['cast']) ? $opts['cast'] : 'string';
                        $this->params[$param][$arg] = $this->castValue($cast, $opts['default']);
                    }
                }
            } elseif (! empty($options['default'])) {
                $cast = ! empty($options['cast']) ? $options['cast'] : 'string';
                $this->params[$param] = $this->castValue($cast, $options['default']);
            }
        }
    }
246551
def set_ext_param(self, ext_key, param_key, val):
        '''
        
        '''
        if not self.extensions[ext_key]:
            self.extensions[ext_key] = defaultdict(lambda: None)
        self.extensions[ext_key][param_key] = val
1021359
def setdefaults(dct, defaults):
    """"""
    for key in defaults:
        dct.setdefault(key, defaults[key])

    return dct
965670
def defaultDecoder(self, message, server):
        
        mode = message.getArg(OPENID_NS, 'mode')
        fmt = "Unrecognized OpenID mode %r"
        raise ProtocolError(message, text=fmt % (mode,))
153882
def default(self, o):
        
        if isinstance(o, Q_):
            return o.magnitude
        elif isinstance(o, np.ndarray):
            return o.tolist()
        else:
            # raise TypeError if not serializable
            return super(SimKitJSONEncoder, self).default(o)