# Path: clustertools/config.py
# def get_ct_folder():
#     folder = os.environ.get(__CT_FOLDER_ENVVAR__)
#     if folder is None:
#         folder = os.path.join(os.path.expanduser("~"), __CT_FOLDER__)
#     return folder


import os
import sys
import glob
import collections
import shutil
import logging
    import cPickle as pickle
    import pickle
from abc import ABCMeta, abstractmethod
from datetime import datetime
from .config import get_ct_folder
        from .state import State
    # whose key-value mapping represent information regarding the results
    # (namely, the experience name, the parameters of the computation, the
    # context and the actual results)
    def save_result(self, comp_name, parameters, result, context="n/a"):
        # Create the R-dict (legacy format)
        r_dict = {
            comp_name: {
                __EXP_NAME__: self.exp_name,
                __PARAMETERS__: parameters,
                __CONTEXT__: context,
                __RESULTS__: dict(result)
            }
        }
        self._save_r_dict(comp_name, r_dict)

    @abstractmethod
    def _save_r_dict(self, comp_name, r_dict):
        """Save the given r_dict singleton corresponding to the given
        computation"""
        pass

    def load_result(self, comp_name):
        res = self._load_r_dict(comp_name)
        try:
            if len(res) == 0:
                return {}
        except:
            return {}
        return res[comp_name][__RESULTS__]


# Path: clustertools/config.py
# def get_ct_folder():
#     folder = os.environ.get(__CT_FOLDER_ENVVAR__)
#     if folder is None:
#         folder = os.path.join(os.path.expanduser("~"), __CT_FOLDER__)
#     return folder


# Path: clustertools/storage.py
import os
import sys
import glob
import collections
import shutil
import logging
    import cPickle as pickle
    import pickle
from abc import ABCMeta, abstractmethod
from datetime import datetime
from .config import get_ct_folder
        from .state import State

    # whose key-value mapping represent information regarding the results
    # (namely, the experience name, the parameters of the computation, the
    # context and the actual results)
    def save_result(self, comp_name, parameters, result, context="n/a"):
        # Create the R-dict (legacy format)
        r_dict = {
            comp_name: {
                __EXP_NAME__: self.exp_name,
                __PARAMETERS__: parameters,
                __CONTEXT__: context,
                __RESULTS__: dict(result)
            }
        }
        self._save_r_dict(comp_name, r_dict)

    @abstractmethod
    def _save_r_dict(self, comp_name, r_dict):
        """Save the given r_dict singleton corresponding to the given
        computation"""
        pass

    def load_result(self, comp_name):
        res = self._load_r_dict(comp_name)
        try:
            if len(res) == 0:
                return {}
        except:
            return {}
        return res[comp_name][__RESULTS__]


    @abstractmethod