Пример #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)
Пример #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)
Пример #3
0
def tag_message(tag, message):
    message = white(encode(condense(message), encoding=ENCODING))
    return bold(' '.join([tag, message]))
Пример #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]]
Пример #5
0
 def encode(self, value):
     return encode(value, self.encoding)
Пример #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]]
Пример #7
0
 def encode(self, value):
     return encode(value, self.encoding)