refactor: use datetime.UTC alias instead of timezone.utc

Python 3.11 introduced datetime.UTC as a cleaner alias for
datetime.timezone.utc. Both build.py and fetch_github_stars.py
are updated to use the shorter form.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Vinta Chen
2026-04-19 21:54:55 +08:00
parent e47d229528
commit a358d45ca4
2 changed files with 4 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
import json
import re
import shutil
from datetime import datetime, timezone
from datetime import UTC, datetime
from pathlib import Path
from typing import TypedDict
@@ -189,7 +189,7 @@ def build(repo_root: str) -> None:
total_entries=total_entries,
total_categories=len(categories),
repo_stars=repo_stars,
build_date=datetime.now(timezone.utc).strftime("%B %d, %Y"),
build_date=datetime.now(UTC).strftime("%B %d, %Y"),
sponsors=sponsors,
),
encoding="utf-8",

View File

@@ -5,7 +5,7 @@ import json
import os
import re
import sys
from datetime import datetime, timezone
from datetime import UTC, datetime
from pathlib import Path
import httpx
@@ -110,7 +110,7 @@ def main() -> None:
print(f"Found {len(current_repos)} GitHub repos in README.md")
cache = load_stars(CACHE_FILE)
now = datetime.now(timezone.utc)
now = datetime.now(UTC)
# Prune entries not in current README
pruned = {k: v for k, v in cache.items() if k in current_repos}