<commit_before>from mastodon import Mastodon
import json
from login import login
from out_json import jsoner
import time

'''
return_typeはjson or list
defaultはlistで返す
'''
'''
現状はMastodon.pyを少し弄る必要があります

'''

def fav(return_type="list", switch=None):
    print(return_type + " is selected!")

    Mastodon = login(switch)
    my_cred = Mastodon.account_verify_credentials()
    id = my_cred['id']
    #lastestなmax_idを取得
    initial_max_id = Mastodon.fav(None,None,limit=1)
    initial_max_id = initial_max_id[-1]['max_id']
    fav = Mastodon.fav(initial_max_id, None, 40)
    print(initial_max_id)

    try_num = 0

    while True:

        #続きのtootを取得
        next_max_id = fav[-1]['max_id']
        last_fav = Mastodon.fav(next_max_id, None, 40)

        fav.extend(last_fav)
        try_num += 1
        last_length = len(last_fav)

        length = (len(fav) - try_num * 1)
        print(str(length))
        print(last_length)
        time.sleep(3)

        if last_length != 41:
            break

    if return_type == "json":
        filename = str(id) + "_fav"
        jsoner(fav,filename)

    else:
        return fav

    # id = int(input())
    # mining(id)

if __name__ == '__fav__':
    fav()
<commit_msg>time表示するようにしてみた<commit_after>from mastodon import Mastodon
import json
from login import login
from out_json import jsoner
import time

'''
return_typeはjson or list
defaultはlistで返す
'''
'''
現状はMastodon.pyを少し弄る必要があります

'''

def fav(return_type="list", switch=None):
    print(return_type + " is selected!")

    Mastodon = login(switch)
    my_cred = Mastodon.account_verify_credentials()
    id = my_cred['id']
    print("Your id is {0}".format(id))
    #lastestなmax_idを取得
    initial_max_id = Mastodon.fav(None,None,limit=1)
    initial_max_id = initial_max_id[-1]['max_id']
    fav = Mastodon.fav(initial_max_id, None, 40)
    print("Initial max id is {0}".format(initial_max_id))

    try_num = 0

    while True:

        #続きのtootを取得
        next_max_id = fav[-1]['max_id']
        last_fav = Mastodon.fav(next_max_id, None, 40)

        fav.extend(last_fav)
        try_num += 1
        last_length = len(last_fav)

        length = (len(fav) - try_num * 1)
        print(str(length))
        print(last_length)
        time.sleep(3)

        if last_length != 41:
            break

    if return_type == "json":
        filename = str(id) + "_fav"
        jsoner(fav,filename)

    else:
        return fav

    # id = int(input())
    # mining(id)

if __name__ == '__fav__':
    fav()

{'fraction_non_alphanumeric': 0.11867781760254878, 'fraction_numerical': 0.011150935882118677, 'mean_word_length': 2.7548579970104634, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '1008900', 'n_tokens_mistral': 1001, 'n_tokens_neox': 919, 'n_words': 182}