Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5411ebc415
|
@ -1,18 +1,17 @@
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
|
||||||
import statistics
|
import statistics
|
||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import requests_cache
|
import requests_cache
|
||||||
from flask import Flask, jsonify
|
from flask import Flask, jsonify, logging
|
||||||
|
|
||||||
from .strategies import miloStrats, iss, cars_in_traffic, tide_strat, upstairs_neighbour
|
from .strategies import miloStrats, iss, cars_in_traffic, tide_strat, upstairs_neighbour
|
||||||
from .util import Context
|
from .util import Context
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
logger = logging.create_logger(app)
|
||||||
|
|
||||||
requests_cache.install_cache("requests_cache", expire_after=timedelta(minutes=10))
|
requests_cache.install_cache("requests_cache", expire_after=timedelta(minutes=10))
|
||||||
|
|
||||||
|
@ -39,9 +38,10 @@ def probabilities():
|
||||||
try:
|
try:
|
||||||
prediction = strategy(context)
|
prediction = strategy(context)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Strategy %s failed: %s", name, e)
|
logger.warning("Strategy '%s' failed:", name)
|
||||||
logger.exception(e)
|
logger.exception(e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
predictions.append({
|
predictions.append({
|
||||||
"name": name,
|
"name": name,
|
||||||
"description": inspect.getdoc(strategy),
|
"description": inspect.getdoc(strategy),
|
||||||
|
|
|
@ -9,7 +9,6 @@ from timezonefinder import TimezoneFinder
|
||||||
|
|
||||||
from ..util import Context, Prediction
|
from ..util import Context, Prediction
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
tf = TimezoneFinder(in_memory=True)
|
tf = TimezoneFinder(in_memory=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue