# Path: automlk/config.py
# def get_use_redis():
#     """
#     get global value USE_REDIS
#     :return: value USE_REDIS
#     """
#     return USE_REDIS
# 
# def set_use_redis(value):
#     """
#     set global value USE_REDIS
# 
#     :param value:
#     :return:
#     """
#     global USE_REDIS
#     USE_REDIS = value
# 
# Path: automlk/context.py
# def get_config():
#     """
# 
#     retrieves configuration parameters
#     :return: config dict
#     """
#     if os.path.exists('../config.json'):
#         with open('../config.json', 'r') as f:
#             config = eval("".join(f.readlines()))
#             # upward compatibility
#             if 'bootstrap' not in config.keys():
#                 config['bootstrap'] = ''
#             if 'graph_theme' not in config.keys():
#                 config['graph_theme'] = 'dark'
#             if 'doc_theme' not in config.keys():
#                 config['doc_theme'] = 'default'
#             return config
#     raise EnvironmentError('configuration file %s not found' % '../config.json')
# 
# def get_data_folder():
#     """
#     retrieves root folder from 'automlk.json' configuration file
#     :return: storage folder name of the data
#     """
#     return get_config()['data']


import os
import json
import time
import logging
        import redis
from .config import get_use_redis, set_use_redis
from .context import get_config, get_data_folder

log = logging.getLogger(__name__)

# try to import redis
__config = get_config()
if __config['store'] == 'redis':
    try:
        rds = redis.Redis(host=__config['store_url'])
        print('using redis')

# Path: automlk/config.py
# def get_use_redis():
#     """
#     get global value USE_REDIS
#     :return: value USE_REDIS
#     """
#     return USE_REDIS
# 
# def set_use_redis(value):
#     """
#     set global value USE_REDIS
# 
#     :param value:
#     :return:
#     """
#     global USE_REDIS
#     USE_REDIS = value
# 
# Path: automlk/context.py
# def get_config():
#     """
# 
#     retrieves configuration parameters
#     :return: config dict
#     """
#     if os.path.exists('../config.json'):
#         with open('../config.json', 'r') as f:
#             config = eval("".join(f.readlines()))
#             # upward compatibility
#             if 'bootstrap' not in config.keys():
#                 config['bootstrap'] = ''
#             if 'graph_theme' not in config.keys():
#                 config['graph_theme'] = 'dark'
#             if 'doc_theme' not in config.keys():
#                 config['doc_theme'] = 'default'
#             return config
#     raise EnvironmentError('configuration file %s not found' % '../config.json')
# 
# def get_data_folder():
#     """
#     retrieves root folder from 'automlk.json' configuration file
#     :return: storage folder name of the data
#     """
#     return get_config()['data']


# Path: automlk/store.py
import os
import json
import time
import logging
        import redis
from .config import get_use_redis, set_use_redis
from .context import get_config, get_data_folder


log = logging.getLogger(__name__)

# try to import redis
__config = get_config()
if __config['store'] == 'redis':
    try:
        rds = redis.Redis(host=__config['store_url'])
        print('using redis')

        set_use_redis(True)