Convert the properties for encoding from the command line parameters.
344403
protected Map<String, String> convertToProperties(Map<String, String> argMap) {
        HashMap<String, String> props = new HashMap<String, String>();

        String value = argMap.get(ARG_KEY);
        if (value != null) {
            props.put(PasswordUtil.PROPERTY_CRYPTO_KEY, value);
        }
        if (argMap.containsKey(ARG_NO_TRIM)) {
            props.put(PasswordUtil.PROPERTY_NO_TRIM, "true");
        }
        value = argMap.get(ARG_HASH_SALT);
        if (value != null) {
            props.put(PasswordUtil.PROPERTY_HASH_SALT, value);
        }
        value = argMap.get(ARG_HASH_ITERATION);
        if (value != null) {
            props.put(PasswordUtil.PROPERTY_HASH_ITERATION, value);
        }
        value = argMap.get(ARG_HASH_ALGORITHM);
        if (value != null) {
            props.put(PasswordUtil.PROPERTY_HASH_ALGORITHM, value);
        }
        // following two values are for debug
        value = argMap.get(ARG_HASH_ENCODED);
        if (value != null) {
            props.put(PasswordUtil.PROPERTY_HASH_ENCODED, value);
        }
        return props;
    }
956349
def convertforoutput(self,outputfile):
        """"""
        super(CharEncodingConverter,self).convertforoutput(outputfile)

        return withheaders( flask.make_response( ( line.encode(self.charset) for line in outputfile ) ) , 'text/plain; charset=' + self.charset)
1150497
def _get_parameters(link, encoding):
    
    parameters = []
    properties = {}
    required = []

    for field in link.fields:
        parser = OpenApiFieldParser(link, field)
        if parser.location == 'form':
            if encoding in ('multipart/form-data', 'application/x-www-form-urlencoded'):
                # 'formData' in swagger MUST be one of these media types.
                parameters.append(parser.as_parameter())
            else:
                # Expand coreapi fields with location='form' into a single swagger
                # parameter, with a schema containing multiple properties.
                properties[field.name] = parser.as_schema_property()
                if field.required:
                    required.append(field.name)
        elif parser.location == 'body':
            parameters.append(parser.as_body_parameter(encoding))
        else:
            parameters.append(parser.as_parameter())

    if properties:
        parameter = {
            'name': 'data',
            'in': 'body',
            'schema': {
                'type': 'object',
                'properties': properties
            }
        }
        if required:
            parameter['schema']['required'] = required
        parameters.append(parameter)

    return parameters
700987
def encode(raw):
    """"""
    return raw \
        .replace(bytes([SLIP_ESC]), bytes([SLIP_ESC, SLIP_ESC_ESC])) \
        .replace(bytes([SLIP_END]), bytes([SLIP_ESC, SLIP_ESC_END]))
683873
def process_bind_param(self, value, dialect):
        """"""
        try:
            with BytesIO() as stream:
                with GzipFile(fileobj=stream, mode="wb") as file_handle:
                    file_handle.write(
                        jsonify(value, pretty=False).encode("utf-8")
                    )
                output = stream.getvalue()
            return output
        except TypeError as error:
            log_json_incompatible_types(value)
            raise_with_traceback(error)
193633
def _load_properties(self, raw_bytes):
        """"""
        r = AMQPReader(raw_bytes)

        #
        # Read 16-bit shorts until we get one with a low bit set to zero
        #
        flags = []
        while 1:
            flag_bits = r.read_short()
            flags.append(flag_bits)
            if flag_bits & 1 == 0:
                break

        shift = 0
        d = {}
        for key, proptype in self.PROPERTIES:
            if shift == 0:
                if not flags:
                    break
                flag_bits, flags = flags[0], flags[1:]
                shift = 15
            if flag_bits & (1 << shift):
                d[key] = getattr(r, 'read_' + proptype)()
            shift -= 1

        self.properties = d
1071133
private static String formatProperties(ArgumentUnit argumentUnit)
    {
		final StringBuilder sb = new StringBuilder("Properties:" + System.lineSeparator());

		final Properties properties = ArgumentUnitUtils.getProperties(argumentUnit);
		for (final Map.Entry<Object, Object> entry : properties.entrySet()) {
			if (entry.getValue() != null) {
				sb.append("   ");
				sb.append(entry.getKey());
				sb.append(": ");
				sb.append(entry.getValue());
				sb.append(System.lineSeparator());
			}
		}

		return sb.toString();
    }
