Spaces:
Running
Running
Upload 云端_定时版本检测引擎.py
Browse files- 云端_定时版本检测引擎.py +3 -2
云端_定时版本检测引擎.py
CHANGED
|
@@ -3,6 +3,7 @@ import asyncio
|
|
| 3 |
import datetime
|
| 4 |
import httpx
|
| 5 |
import logging
|
|
|
|
| 6 |
import os
|
| 7 |
import tempfile
|
| 8 |
import zipfile
|
|
@@ -24,7 +25,7 @@ PRECACHE_BATCH_SIZE = 5
|
|
| 24 |
PRECACHE_INTERVAL = 10
|
| 25 |
|
| 26 |
|
| 27 |
-
def get_version_hash(versions_db: dict, item_id: str) -> str
|
| 28 |
"""兼容新旧格式获取 hash"""
|
| 29 |
val = versions_db.get(item_id)
|
| 30 |
if isinstance(val, str):
|
|
@@ -184,7 +185,7 @@ async def trigger_update_notifications(updated_items: list):
|
|
| 184 |
session.close()
|
| 185 |
|
| 186 |
|
| 187 |
-
async def precache_github_zip(repo_url: str, token: str
|
| 188 |
"""预下载 GitHub ZIP 并上传到 HF Dataset 缓存"""
|
| 189 |
try:
|
| 190 |
parts = repo_url.rstrip("/").split("/")
|
|
|
|
| 3 |
import datetime
|
| 4 |
import httpx
|
| 5 |
import logging
|
| 6 |
+
from typing import Optional
|
| 7 |
import os
|
| 8 |
import tempfile
|
| 9 |
import zipfile
|
|
|
|
| 25 |
PRECACHE_INTERVAL = 10
|
| 26 |
|
| 27 |
|
| 28 |
+
def get_version_hash(versions_db: dict, item_id: str) -> Optional[str]:
|
| 29 |
"""兼容新旧格式获取 hash"""
|
| 30 |
val = versions_db.get(item_id)
|
| 31 |
if isinstance(val, str):
|
|
|
|
| 185 |
session.close()
|
| 186 |
|
| 187 |
|
| 188 |
+
async def precache_github_zip(repo_url: str, token: Optional[str], item_id: str, version_hash: str):
|
| 189 |
"""预下载 GitHub ZIP 并上传到 HF Dataset 缓存"""
|
| 190 |
try:
|
| 191 |
parts = repo_url.rstrip("/").split("/")
|