Converts a websocket agreed_parameters set to keyword arguments
        for our compressor objects.
434801
def _get_compressor_options(
        self,
        side: str,
        agreed_parameters: Dict[str, Any],
        compression_options: Dict[str, Any] = None,
    ) -> Dict[str, Any]:
        
        options = dict(
            persistent=(side + "_no_context_takeover") not in agreed_parameters
        )  # type: Dict[str, Any]
        wbits_header = agreed_parameters.get(side + "_max_window_bits", None)
        if wbits_header is None:
            options["max_wbits"] = zlib.MAX_WBITS
        else:
            options["max_wbits"] = int(wbits_header)
        options["compression_options"] = compression_options
        return options
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
270864
def encodeABI(cls, fn_name, args=None, kwargs=None, data=None):
        
        fn_abi, fn_selector, fn_arguments = get_function_info(
            fn_name, contract_abi=cls.abi, args=args, kwargs=kwargs,
        )

        if data is None:
            data = fn_selector

        return encode_abi(cls.web3, fn_abi, fn_arguments, data)
975891
def prepare_query_params(**kwargs):
    
    return [
        (sub_key, sub_value)
        for key, value in kwargs.items()
        for sub_key, sub_value in expand(value, key)
        if sub_value is not None
    ]
1213033
def encode_params(uri, params)
      params_str = String.new('?')
      params.each do |k, v|
        params_str << "#{k}=#{CGI.escape(v.to_s)}&" if v
      end
      params_str.chop!
      uri + params_str
    end
408588
private StringBuffer buildEncodedParameters(LinkedHashMap<String, String> params) {
		StringBuffer parametersUrlGet = new StringBuffer("");

		if (null != params) {
			for (String key : params.keySet()) {

				String value = params.get(key);
				String encodedParameter = encodeHttpParameter(value);

				// It builds something like
				// "&param1=file%20name%26blues for entry "param1","file name&blues"
				parametersUrlGet.append("&").append(key).append("=").append(encodedParameter);
			}
		}
		return parametersUrlGet;
	}
756159
def format_param(p):
    ""
    arg_prefix = arg_prefixes.get(p.kind, '') # asterisk prefix for *args and **kwargs
    res = f"**{arg_prefix}{code_esc(p.name)}**"
    if hasattr(p, 'annotation') and p.annotation != p.empty: res += f':{anno_repr(p.annotation)}'
    if p.default != p.empty:
        default = getattr(p.default, 'func', p.default)
        default = getattr(default, '__name__', default)
        res += f'=***`{repr(default)}`***'
    return res
102416
def set_default_decoder_parameters():
    
    ARGTYPES = [ctypes.POINTER(DecompressionParametersType)]
    OPENJP2.opj_set_default_decoder_parameters.argtypes = ARGTYPES
    OPENJP2.opj_set_default_decoder_parameters.restype = ctypes.c_void_p

    dparams = DecompressionParametersType()
    OPENJP2.opj_set_default_decoder_parameters(ctypes.byref(dparams))
    return dparams
313810
def saturate_kwargs(keys, **kwargs):
    
    # Validate if keys are in kwargs and if they are iterable
    if isinstance(keys, str): keys = [keys]
    keys = [k for k in keys if k in kwargs and hasattr(kwargs.get(k, None), '__iter__')]
    if len(keys) == 0: return []

    # Saturate coordinates of kwargs
    kw_corr = list(product(*(range(len(kwargs[k])) for k in keys)))

    # Append all possible values
    kw_arr = []
    for corr in kw_corr: kw_arr.append(
        dict(zip(keys, [kwargs[keys[i]][corr[i]] for i in range(len(keys))]))
    )

    # All combinations of kwargs of inputs
    for k in keys: kwargs.pop(k, None)
    kw_arr = [{**k, **kwargs} for k in kw_arr]

    return kw_arr
90475
def _encode_params(**kw):
    '''
    
    '''
    args = []
    for k, v in kw.iteritems():
        if isinstance(v, basestring):
            qv = v.encode('utf-8') if isinstance(v, unicode) else v
            args.append('%s=%s' % (k, urllib.quote(qv)))
        elif isinstance(v, collections.Iterable):
            for i in v:
                qv = i.encode('utf-8') if isinstance(i, unicode) else str(i)
                args.append('%s=%s' % (k, urllib.quote(qv)))
        else:
            qv = str(v)
            args.append('%s=%s' % (k, urllib.quote(qv)))
    return '&'.join(args)
