Spaces:
Runtime error
Runtime error
Create files.py
Browse files- bot/telegram/files.py +16 -0
bot/telegram/files.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PATH: bot/telegram/files.py
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def cleanup_file(path: str) -> None:
|
| 8 |
+
"""Best-effort remove a temp file."""
|
| 9 |
+
if not path:
|
| 10 |
+
return
|
| 11 |
+
try:
|
| 12 |
+
if os.path.exists(path):
|
| 13 |
+
os.remove(path)
|
| 14 |
+
except Exception:
|
| 15 |
+
# ignore cleanup failures
|
| 16 |
+
pass
|