# 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 decode_json(data):
    return json.loads(data, object_pairs_hook=OrderedDict)


def encode_b64(data):
    return base64.b64encode(data)


def decode_b64(data):
    return base64.b64decode(data)


def transform_csv_file_to_json(file_object):
    """Transforms a one line CSV to a JSON dictionary."""
    csv_dictionary = list(csv.DictReader(file_object))[0]
    return dict(
        (key.lower().replace(" ", "_"), value) for key, value in csv_dictionary.items()
    )


def join_url(base, url, allow_fragments=True):
    return compat.urljoin(base, url, allow_fragments=allow_fragments)


def get_url_path(url):
    return compat.urlsplit(url).path


def escape(string):

# 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 decode_json(data):
    return json.loads(data, object_pairs_hook=OrderedDict)


def encode_b64(data):
    return base64.b64encode(data)


def decode_b64(data):
    return base64.b64decode(data)


def transform_csv_file_to_json(file_object):
    """Transforms a one line CSV to a JSON dictionary."""
    csv_dictionary = list(csv.DictReader(file_object))[0]
    return dict(
        (key.lower().replace(" ", "_"), value) for key, value in csv_dictionary.items()
    )


def join_url(base, url, allow_fragments=True):
    return compat.urljoin(base, url, allow_fragments=allow_fragments)


def get_url_path(url):
    return compat.urlsplit(url).path


def escape(string):

    return compat.quote(string, safe="")