diff --git a/server/nightr/app.py b/server/nightr/app.py index f06fd6a..a141134 100644 --- a/server/nightr/app.py +++ b/server/nightr/app.py @@ -7,8 +7,8 @@ from typing import List import requests_cache from flask import Flask, jsonify -from server.nightr.strategies import dmi, steam, miloStrats -from server.nightr.util import Context +from .strategies import dmi, steam, miloStrats +from .util import Context app = Flask(__name__) diff --git a/server/nightr/strategies/cars_in_traffic.py b/server/nightr/strategies/cars_in_traffic.py index 00a740e..65cf324 100644 --- a/server/nightr/strategies/cars_in_traffic.py +++ b/server/nightr/strategies/cars_in_traffic.py @@ -1,6 +1,6 @@ import requests -from server.nightr.util import Prediction, Context +from ..util import Prediction, Context def scrape_traffic(context: Context) -> Prediction: diff --git a/server/nightr/strategies/dmi.py b/server/nightr/strategies/dmi.py index c2a983b..7b2f431 100644 --- a/server/nightr/strategies/dmi.py +++ b/server/nightr/strategies/dmi.py @@ -1,4 +1,4 @@ -from server.nightr.util import Context, Prediction +from ..util import Context, Prediction def probability(context: Context) -> Prediction: diff --git a/server/nightr/strategies/miloStrats.py b/server/nightr/strategies/miloStrats.py index c5b0633..a571d08 100644 --- a/server/nightr/strategies/miloStrats.py +++ b/server/nightr/strategies/miloStrats.py @@ -3,7 +3,7 @@ from datetime import datetime import cv2 from pytz import timezone -from server.nightr.util import Context, Prediction +from ..util import Context, Prediction def camImgStrat(context : Context) -> Prediction: @@ -22,6 +22,7 @@ def camImgStrat(context : Context) -> Prediction: p.probability = 0.0 return p + def australiaStrat(context : Context) -> Prediction: """ Time in Australia diff --git a/server/nightr/strategies/scrape.py b/server/nightr/strategies/scrape.py index 5b9898e..ccb441b 100644 --- a/server/nightr/strategies/scrape.py +++ b/server/nightr/strategies/scrape.py @@ -1,13 +1,7 @@ +import json + import requests from bs4 import BeautifulSoup -import pandas as pd -import urllib.request -from datetime import datetime, timedelta -import json -from server.nightr.strategies.strat_utils import determine_month - - - def tmp(): diff --git a/server/nightr/strategies/steam.py b/server/nightr/strategies/steam.py index afd5753..814ae4f 100644 --- a/server/nightr/strategies/steam.py +++ b/server/nightr/strategies/steam.py @@ -1,4 +1,4 @@ -from server.nightr.util import Context, Prediction +from ..util import Context, Prediction def probability(context: Context) -> Prediction: diff --git a/server/nightr/strategies/tide_strat.py b/server/nightr/strategies/tide_strat.py index d57c77e..9b16399 100644 --- a/server/nightr/strategies/tide_strat.py +++ b/server/nightr/strategies/tide_strat.py @@ -1,10 +1,11 @@ +import calendar import datetime import json -import calendar + import requests -from server.nightr.strategies.strat_utils import determine_month -from server.nightr.util import Context, Prediction +from .strat_utils import determine_month +from ..util import Context, Prediction def is_tide(context: Context) -> Prediction: diff --git a/server/nightr/util.py b/server/nightr/util.py index d2f37d8..db52a0a 100644 --- a/server/nightr/util.py +++ b/server/nightr/util.py @@ -4,8 +4,8 @@ from typing import List, Dict @dataclass class Context: - battery: float - position: Dict[str, float] # {'latitude': '23.2583', 'longitude': '154.0417'} + battery: float = 1.0 + position: Dict[str, float] = field(default_factory=lambda: {'latitude': 53.0, 'longitude': 9.0}) # App settings in_australia: bool = False