Spaces:
Sleeping
Sleeping
Download src/teams/register.py from aurigin/Hackathon_Truth_Vs_Machine: direct link, hf CLI and curl.
- Browser
- Download file 619 Bytes
-
https://huggingface.co/spaces/aurigin/Hackathon_Truth_Vs_Machine/resolve/main/src/teams/register.py
- Command line
-
hf download hf://spaces/aurigin/Hackathon_Truth_Vs_Machine/src/teams/register.py
-
curl -L -o register.py https://huggingface.co/spaces/aurigin/Hackathon_Truth_Vs_Machine/resolve/main/src/teams/register.py
619 Bytes
| import secrets | |
| from src.teams.storage import register_team | |
| def create_team(team_name: str, num_teammates: int) -> tuple[str, dict]: | |
| if not team_name or not team_name.strip(): | |
| raise ValueError("Team name cannot be empty") | |
| if not isinstance(num_teammates, int) or num_teammates < 1: | |
| raise ValueError("Number of teammates must be a positive integer") | |
| token = secrets.token_urlsafe(32) | |
| try: | |
| team_data = register_team(team_name.strip(), num_teammates, token) | |
| return token, team_data | |
| except ValueError as e: | |
| raise ValueError(f"Team registration failed: {e}") | |