Skip to content

Commit

Permalink
i sort
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Oct 30, 2023
1 parent 704feb2 commit 0ee1226
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/gsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
LocationWithGSPYields,
OneDatetimeManyForecastValues,
)
from utils import format_datetime, limiter, N_CALLS_PER_HOUR
from utils import N_CALLS_PER_HOUR, format_datetime, limiter

GSP_TOTAL = 317

Expand Down
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from redoc_theme import get_redoc_html_with_theme
from status import router as status_router
from system import router as system_router
from utils import traces_sampler, limiter
from utils import limiter, traces_sampler

# flake8: noqa E501

Expand Down
2 changes: 1 addition & 1 deletion src/national.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
get_truth_values_for_a_specific_gsp_from_database,
)
from pydantic_models import NationalForecast, NationalForecastValue, NationalYield
from utils import filter_forecast_values, format_datetime, format_plevels, limiter, N_CALLS_PER_HOUR
from utils import N_CALLS_PER_HOUR, filter_forecast_values, format_datetime, format_plevels, limiter

logger = structlog.stdlib.get_logger()

Expand Down
2 changes: 1 addition & 1 deletion src/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from cache import cache_response
from database import get_latest_status_from_database, get_session, save_api_call_to_db
from utils import limiter, N_CALLS_PER_HOUR
from utils import N_CALLS_PER_HOUR, limiter

logger = structlog.stdlib.get_logger()

Expand Down
2 changes: 1 addition & 1 deletion src/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from auth_utils import get_auth_implicit_scheme, get_user
from cache import cache_response
from database import get_gsp_system, get_session
from utils import limiter, N_CALLS_PER_HOUR
from utils import N_CALLS_PER_HOUR, limiter

# flake8: noqa: E501
logger = structlog.stdlib.get_logger()
Expand Down
7 changes: 3 additions & 4 deletions src/utils.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
""" Utils functions for main.py """
import os
from slowapi import Limiter
from slowapi.util import get_remote_address

from datetime import datetime, timedelta
from typing import List, Optional, Union

import numpy as np
import structlog
from nowcasting_datamodel.models import Forecast
from pytz import timezone
from slowapi import Limiter
from slowapi.util import get_remote_address

from pydantic_models import NationalForecastValue

Expand All @@ -18,7 +17,7 @@
europe_london_tz = timezone("Europe/London")
utc = timezone("UTC")
limiter = Limiter(key_func=get_remote_address)
N_CALLS_PER_HOUR = 3600
N_CALLS_PER_HOUR = 5


def floor_30_minutes_dt(dt):
Expand Down

0 comments on commit 0ee1226

Please sign in to comment.