def main():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        val = reg_china_condition()
        result = db["user"].find(val)
        count = 0
        for item in result:
            count += 1
            add_chinese(db, item)
            if count % 500 == 0:
                print count


#TODO make it a lib
        old_res = db["research_result"].find_one({"type": "chinese_count"})
        if old_res:
            db["research_result"].update({"type": "chinese_count"},
                                         {"$set": {
                                             "total_count": count
                                         }})
        else:
            db["research_result"].insert({
                "type": "chinese_count",
                "total_count": count
            })
    else:
        print "Cannot connect to database"
def main ():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        calculate_months(db)
    else:
        print "Cannot connect to database"
def main_string ():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        calculate_months_string(db)
    else:
        print "Cannot connect to database"
def main():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if db:
        calculate_months(db)
    else:
        print "Cannot connect to database"
Exemple #5
0
def main ():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        report_lang(db)
    else:
        print "Cannot connect to database"
Exemple #6
0
def main():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        report_active(db, "active_count")
        report_active(db, "active_count_3_month")
    else:
        print "Cannot connect to database"
Exemple #7
0
def main():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        for num in range(0, 76000):
            report_forks(db, num)
    else:
        print "Cannot connect to database"
def main ():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        report_active(db, "active_count")
        report_active(db, "active_count_3_month")
    else:
        print "Cannot connect to database"
def main ():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        nums = [100, 200, 1000, 10, 50]
        for num in nums:
            fork_org(db, num)
        print "Cannot connect to database"
def main():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        nums = [100, 200, 1000, 10, 50]
        for num in nums:
            fork_org(db, num)
        print "Cannot connect to database"
def main ():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        for num in range(0, 76000):
            report_forks(db, num)
    else:
        print "Cannot connect to database"
Exemple #12
0
def main_int ():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
#        print_user_info(db, "initlove")
#        calculate_months_int(db)
         merge_month(db, 201412)
    else:
        print "Cannot connect to database"
def main ():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        fo = open("./lang.txt", "r")
        for line in fo.readlines():
            line = line.strip()
            if not len(line) or line.startswith('#'):
                continue
            else:
                generate_lang(db, line)
    else:
        print "Cannot connect to database"
Exemple #14
0
def main ():
    dm_db = DMDatabase()
    client = dm_db.getClient()
    db = dm_db.getDB()
    if (client):
        login = "******"
        init_beginer(client, login, 0)
        for level in range (1, 10):
            if get_followers(client, db, level) == 0:
                print "No more, exit"
                break
    else:
        print "Cannot connect to database"
Exemple #15
0
def main():
    dm_db = DMDatabase()
    client = dm_db.getClient()
    db = dm_db.getDB()
    if (client):
        login = "******"
        init_beginer(client, login, 0)
        for level in range(1, 10):
            if get_followers(client, db, level) == 0:
                print "No more, exit"
                break
    else:
        print "Cannot connect to database"
def main ():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        fo = open("./lang.txt", "r")
        for line in fo.readlines():
            line = line.strip()
            if not len(line) or line.startswith('#'):
                continue
            else:
                generate_lang(db, line)
    else:
        print "Cannot connect to database"
Exemple #17
0
def main():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        res = db["event"].find({"count": {"$gte": 299}})
        org_count = 0
        for item in res:
            user_item = db["user"].find_one({"id": item["id"]})
            if user_item:
                print user_item["login"]
                if user_item["type"] == "Organization":
                    org_count += 1
        print "Org is " + str(org_count)
    else:
        print "Cannot connect to database"
def main ():
    dm_db = DMDatabase()
    db = dm_db.getDB()

    if (db):
        val = active_user(db)
        count = db["chinese"].find(val).count()

#TODO make it a lib
        old_res = db["research_result"].find_one({"type": "chinese_active_count"})
        if old_res:
            db["research_result"].update({"type": "chinese_active_count"}, {"$set": {"total_count": count}})
        else:
            db["research_result"].insert({"type": "chinese_active_count", "total_count": count})
    else:
        print "Cannot connect to database"
def main ():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    if (db):
        val = reg_china_condition()
        result = db["user"].find(val)
        count = 0
        for item in result:
            count += 1
            add_chinese(db, item)
            if count%500 == 0:
                print count

#TODO make it a lib
        old_res = db["research_result"].find_one({"type": "chinese_count"})
        if old_res:
            db["research_result"].update({"type": "chinese_count"}, {"$set": {"total_count": count}})
        else:
            db["research_result"].insert({"type": "chinese_count", "total_count": count})
    else:
        print "Cannot connect to database"
Exemple #20
0
def main():
    dm_db = DMDatabase()
    db = dm_db.getDB()

    if (db):
        val = active_user(db)
        count = db["chinese"].find(val).count()

        #TODO make it a lib
        old_res = db["research_result"].find_one(
            {"type": "chinese_active_count"})
        if old_res:
            db["research_result"].update({"type": "chinese_active_count"},
                                         {"$set": {
                                             "total_count": count
                                         }})
        else:
            db["research_result"].insert({
                "type": "chinese_active_count",
                "total_count": count
            })
    else:
        print "Cannot connect to database"
Exemple #21
0
def test():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    login = "******"
    if (db):
        addOneUser(db, login)
Exemple #22
0
def test():
    dm_db = DMDatabase()
    db = dm_db.getDB()
    login = "******"
    if (db):
        addOneUser(db, login)