mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-21 06:47:42 +00:00
Autogenerated type safety parameterisation of all methods
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
import pytz
|
||||
|
||||
@@ -11,12 +14,12 @@ logger = logging.getLogger(__name__)
|
||||
class LocalFileStaticDataProvider(StaticDataProvider):
|
||||
"""Generic static reference data provider class for providers that fetch their data from a local file on startup."""
|
||||
|
||||
def __init__(self, name, provider_config, path):
|
||||
def __init__(self, name: str, provider_config: dict[str, Any], path: str) -> None:
|
||||
super().__init__(name, provider_config)
|
||||
self._path = path
|
||||
self._stop = False
|
||||
|
||||
def start(self):
|
||||
def start(self) -> None:
|
||||
logger.debug(f"Loading {self.name} static reference data from file.")
|
||||
try:
|
||||
ok = self._load_data(self._path)
|
||||
@@ -31,10 +34,10 @@ class LocalFileStaticDataProvider(StaticDataProvider):
|
||||
self.status = "Error"
|
||||
logger.exception(f"Exception in local file Static Data Provider ({self.name})")
|
||||
|
||||
def stop(self):
|
||||
def stop(self) -> None:
|
||||
self._stop = True
|
||||
|
||||
def _load_data(self, path):
|
||||
def _load_data(self, path: str) -> bool:
|
||||
"""Load data from the given file path. Return true if successful, false otherwise."""
|
||||
|
||||
raise NotImplementedError("Subclasses must implement this method")
|
||||
|
||||
Reference in New Issue
Block a user