# Path: automlk/dataset.py
# def get_dataset_ids():
# def get_dataset_list(include_results=False):
# def get_dataset_status(dataset_id):
# def get_dataset(dataset_id, include_results=False):
# def make_dataset(d):
# def create_dataset_json(dataset_id):
# def create_dataset(name, folder_id, description, source, mode, filename_train, filename_test='', filename_cols='',
#                    filename_submit='', url=''):
# def update_dataset(dataset_id, name, folder_id, description, source, url):
# def update_feature_dataset(dataset_id, name, description, to_keep, col_type, text_ref):
# def update_problem_dataset(dataset_id, problem_type, y_col, metric, other_metrics, val_col, cv_folds, val_col_shuffle,
#                            scan, holdout_ratio, col_submit):
# def reset_dataset(dataset_id):
# def delete_dataset(dataset_id):
# def get_dataset_sample(dataset_id):
#     def __init__(self, dataset_id, name, folder_id, description, source, mode, filename_train,
#                  filename_test, filename_cols, filename_submit, url, creation_date):
#     def initialize_data(self):
#     def update_stats(self, df_train, df_test, df_submit):
#     def update_calc(self):
#     def update_problem(self, problem_type, y_col, metric, other_metrics, val_col, cv_folds, val_col_shuffle, scan,
#                        holdout_ratio, col_submit, best_is_min=True):
#     def update_y_data(self):
#     def save(self, dataset_id):
#     def load(self, load_data, features):
#     def load_calc(self, calc_data):
#     def finalize_creation(self, df_train, df_test, df_submit):
#     def get_data(self, part='train'):
#     def create_folders(self):
#     def __folder(self):
#     def __check_data(self, filename, part='train'):
#     def __read_data(self, filename):
#     def __initialize_features(self, df, df_cols):
#     def update_features(self, df):
#     def __import_data(self, filename, part):
#     def __init__(self, name, raw_type, n_missing, n_unique_values, first_unique_values, description, to_keep,
#                  col_type, text_ref='', n_unique_ratio=0.):
# def get_y_eval(dataset_id):
# class DataSet(object):
# class Feature(object):
# 
# Path: automlk/store.py
# def list_key_store(key):
#     """
#     returns the complete list of values
# 
#     :param key: key of the data
#     :return: list
#     """
#     if get_use_redis():
#         return [json.loads(x) for x in rds.lrange(key, 0, -1)]
#     else:
#         l = get_key_store(key)
#         if l != None:
#             return l
#         else:
#             return []
# 
# def set_key_store(key, value):
#     """
#     sets value to key in store
# 
#     :param key: key of the data
#     :param value: value of the data to store
#     """
#     if get_use_redis():
#         rds.set(str(key), json.dumps(value))
#     else:
#         with open(store_folder + '/' + __clean_key(key) + '.json', 'w') as f:
#             json.dump(value, f)


from automlk.dataset import get_dataset_list, create_dataset_sets
from automlk.store import list_key_store, set_key_store

"""
module specifically designed to update pp sampling results
"""

i = 0
for dt in get_dataset_list():
    if dt.status != 'created' and dt.problem_type == 'classification':
        print(dt.name)
        results = list_key_store('dataset:%s:rounds' % dt.dataset_id)

# Path: automlk/dataset.py
# def get_dataset_ids():
# def get_dataset_list(include_results=False):
# def get_dataset_status(dataset_id):
# def get_dataset(dataset_id, include_results=False):
# def make_dataset(d):
# def create_dataset_json(dataset_id):
# def create_dataset(name, folder_id, description, source, mode, filename_train, filename_test='', filename_cols='',
#                    filename_submit='', url=''):
# def update_dataset(dataset_id, name, folder_id, description, source, url):
# def update_feature_dataset(dataset_id, name, description, to_keep, col_type, text_ref):
# def update_problem_dataset(dataset_id, problem_type, y_col, metric, other_metrics, val_col, cv_folds, val_col_shuffle,
#                            scan, holdout_ratio, col_submit):
# def reset_dataset(dataset_id):
# def delete_dataset(dataset_id):
# def get_dataset_sample(dataset_id):
#     def __init__(self, dataset_id, name, folder_id, description, source, mode, filename_train,
#                  filename_test, filename_cols, filename_submit, url, creation_date):
#     def initialize_data(self):
#     def update_stats(self, df_train, df_test, df_submit):
#     def update_calc(self):
#     def update_problem(self, problem_type, y_col, metric, other_metrics, val_col, cv_folds, val_col_shuffle, scan,
#                        holdout_ratio, col_submit, best_is_min=True):
#     def update_y_data(self):
#     def save(self, dataset_id):
#     def load(self, load_data, features):
#     def load_calc(self, calc_data):
#     def finalize_creation(self, df_train, df_test, df_submit):
#     def get_data(self, part='train'):
#     def create_folders(self):
#     def __folder(self):
#     def __check_data(self, filename, part='train'):
#     def __read_data(self, filename):
#     def __initialize_features(self, df, df_cols):
#     def update_features(self, df):
#     def __import_data(self, filename, part):
#     def __init__(self, name, raw_type, n_missing, n_unique_values, first_unique_values, description, to_keep,
#                  col_type, text_ref='', n_unique_ratio=0.):
# def get_y_eval(dataset_id):
# class DataSet(object):
# class Feature(object):
# 
# Path: automlk/store.py
# def list_key_store(key):
#     """
#     returns the complete list of values
# 
#     :param key: key of the data
#     :return: list
#     """
#     if get_use_redis():
#         return [json.loads(x) for x in rds.lrange(key, 0, -1)]
#     else:
#         l = get_key_store(key)
#         if l != None:
#             return l
#         else:
#             return []
# 
# def set_key_store(key, value):
#     """
#     sets value to key in store
# 
#     :param key: key of the data
#     :param value: value of the data to store
#     """
#     if get_use_redis():
#         rds.set(str(key), json.dumps(value))
#     else:
#         with open(store_folder + '/' + __clean_key(key) + '.json', 'w') as f:
#             json.dump(value, f)


# Path: scripts/update_pp_sampling.py
from automlk.dataset import get_dataset_list, create_dataset_sets
from automlk.store import list_key_store, set_key_store


"""
module specifically designed to update pp sampling results
"""

i = 0
for dt in get_dataset_list():
    if dt.status != 'created' and dt.problem_type == 'classification':
        print(dt.name)
        results = list_key_store('dataset:%s:rounds' % dt.dataset_id)

        set_key_store('dataset:%s:rounds_backup' % dt.dataset_id, results)