Download tasks/angi/environment/reference/clone/angi_app/services.py from TIGER-Lab/WebsiteBench: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/angi/environment/reference/clone/angi_app/services.py
- Command line
-
hf download hf://datasets/TIGER-Lab/WebsiteBench/tasks/angi/environment/reference/clone/angi_app/services.py
-
curl -L -o services.py https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/angi/environment/reference/clone/angi_app/services.py
1 kB
| """Process-wide generated backend and auth services for Angi.""" | |
| from __future__ import annotations | |
| import os | |
| import sys | |
| from pathlib import Path | |
| _CLONE_ROOT = Path(__file__).resolve().parents[1] | |
| if str(_CLONE_ROOT) not in sys.path: | |
| sys.path.insert(0, str(_CLONE_ROOT)) | |
| if not os.environ.get("WEBSITEBENCH_SITE_BACKEND_DATABASE"): | |
| data_dir = os.environ.get("WEBSITEBENCH_DATA_DIR") | |
| if data_dir: | |
| os.environ["WEBSITEBENCH_SITE_BACKEND_DATABASE"] = str( | |
| Path(data_dir) / "angi.sqlite3" | |
| ) | |
| from backend.site_backend_integration import open_site_services # noqa: E402 | |
| from . import db, seed # noqa: E402 | |
| class _Services: | |
| def __init__(self) -> None: | |
| self.backend, self.auth = open_site_services() | |
| self.cookie_name = self.backend.session_cookie["name"] | |
| with self.auth.connect() as connection: | |
| db.ensure_schema(connection) | |
| seed.seed_catalog(connection) | |
| connection.commit() | |
| SERVICES = _Services() | |