HEX
Server: Apache
System: Linux beluga.o2switch.net 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP Thu May 7 23:17:13 UTC 2026 x86_64
User: sc3naki1272 (1113)
PHP: 8.3.33
Disabled: NONE
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/setoptconf/util.py
import csv
import io
import sys


__all__ = (
    'csv_to_list',
    'UnicodeMixin',
)


def csv_to_list(value):
    if isinstance(value, str) and value:
        reader = csv.reader(io.StringIO(value))
        parsed = next(reader)
        return parsed
    return []


# Adapted from http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/
# pylint: disable=R0903
class UnicodeMixin(object):
    if sys.version_info >= (3, 0):
        __str__ = lambda x: x.__unicode__()
    else:
        __str__ = lambda x: str(x).encode('utf-8')