INNER CODE UNIT · Python

last_commit_text_to_year

crocs-muni/javacard-curated-list · scripts/process_curated_list.py:246

def last_commit_text_to_year(text):
    if not text:
        return None
    t = text.strip().lower()

    if t in ("today", "yesterday"):
        return TODAY_YEAR

    weekdays = ("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday")
    if t == "last week" or any(t == f"last {d}" for d in weekdays):
        return TODAY_YEAR

    m = re.match(r"(\d+)\s+(day|days|week|weeks)\s+ago", t)
    if m:
        return TODAY_YEAR

    m = re.match(r"(\d+)\s+(month|months)\s+ago", t)
    if m:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…