Spaces:
Build error
Build error
Delete src/utils/validators.py with huggingface_hub
Browse files- src/utils/validators.py +0 -27
src/utils/validators.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
"""Input validation utilities"""
|
| 2 |
-
from pathlib import Path
|
| 3 |
-
from typing import Optional
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
class VideoValidator:
|
| 7 |
-
"""Validate video file inputs"""
|
| 8 |
-
|
| 9 |
-
ALLOWED_EXTENSIONS = {".mp4", ".avi", ".mov", ".mkv", ".webm"}
|
| 10 |
-
MAX_SIZE_BYTES = 100 * 1024 * 1024 # 100MB
|
| 11 |
-
|
| 12 |
-
@classmethod
|
| 13 |
-
def validate_filename(cls, filename: str) -> Optional[str]:
|
| 14 |
-
"""Validate filename and return extension"""
|
| 15 |
-
if not filename:
|
| 16 |
-
return None
|
| 17 |
-
|
| 18 |
-
ext = Path(filename).suffix.lower()
|
| 19 |
-
if ext not in cls.ALLOWED_EXTENSIONS:
|
| 20 |
-
return None
|
| 21 |
-
|
| 22 |
-
return ext
|
| 23 |
-
|
| 24 |
-
@classmethod
|
| 25 |
-
def validate_size(cls, size: int) -> bool:
|
| 26 |
-
"""Validate file size"""
|
| 27 |
-
return size <= cls.MAX_SIZE_BYTES
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|