Download tasks/amazon/environment/reference/clone/external_verification.py from TIGER-Lab/WebsiteBench: direct link, hf CLI and curl.
- Browser
- Download file 2.36 kB
-
https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/amazon/environment/reference/clone/external_verification.py
- Command line
-
hf download hf://datasets/TIGER-Lab/WebsiteBench/tasks/amazon/environment/reference/clone/external_verification.py
-
curl -L -o external_verification.py https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/amazon/environment/reference/clone/external_verification.py
2.36 kB
| """Amazon adapter for the canonical WebsiteBench verification library.""" | |
| from __future__ import annotations | |
| import os | |
| import sys | |
| from pathlib import Path | |
| for ancestor in Path(__file__).resolve().parents: | |
| repository_src = ancestor / "src" | |
| if (repository_src / "websitebench" / "public_clone_auth").is_dir(): | |
| if str(repository_src) not in sys.path: | |
| sys.path.insert(0, str(repository_src)) | |
| break | |
| from websitebench.public_clone_auth import ( # noqa: E402 | |
| ExternalRegistrationVerification, | |
| PublicCloneIdentity, | |
| RedisRestClient, | |
| ResendEmailClient, | |
| VerificationConfigurationError, | |
| VerificationIssue, | |
| VerificationLocked, | |
| VerificationRateLimited, | |
| VerificationUnavailable, | |
| ensure_sqlite_email_verified, | |
| load_public_clone_registration_verification, | |
| registration_frontend_script, | |
| ) | |
| _LEGACY_ALIASES = { | |
| "AMAZON_EXTERNAL_VERIFICATION_MODE": "PUBLIC_CLONE_AUTH_MODE", | |
| "AMAZON_REDIS_REST_URL": "PUBLIC_CLONE_AUTH_REDIS_REST_URL", | |
| "AMAZON_REDIS_REST_TOKEN": "PUBLIC_CLONE_AUTH_REDIS_REST_TOKEN", | |
| "AMAZON_RESEND_API_URL": "PUBLIC_CLONE_AUTH_RESEND_API_URL", | |
| "AMAZON_RESEND_API_KEY": "PUBLIC_CLONE_AUTH_RESEND_API_KEY", | |
| "AMAZON_RESEND_FROM_EMAIL": "PUBLIC_CLONE_AUTH_RESEND_FROM_EMAIL", | |
| } | |
| def load_external_registration_verification( | |
| source: dict[str, str] | None = None, | |
| ) -> ExternalRegistrationVerification | None: | |
| """Load Amazon's public profile through the shared implementation.""" | |
| original = os.environ if source is None else source | |
| values = dict(original) | |
| for legacy_name, common_name in _LEGACY_ALIASES.items(): | |
| if common_name not in values and legacy_name in values: | |
| values[common_name] = values[legacy_name] | |
| values.setdefault("PUBLIC_CLONE_AUTH_SITE_ID", "amazon") | |
| values.setdefault("PUBLIC_CLONE_AUTH_SITE_LABEL", "Amazon Clone") | |
| return load_public_clone_registration_verification(values) | |
| __all__ = [ | |
| "ExternalRegistrationVerification", | |
| "PublicCloneIdentity", | |
| "RedisRestClient", | |
| "ResendEmailClient", | |
| "VerificationConfigurationError", | |
| "VerificationIssue", | |
| "VerificationLocked", | |
| "VerificationRateLimited", | |
| "VerificationUnavailable", | |
| "ensure_sqlite_email_verified", | |
| "load_external_registration_verification", | |
| "registration_frontend_script", | |
| ] | |