# Path: ricloud/compat.py
# PY3 = sys.version_info[0] >= 3
#     def want_bytes(data):
#     def want_text(data):
#     def to_str(data):
#     def want_bytes(data):
#     def want_text(data):
#     def to_str(data):
# 
# Path: ricloud/conf.py
# DEFAULT_CONF_NAME = "ricloud.ini"
# def get_config(config_name=DEFAULT_CONF_NAME):
# def get_user_root_config_path(config_name=DEFAULT_CONF_NAME):
# def get(setting_section, setting_name):
# def getint(setting_section, setting_name):
# def getboolean(setting_section, setting_name):


import os
import csv
import json
import time
import uuid
import base64
import decimal
import hashlib
import logging
import datetime
import ricloud
from collections import OrderedDict
from ricloud import compat
from ricloud import conf

def log_info(message, *args, **kwargs):
    logger.info(message, *args, **kwargs)


def generate_timestamp():
    return int(time.time())


def _encode(data):
    """Adapted from Django source:
    https://github.com/django/django/blob/master/django/core/serializers/json.py
    """
    if isinstance(data, datetime.datetime):
        r = data.isoformat()
        if data.microsecond:
            r = r[:23] + r[26:]
        if r.endswith("+00:00"):
            r = r[:-6] + "Z"
        return r
    elif isinstance(data, datetime.date):
        return data.isoformat()
    elif isinstance(data, datetime.time):
        r = data.isoformat()
        if data.microsecond:
            r = r[:12]
        return r
    elif isinstance(data, datetime.timedelta):
        return data.total_seconds()
    elif isinstance(data, (decimal.Decimal, uuid.UUID)):

# Path: ricloud/compat.py
# PY3 = sys.version_info[0] >= 3
#     def want_bytes(data):
#     def want_text(data):
#     def to_str(data):
#     def want_bytes(data):
#     def want_text(data):
#     def to_str(data):
# 
# Path: ricloud/conf.py
# DEFAULT_CONF_NAME = "ricloud.ini"
# def get_config(config_name=DEFAULT_CONF_NAME):
# def get_user_root_config_path(config_name=DEFAULT_CONF_NAME):
# def get(setting_section, setting_name):
# def getint(setting_section, setting_name):
# def getboolean(setting_section, setting_name):


# Path: ricloud/utils.py
import os
import csv
import json
import time
import uuid
import base64
import decimal
import hashlib
import logging
import datetime
import ricloud
from collections import OrderedDict
from ricloud import compat
from ricloud import conf


def log_info(message, *args, **kwargs):
    logger.info(message, *args, **kwargs)


def generate_timestamp():
    return int(time.time())


def _encode(data):
    """Adapted from Django source:
    https://github.com/django/django/blob/master/django/core/serializers/json.py
    """
    if isinstance(data, datetime.datetime):
        r = data.isoformat()
        if data.microsecond:
            r = r[:23] + r[26:]
        if r.endswith("+00:00"):
            r = r[:-6] + "Z"
        return r
    elif isinstance(data, datetime.date):
        return data.isoformat()
    elif isinstance(data, datetime.time):
        r = data.isoformat()
        if data.microsecond:
            r = r[:12]
        return r
    elif isinstance(data, datetime.timedelta):
        return data.total_seconds()
    elif isinstance(data, (decimal.Decimal, uuid.UUID)):

        return compat.to_str(data)