mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-21 14:57:42 +00:00
Autogenerated type safety parameterisation of all methods
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import threading
|
||||
from datetime import timedelta
|
||||
from typing import Any
|
||||
|
||||
from requests import Response
|
||||
from requests_cache import CachedSession
|
||||
|
||||
from core.data_store import CACHE_DIR
|
||||
@@ -14,7 +18,7 @@ class URLDataCache(CachedSession):
|
||||
used across multiple threads, though note that URL lookups will block each other this way, so it is still better to
|
||||
create one of these objects per thread if possible."""
|
||||
|
||||
def __init__(self, name):
|
||||
def __init__(self, name: str) -> None:
|
||||
super().__init__(
|
||||
f"{CACHE_DIR}urls/{name}",
|
||||
expire_after=timedelta(days=1),
|
||||
@@ -22,6 +26,6 @@ class URLDataCache(CachedSession):
|
||||
)
|
||||
self._lock = threading.Lock()
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
def get(self, *args: Any, **kwargs: Any) -> Response:
|
||||
with self._lock:
|
||||
return super().get(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user