681445
def _api_convert_output(return_value):
    
    content_type = web.ctx.environ.get('CONTENT_TYPE', 'text/json')

    if "text/json" in content_type:
        web.header('Content-Type', 'text/json; charset=utf-8')
        return json.dumps(return_value)
    if "text/html" in content_type:
        web.header('Content-Type', 'text/html; charset=utf-8')
        dump = yaml.dump(return_value)
        return "<pre>" + web.websafe(dump) + "</pre>"
    if "text/yaml" in content_type or \
                    "text/x-yaml" in content_type or \
                    "application/yaml" in content_type or \
                    "application/x-yaml" in content_type:
        web.header('Content-Type', 'text/yaml; charset=utf-8')
        dump = yaml.dump(return_value)
        return dump
    web.header('Content-Type', 'text/json; charset=utf-8')
    return json.dumps(return_value)
341967
function convertPatternProperties (data) {
  if (!data.patternProperties) {
    return data
  }
  data.properties = data.properties || {}
  const patternProperties = data.patternProperties
  delete data.patternProperties
  Object.keys(patternProperties).map(function (pattern) {
    data.properties['/' + pattern + '/'] = patternProperties[pattern]
  })
  if (data.additionalProperties) delete data.additionalProperties
  return data
}
1237483
def read_dict_from_properties(desired_type: Type[dict], file_object: TextIOBase,
                              logger: Logger, conversion_finder: ConversionFinder, **kwargs) -> Dict[str, Any]:
    

    # right now jprops relies on a byte stream. So we convert back our nicely decoded Text stream to a unicode
    # byte stream ! (urgh)
    class Unicoder:
        def __init__(self, file_object):
            self.f = file_object

        def __iter__(self):
            return self

        def __next__(self):
            line = self.f.__next__()
            return line.encode(encoding='utf-8')

    res = jprops.load_properties(Unicoder(file_object))

    # first automatic conversion of strings > numbers
    res = {key: try_parse_num_and_booleans(val) for key, val in res.items()}

    # further convert if required
    return ConversionFinder.convert_collection_values_according_to_pep(res, desired_type, conversion_finder, logger, 
                                                                       **kwargs)
1187658
def encode_params(self, data=None, **kwargs):
        
        if isinstance(data, basestring):
            raise ValueError("Data must not be a string.")
        if data is None:
            return b"", self.content_type

        fields = to_key_val_dict(data or "")
        try:
            body = json.dumps(fields)
        except:
            body = json.dumps(fields, encoding='latin-1')

        return str(body).encode(), self.content_type
957930
def _encode(cls, value):
        """"""

        value = json.dumps(value)
        return cls._ENC_RE.sub(lambda x: '%%%2x' % ord(x.group(0)), value)
1003401
def encode(cls, line):
        """"""
        if not line.encoded:
            encoding = getattr(line, 'encoding_param', None)
            if encoding and encoding.upper() == cls.base64string:
                line.value = b64encode(line.value).decode('utf-8')
            else:
                line.value = backslashEscape(str_(line.value))
            line.encoded = True
1241331
def _extract_parameters_from_properties(properties):
    """"""
    new_properties = {}
    parameters = []
    for key, value in six.iteritems(properties):
        if key.startswith(_PARAMETER_PREFIX):
            parameters.append((key.replace(_PARAMETER_PREFIX, ""), value))
        else:
            new_properties[key] = value

    return new_properties, sorted(parameters)
522677
def encode(value, encoding='utf-8', encoding_errors='strict'):
    
    if isinstance(value, bytes):
        return value
    if not isinstance(value, basestring):
        value = str(value)
    if isinstance(value, unicode):
        value = value.encode(encoding, encoding_errors)
    return value
695397
function paramsToString (params) {
  const paramKvs = keys(mapKeys(params, (v, k) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`))
  return join(paramKvs.sort(), '&')
}
44099
def convertascii(value, command='to'):
    
    command = command.lower()
    if command == 'to':
        return chr(value)
    elif command == 'from':
        return ord(value)
    else:
        raise ValueError('Invalid operation provided.')