<commit_before>from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.jobstores.mongodb import MongoDBJobStore
from client import TodoistClient
from todoist_app import send_tasks, send_FB_text
from todoist_app import MONGO_DB_JOBS_URL
from dateutil.parser import parse
from datetime import timedelta
from uuid import uuid4


scheduler = BackgroundScheduler(jobstores={
    'default': MongoDBJobStore(host=MONGO_DB_JOBS_URL)
})


def today_tasks(sender_id, tc):
    today_tasks = tc.get_today_tasks()
    if today_tasks:
        send_FB_text(
            sender_id,
            'Here are your tasks for today:'
        )
        send_tasks(
            sender_id,
            today_tasks
        )
    else:
        send_FB_text(
            sender_id,
            'You have no tasks today! Have a great day!'
        )


if __name__ == '__main__':
    for entry in handle.bot_users.find():
        tc = TodoistClient(entry['access_token'])
        job_id = uuid4().__str__()
        agenda_time = parse('6 AM') - timedelta(hours=tc.tz_info['hours'])
        job = scheduler.add_job(
            today_tasks,
            args=[entry['sender_id'], tc],
            trigger='cron',
            hour=agenda_time.hour,
            minute=agenda_time.minute,
            id=job_id
        )
    scheduler.start()
<commit_msg>remove clock settings, fix tasks in project<commit_after>from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.jobstores.mongodb import MongoDBJobStore
import os
from pymongo import MongoClient
from client import TodoistClient
from todoist_app import send_tasks, send_FB_text
from todoist_app import MONGO_DB_TOKENS_ENDPOINT, MONGO_DB_TOKENS_PORT
from todoist_app import MONGO_DB_TOKENS_DATABASE
from todoist_app import MONGO_DB_JOBS_URL
from dateutil.parser import parse
from datetime import timedelta, datetime
from uuid import uuid4


def connect():
    connection = MongoClient(
        MONGO_DB_TOKENS_ENDPOINT,
        MONGO_DB_TOKENS_PORT
    )
    handle = connection[MONGO_DB_TOKENS_DATABASE]
    handle.authenticate(
        os.environ['MONGO_DB_USERNAME'],
        os.environ['MONGO_DB_PWD']
    )
    return handle


scheduler = BackgroundScheduler(jobstores={
    'default': MongoDBJobStore(host=MONGO_DB_JOBS_URL)
})
handle = connect()


def today_tasks(sender_id, tc):
    today_tasks = tc.get_today_tasks()
    if today_tasks:
        send_FB_text(
            sender_id,
            'Here are your tasks for today:'
        )
        send_tasks(
            sender_id,
            today_tasks
        )
    else:
        send_FB_text(
            sender_id,
            'You have no tasks today! Have a great day!'
        )


if __name__ == '__main__':
    for entry in handle.bot_users.find():
        tc = TodoistClient(entry['access_token'])
        job_id = uuid4().__str__()
        agenda_time = parse('6 AM') - timedelta(hours=tc.tz_info['hours'])
        job = scheduler.add_job(
            today_tasks,
            args=[entry['sender_id'], tc],
            trigger='cron',
            hour=agenda_time.hour,
            minute=agenda_time.minute,
            id=job_id
        )
    scheduler.start()

{'fraction_non_alphanumeric': 0.0792264504054897, 'fraction_numerical': 0.0018714909544603868, 'mean_word_length': 2.694700460829493, 'pattern_counts': {'":': 0, '<': 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': '269233', 'n_tokens_mistral': 1030, 'n_tokens_neox': 1009, 'n_words': 221}