Example #1
0
def join(values, encoding=None):  # {{{1
    """Joins a list into a config value."""
    if not encoding:
        encoding = ENCODING
    strbuf = StringIO()
    writer = csv.writer(strbuf, dialect=ConfigDialect)
    writer.writerow(encode(values, encoding))
    return decode(strbuf.getvalue().strip(), encoding)
Example #2
0
def join(values, encoding=None):  # {{{1
    """Joins a list into a config value."""
    if not encoding:
        encoding = ENCODING
    strbuf = StringIO()
    writer = csv.writer(strbuf, dialect=ConfigDialect)
    writer.writerow(encode(values, encoding))
    return decode(strbuf.getvalue().strip(), encoding)
Example #3
0
def tag_message(tag, message):
    message = white(encode(condense(message), encoding=ENCODING))
    return bold(' '.join([tag, message]))
Example #4
0
def split(value, encoding=None):  # {{{1
    """Splits config value into a list."""
    if not encoding:
        encoding = ENCODING
    reader = csv.reader([encode(value, encoding)], dialect=ConfigDialect)
    return [v.strip().decode(encoding) for v in tuple(reader)[0]]
Example #5
0
 def encode(self, value):
     return encode(value, self.encoding)
Example #6
0
def split(value, encoding=None):  # {{{1
    """Splits config value into a list."""
    if not encoding:
        encoding = ENCODING
    reader = csv.reader([encode(value, encoding)], dialect=ConfigDialect)
    return [v.strip().decode(encoding) for v in tuple(reader)[0]]
Example #7
0
 def encode(self, value):
     return encode(value, self.encoding)