How to use the javaproperties.reading.unescape function in javaproperties

To help you get started, we’ve selected a few javaproperties examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jwodder / javaproperties / javaproperties / __main__.py View on Github external
def getselect(file, key, defaults, default_value, encoding, escaped):
    if escaped:
        key = list(map(unescape, key))
        if default_value is not None:
            default_value = unescape(default_value)
    with click.open_file(file, encoding=encoding) as fp:
        props = getproperties(fp, key)
    if defaults is not None:
        with click.open_file(defaults, encoding=encoding) as fp:
            defaults = getproperties(fp, key)
    else:
        defaults = {}
    for k in key:
        v = default_value
        if k in props:
            v = props[k]
        elif k in defaults:
            v = defaults[k]
        yield (k,v)
github jwodder / javaproperties / javaproperties / __main__.py View on Github external
def setprop(escaped, separator, outfile, preserve_timestamp, file, key, value,
            encoding):
    """ Set values in a Java .properties file """
    if escaped:
        key = unescape(key)
        value = unescape(value)
    with click.open_file(file, encoding=encoding) as fpin:
        with click.open_file(outfile, 'w', encoding=encoding) as fpout:
            setproperties(fpin, fpout, {key: value}, preserve_timestamp,
                          separator)
github jwodder / javaproperties / javaproperties / __main__.py View on Github external
def setprop(escaped, separator, outfile, preserve_timestamp, file, key, value,
            encoding):
    """ Set values in a Java .properties file """
    if escaped:
        key = unescape(key)
        value = unescape(value)
    with click.open_file(file, encoding=encoding) as fpin:
        with click.open_file(outfile, 'w', encoding=encoding) as fpout:
            setproperties(fpin, fpout, {key: value}, preserve_timestamp,
                          separator)