Spaces:
Configuration error
Configuration error
Download app/utils/validators.py from Pankaj10346/GUVI-hackathon-project: direct link, hf CLI and curl.
- Browser
- Download file 566 Bytes
-
https://huggingface.co/spaces/Pankaj10346/GUVI-hackathon-project/resolve/main/app/utils/validators.py
- Command line
-
hf download hf://spaces/Pankaj10346/GUVI-hackathon-project/app/utils/validators.py
-
curl -L -o validators.py https://huggingface.co/spaces/Pankaj10346/GUVI-hackathon-project/resolve/main/app/utils/validators.py
566 Bytes
| from __future__ import annotations | |
| import re | |
| def is_ms_timestamp(ts: int) -> bool: | |
| # Accept any positive-ish ms timestamp; avoid strict "current time" checks. | |
| return isinstance(ts, int) and ts > 0 | |
| def safe_sender(sender: str) -> str: | |
| s = sender.strip().lower() | |
| if s not in {"scammer", "user"}: | |
| raise ValueError("invalid sender") | |
| return s | |
| HOSTILE_RE = re.compile(r"\b(idiot|stupid|moron|abuse|wasting time|last warning|final warning)\b", re.I) | |
| def seems_hostile(text: str) -> bool: | |
| return bool(HOSTILE_RE.search(text or "")) | |