Spaces:
Running
Running
Download dengtaishan-src/tools/check.py from Ethscriptions/mx: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/Ethscriptions/mx/resolve/main/dengtaishan-src/tools/check.py
- Command line
-
hf download hf://spaces/Ethscriptions/mx/dengtaishan-src/tools/check.py
-
curl -L -o check.py https://huggingface.co/spaces/Ethscriptions/mx/resolve/main/dengtaishan-src/tools/check.py
1.22 kB
| # 版面自检:python3 check.py l|p [step] [from] [to] | |
| import sys, asyncio, json | |
| from playwright.async_api import async_playwright | |
| BASE = "http://localhost:5173/preview/production/1b822e06-b78d-4352-884d-1f8fddabf546/" | |
| async def main(): | |
| o = sys.argv[1]; step = sys.argv[2] if len(sys.argv) > 2 else '0.5' | |
| fr = sys.argv[3] if len(sys.argv) > 3 else '0'; to = sys.argv[4] if len(sys.argv) > 4 else '9999' | |
| async with async_playwright() as p: | |
| b = await p.chromium.launch() | |
| pg = await b.new_page() | |
| errs = [] | |
| pg.on("pageerror", lambda e: errs.append(str(e))) | |
| pg.on("console", lambda m: errs.append(m.text) if m.type == "error" else None) | |
| await pg.goto(f"{BASE}?still=check&o={o}&w=960&step={step}&from={fr}&to={to}") | |
| try: | |
| await pg.wait_for_function("document.title==='ready'", timeout=590000, polling=1000) | |
| except Exception as e: | |
| print("TIMEOUT", e) | |
| rep = await pg.evaluate("window.REPORT || {}") | |
| for k, v in sorted(rep.items(), key=lambda kv: kv[1]['first']): | |
| print(f"{v['first']:7.1f} x{v['n']:<4} {k}") | |
| for e in errs[:10]: print("ERR", e) | |
| await b.close() | |
| asyncio.run(main()) | |