forked from username/flaskpaste
fix: add comprehensive type annotations for mypy
- database.py: add type hints for Path, Flask, Any, BaseException - pki.py: add assertions to narrow Optional types after has_ca() checks - routes.py: annotate config values to avoid Any return types - api/__init__.py: use float for cleanup timestamps (time.time()) - __init__.py: remove unused return from setup_rate_limiting
This commit is contained in:
@@ -9,10 +9,10 @@ bp = Blueprint("api", __name__)
|
||||
|
||||
# Thread-safe cleanup scheduling
|
||||
_cleanup_lock = threading.Lock()
|
||||
_cleanup_times = {
|
||||
"pastes": 0,
|
||||
"hashes": 0,
|
||||
"rate_limits": 0,
|
||||
_cleanup_times: dict[str, float] = {
|
||||
"pastes": 0.0,
|
||||
"hashes": 0.0,
|
||||
"rate_limits": 0.0,
|
||||
}
|
||||
_CLEANUP_INTERVALS = {
|
||||
"pastes": 3600, # 1 hour
|
||||
@@ -25,7 +25,7 @@ def reset_cleanup_times() -> None:
|
||||
"""Reset cleanup timestamps. For testing only."""
|
||||
with _cleanup_lock:
|
||||
for key in _cleanup_times:
|
||||
_cleanup_times[key] = 0
|
||||
_cleanup_times[key] = 0.0
|
||||
|
||||
|
||||
@bp.before_request
|
||||
|
||||
Reference in New Issue
Block a user