<commit_before>import sys
import os
import dateparser
import subprocess
from pytodo import duedate as dd
from pytodo import task as tt

if len(sys.argv) != 3:
    print("Invalid rescheduling arguments.")
    print("Usage: todo.sh res TASK_NUMBER NEW_DATE")
    exit()

task_no = sys.argv[1]
new_date_arg = sys.argv[2].lower()
task = tt.get_task(task_no)
task_date = dd.get_due_date(task)

if new_date_arg == "none":
    task = dd.remove_due_date(task)
else:
    new_date = dateparser.parse(sys.argv[2])
    if new_date == None:
        print("New date could not be parsed")
        exit()
    new_date = new_date.date()
    if task_date == new_date:
        print("The new date is the same as the old one")
        exit()

    task = dd.set_due_date(task, new_date)

tt.update_task(task_no, task)<commit_msg>replaced natural language date parsing library with a better one<commit_after>import sys
import os
import parsedatetime
from datetime import datetime
import subprocess
from pytodo import duedate as dd
from pytodo import task as tt

if len(sys.argv) != 3:
    print("Invalid rescheduling arguments.")
    print("Usage: todo.sh res TASK_NUMBER NEW_DATE")
    exit()

task_no = sys.argv[1]
new_date_arg = sys.argv[2].lower()
task = tt.get_task(task_no)
task_date = dd.get_due_date(task)

if new_date_arg == "none":
    task = dd.remove_due_date(task)
else:
    cal = parsedatetime.Calendar()
    time_struct, parse_status = cal.parse(sys.argv[2])
    if parse_status == 1:
        new_date = datetime(*time_struct[:6]).date()
        if task_date == new_date:
            print("The new date is the same as the old one")
        else:
            task = dd.set_due_date(task, new_date)
            tt.update_task(task_no, task)
    else:
        print("New date could not be parsed")
{'fraction_non_alphanumeric': 0.10458612975391499, 'fraction_numerical': 0.005592841163310962, 'mean_word_length': 3.4392059553349874, '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': '1278970', 'n_tokens_mistral': 616, 'n_tokens_neox': 600, 'n_words': 173}