237630
def process_kwargs(self, kwargs, prefix='default_', delete=True):
        
        processed = []
        for k in kwargs:
            if hasattr(self, prefix + k):
                processed += [k]
                setattr(self, prefix + k, kwargs[k])
        for k in processed:
            del(kwargs[k])
        return kwargs
286799
private void setNegotiatedExtensions(String extensionsHeader) {
        if ((extensionsHeader == null) || 
            (extensionsHeader.trim().length() == 0)) {
            _negotiatedExtensions = null;
            return;
        }
        
        String[]     extns = extensionsHeader.split(",");
        List<String> extnNames = new ArrayList<String>(); 
        
        for (String extn : extns) {
            String[]    properties = extn.split(";");
            String      extnName = properties[0].trim();

            if (!getEnabledExtensions().contains(extnName)) {
                String s = String.format("Extension '%s' is not an enabled " +
                        "extension so it should not have been negotiated", extnName);
                setException(new WebSocketException(s));
                return;
            }

            WebSocketExtension extension = 
                            WebSocketExtension.getWebSocketExtension(extnName);
            WsExtensionParameterValuesSpiImpl paramValues = 
                           _negotiatedParameters.get(extnName);
            Collection<Parameter<?>> anonymousParams = 
                           extension.getParameters(Metadata.ANONYMOUS);
            
            // Start from the second(0-based) property to parse the name-value
            // pairs as the first(or 0th) is the extension name.
            for (int i = 1; i < properties.length; i++) {
                String       property = properties[i].trim();
                String[]     pair = property.split("=");
                Parameter<?> parameter = null;
                String       paramValue = null;
                
                if (pair.length == 1) {
                    // We are dealing with an anonymous parameter. Since the
                    // Collection is actually an ArrayList, we are guaranteed to
                    // iterate the parameters in the definition/creation order.
                    // As there is no parameter name, we will just get the next
                    // anonymous Parameter instance and use it for setting the
                    // value. The onus is on the extension implementor to either
                    // use only named parameters or ensure that the anonymous
                    // parameters are defined in the order in which the server
                    // will send them back during negotiation.
                    parameter = anonymousParams.iterator().next();
                    paramValue = pair[0].trim();
                }
                else {
                    parameter = extension.getParameter(pair[0].trim());
                    paramValue = pair[1].trim();
                }
                
                if (parameter.type() != String.class) {
                    String paramName = parameter.name();
                    String s = String.format("Negotiated Extension '%s': " +
                                             "Type of parameter '%s' should be String", 
                                             extnName, paramName);
                    setException(new WebSocketException(s));
                    return;
                }

                if (paramValues == null) {
                    paramValues = new WsExtensionParameterValuesSpiImpl();
                    _negotiatedParameters.put(extnName, paramValues);
                }

                paramValues.setParameterValue(parameter, paramValue);

            }
            extnNames.add(extnName);
        }

        HashSet<String> extnsSet = new HashSet<String>(extnNames);
        _negotiatedExtensions = unmodifiableCollection(extnsSet);
    }
432670
def _sanatize_network_params(self, kwargs):
        '''
        
        '''
        params = [
            'label', 'bridge', 'bridge_interface', 'cidr', 'cidr_v6', 'dns1',
            'dns2', 'fixed_cidr', 'gateway', 'gateway_v6', 'multi_host',
            'priority', 'project_id', 'vlan_start', 'vpn_start'
        ]

        for variable in six.iterkeys(kwargs):  # iterate over a copy, we might delete some
            if variable not in params:
                del kwargs[variable]
        return kwargs
941674
def parse_options(**kwargs):
    """"""
    return {camelize(key): value
            for key, value in kwargs.items()
            if value is not None}
