anyconfig/backend/properties.py
def _parseline(line):
    """
    Parse a line of Java properties file.

    :param line:
        A string to parse, must not start with ' ', '#' or '!' (comment)
    :return: A tuple of (key, value), both key and value may be None

    >>> _parseline(" ")
    (None, '')
    >>> _parseline("aaa:")
    ('aaa', '')
    >>> _parseline(" aaa:")
    ('aaa', '')
    >>> _parseline("aaa")
    ('aaa', '')
    >>> _parseline("url = http://localhost")
    ('url', 'http://localhost')
    >>> _parseline("calendar.japanese.type: LocalGregorianCalendar")
    ('calendar.japanese.type', 'LocalGregorianCalendar')
    """
    pair = re.split(r"(?:\s+)?(?:(?<!\\)[=:])", line.strip(), 1)
    key = pair[0].rstrip()

    if len(pair) < 2:
        LOGGER.warning("Invalid line found: %s", line)
        return (key or None, '')

    return (key, pair[1].strip())

    Parse a line of Java properties file.

    :param line:
        A string to parse, must not start with ' ', '#' or '!' (comment)
    :return: A tuple of (key, value), both key and value may be None

    >>> _parseline(" ")
    (None, '')
    >>> _parseline("aaa:")
    ('aaa', '')
    >>> _parseline(" aaa:")
    ('aaa', '')
    >>> _parseline("aaa")
    ('aaa', '')
    >>> _parseline("url = http://localhost")
    ('url', 'http://localhost')
    >>> _parseline("calendar.japanese.type: LocalGregorianCalendar")
    ('calendar.japanese.type', 'LocalGregorianCalendar')
    
Parse a line of Java properties file.
Parse a line of Java properties file .
def _parseline(line):
    pair = re.split(r"(?:\s+)?(?:(?<!\\)[=:])", line.strip(), 1)
    key = pair[0].rstrip()
    if len(pair) < 2:
        LOGGER.warning("Invalid line found: %s", line)
        return (key or None, '')
    return (key, pair[1].strip())
def _parseline ( line ) : pair = re . split ( r"(?:\s+)?(?:(?<!\\)[=:])" , line . strip ( ) , 1 ) key = pair [ 0 ] . rstrip ( ) if len ( pair ) < 2 : LOGGER . warning ( "Invalid line found: %s" , line ) return ( key or None , '' ) return ( key , pair [ 1 ] . strip ( ) )
Parse a line of Java properties file.
Parse a line of Java properties file .
"""
    Parse a line of Java properties file.

    :param line:
        A string to parse, must not start with ' ', '#' or '!' (comment)
    :return: A tuple of (key, value), both key and value may be None

    >>> _parseline(" ")
    (None, '')
    >>> _parseline("aaa:")
    ('aaa', '')
    >>> _parseline(" aaa:")
    ('aaa', '')
    >>> _parseline("aaa")
    ('aaa', '')
    >>> _parseline("url = http://localhost")
    ('url', 'http://localhost')
    >>> _parseline("calendar.japanese.type: LocalGregorianCalendar")
    ('calendar.japanese.type', 'LocalGregorianCalendar')
    """
None
line
A string to parse, must not start with ' ', '#' or '!' (comment)
A string to parse must not start with ' ' ' # ' or ' ! ' ( comment )