Source code for core.utils.serialize
# core/utils.py
#
#
""" utils package. """
__copyright__ = "Copyright 2015, B.H.J Thate"
## IMPORT
from core.utils.name import name
## DEFINES
basic_types= [ str, int, float, bool, None]
## SERIALIZE
[docs]def pretty(a):
if type(a) not in basic_types: return name(a)
else: return bytes("%s\n" % a, "utf-8")
[docs]def smooth(a):
if type(a) not in basic_types: return str(type(a))
else: return a
[docs]def full(a):
if type(a) not in basic_types: return str(a)
else: return a
[docs]def verzin(a):
if type(a) is float and not a.is_integer(): return short_date(time.ctime(a))
if type(a) not in basic_types: return str(type(a))
else: return a