598616
def params_to_blr(self, trans_handle, params):
        ""
        ln = len(params) * 2
        blr = bs([5, 2, 4, 0, ln & 255, ln >> 8])
        if self.accept_version < PROTOCOL_VERSION13:
            values = bs([])
        else:
            # start with null indicator bitmap
            null_indicator = 0
            for i, p in enumerate(params):
                if p is None:
                    null_indicator |= (1 << i)
            n = len(params) // 8
            if len(params) % 8 != 0:
                n += 1
            if n % 4:   # padding
                n += 4 - n % 4
            null_indicator_bytes = []
            for i in range(n):
                null_indicator_bytes.append(null_indicator & 255)
                null_indicator >>= 8
            values = bs(null_indicator_bytes)
        for p in params:
            if (
                (PYTHON_MAJOR_VER == 2 and type(p) == unicode) or
                (PYTHON_MAJOR_VER == 3 and type(p) == str)
            ):
                p = self.str_to_bytes(p)
            t = type(p)
            if p is None:
                v = bs([])
                blr += bs([14, 0, 0])
            elif (
                (PYTHON_MAJOR_VER == 2 and t == str) or
                (PYTHON_MAJOR_VER == 3 and t == bytes)
            ):
                if len(p) > MAX_CHAR_LENGTH:
                    v = self._create_blob(trans_handle, p)
                    blr += bs([9, 0])
                else:
                    v = p
                    nbytes = len(v)
                    pad_length = ((4-nbytes) & 3)
                    v += bs([0]) * pad_length
                    blr += bs([14, nbytes & 255, nbytes >> 8])
            elif t == int:
                v = bint_to_bytes(p, 4)
                blr += bs([8, 0])    # blr_long
            elif t == float and p == float("inf"):
                v = b'\x7f\x80\x00\x00'
                blr += bs([10])
            elif t == decimal.Decimal or t == float:
                if t == float:
                    p = decimal.Decimal(str(p))
                (sign, digits, exponent) = p.as_tuple()
                v = 0
                ln = len(digits)
                for i in range(ln):
                    v += digits[i] * (10 ** (ln - i - 1))
                if sign:
                    v *= -1
                v = bint_to_bytes(v, 8)
                if exponent < 0:
                    exponent += 256
                blr += bs([16, exponent])
            elif t == datetime.date:
                v = convert_date(p)
                blr += bs([12])
            elif t == datetime.time:
                if p.tzinfo:
                    v = convert_time_tz(p)
                    blr += bs([28])
                else:
                    v = convert_time(p)
                    blr += bs([13])
            elif t == datetime.datetime:
                if p.tzinfo:
                    v = convert_timestamp_tz(p)
                    blr += bs([29])
                else:
                    v = convert_timestamp(p)
                    blr += bs([35])
            elif t == bool:
                v = bs([1, 0, 0, 0]) if p else bs([0, 0, 0, 0])
                blr += bs([23])
            else:   # fallback, convert to string
                p = p.__repr__()
                if PYTHON_MAJOR_VER == 3 or (PYTHON_MAJOR_VER == 2 and type(p) == unicode):
                    p = self.str_to_bytes(p)
                v = p
                nbytes = len(v)
                pad_length = ((4-nbytes) & 3)
                v += bs([0]) * pad_length
                blr += bs([14, nbytes & 255, nbytes >> 8])
            blr += bs([7, 0])
            values += v
            if self.accept_version < PROTOCOL_VERSION13:
                values += bs([0]) * 4 if not p is None else bs([0xff, 0xff, 0xff, 0xff])
        blr += bs([255, 76])    # [blr_end, blr_eoc]
        return blr, values
55594
def process_subprotocol(
        headers: Headers, available_subprotocols: Optional[Sequence[Subprotocol]]
    ) -> Optional[Subprotocol]:
        
        subprotocol: Optional[Subprotocol] = None

        header_values = headers.get_all("Sec-WebSocket-Protocol")

        if header_values:

            if available_subprotocols is None:
                raise InvalidHandshake("No subprotocols supported")

            parsed_header_values: Sequence[Subprotocol] = sum(
                [parse_subprotocol(header_value) for header_value in header_values], []
            )

            if len(parsed_header_values) > 1:
                subprotocols = ", ".join(parsed_header_values)
                raise InvalidHandshake(f"Multiple subprotocols: {subprotocols}")

            subprotocol = parsed_header_values[0]

            if subprotocol not in available_subprotocols:
                raise NegotiationError(f"Unsupported subprotocol: {subprotocol}")

        return subprotocol
746268
function convertParameters(parameters) {
  return parameters.map(parameter => {
    const { required, name } = parameter;
    return {
      name,
      disabled: required !== true,
      value: `${generateParameterExample(parameter)}`,
    };
  });
}