<commit_before># coding=utf-8
import copy
import os
import math

import leancloud

from analyzer import DataObject
from config import token_config

__author__ = 'Jayvee'

leancloud.init(token_config.LEANCLOUD_APP_ID, token_config.LEANCLOUD_APP_KEY)


class LeancloudUtils():
    def __init__(self):
        # app_dict = AppDict.AppDict()# 提前定义
        pass

    app_dict = DataObject.AppDict()  # 提前定义

    @staticmethod
    def get_remote_data(tablename, max_num=None, label=None):
        """
        generally get remote data from leancloud
        :param tablename: name of the table to be queried
        :param max_num: max count of the result
        :return: list of result.
        """
        REMOTE_DB_APP_ID = '3plka1gwb9mlayuguyh792dqajtpsa05nu77om9v8twr86ly'
        REMOTE_DB_APP_KEY = '<KEY>'
        leancloud.init(REMOTE_DB_APP_ID, REMOTE_DB_APP_KEY)
        objclass = leancloud.Object.extend(tablename)
        query = leancloud.Query(objclass)
        # max_page_num = int(math.ceil(max_num / 1000.0))
        # result_list = []
        # if max_num > 1000:
        #     num_per_page = 1000
        # else:
        #     num_per_page = max_num
        # for i in range(max_page_num):
        #     # when there is more than 1000 items in query,use [skip] to reach all result
        #     if label is None:
        #         result = query.do_cloud_query('select * from %s limit ?,?' % tablename, i * 1000, num_per_page)
        #     else:
        #         result = query.do_cloud_query('select * from %s where label=? limit ?,?' % (tablename), label,<commit_msg>change remote database<commit_after># coding=utf-8
import copy
import os
import math

import leancloud

from analyzer import DataObject
from config import token_config

__author__ = 'Jayvee'

leancloud.init(token_config.LEANCLOUD_APP_ID, token_config.LEANCLOUD_APP_KEY)


class LeancloudUtils():
    def __init__(self):
        # app_dict = AppDict.AppDict()# 提前定义
        pass

    app_dict = DataObject.AppDict()  # 提前定义

    @staticmethod
    def get_remote_data(tablename, max_num=None, label=None):
        """
        generally get remote data from leancloud
        :param tablename: name of the table to be queried
        :param max_num: max count of the result
        :return: list of result.
        """
        # REMOTE_DB_APP_ID = '3plka1gwb9mlayuguyh792dqajtpsa05nu77om9v8twr86ly'
        # REMOTE_DB_APP_KEY = '<KEY>'
        # leancloud.init(REMOTE_DB_APP_ID, REMOTE_DB_APP_KEY)
        leancloud.init(token_config.LEANCLOUD_APP_ID, token_config.LEANCLOUD_APP_KEY)
        objclass = leancloud.Object.extend(tablename)
        query = leancloud.Query(objclass)
        # max_page_num = int(math.ceil(max_num / 1000.0))
        # result_list = []
        # if max_num > 1000:
        #     num_per_page = 1000
        # else:
        #     num_per_page = max_num
        # for i in range(max_page_num):
        #     # when there is more than 1000 items in query,use [skip] to reach all result
        #     if label is None:
        #         result = query.do_cloud_query('select * from %s limit ?,?' % tablename, i * 1000, num_per_page)
        #     else:
        #         result = query.do_cloud_query('select * from %s where label=? limit ?,?' % (tablename), label,
{'fraction_non_alphanumeric': 0.0900763358778626, 'fraction_numerical': 0.02198473282442748, 'mean_word_length': 2.619889502762431, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3095078', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1106, 'n_words': 257}