Skip to content

Commit

Permalink
Lock file maintenance poetry all non-major dependencies (#3028)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Conor Brady <[email protected]>
  • Loading branch information
renovate[bot] and conbrad authored Jul 26, 2023
1 parent 304314a commit 08a0907
Show file tree
Hide file tree
Showing 60 changed files with 13,480 additions and 3,726 deletions.
2 changes: 1 addition & 1 deletion api/app/auto_spatial_advisory/sfms.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_sfms_file_message(filename: str, meta_data: dict) -> SFMSFile:
run_type=run_type,
last_modified=meta_data.get('last_modified'),
create_time=meta_data.get('create_time'),
run_date=issue_date,
run_date=issue_date.date(),
for_date=date(year=int(for_date[0:4]),
month=int(for_date[4:6]),
day=int(for_date[6:8])))
4 changes: 2 additions & 2 deletions api/app/routers/sfms.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ def add_msg_to_queue(file: UploadFile, key: str, forecast_or_actual: str, meta_d
for_date = get_date_part(file.filename)
message = SFMSFile(key=key,
run_type=forecast_or_actual,
last_modified=meta_data.get('last_modified'),
create_time=meta_data.get('create_time'),
last_modified=datetime.fromisoformat(meta_data.get('last_modified')),
create_time=datetime.fromisoformat(meta_data.get('create_time')),
run_date=issue_date,
for_date=date(year=int(for_date[0:4]),
month=int(for_date[4:6]),
Expand Down
2 changes: 1 addition & 1 deletion api/app/schemas/fba.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class FireCenterStation(BaseModel):
""" A fire weather station has a code, name and geographical coordinate. """
code: int
name: str
zone: Optional[str]
zone: Optional[str] = None


class FireCentre(BaseModel):
Expand Down
60 changes: 30 additions & 30 deletions api/app/schemas/fba_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

class StationRequest(BaseModel):
""" Request for one individual weather station. """
id: Optional[int]
id: Optional[int] = None
station_code: int
fuel_type: FuelTypeEnum
percentage_conifer: Optional[float]
percentage_dead_balsam_fir: Optional[float]
grass_cure: Optional[float]
crown_base_height: Optional[float]
crown_fuel_load: Optional[float]
wind_speed: Optional[float]
percentage_conifer: Optional[float] = None
percentage_dead_balsam_fir: Optional[float] = None
grass_cure: Optional[float] = None
crown_base_height: Optional[float] = None
crown_fuel_load: Optional[float] = None
wind_speed: Optional[float] = None


class StationListRequest(BaseModel):
Expand All @@ -37,34 +37,34 @@ class StationResponse(BaseModel):
NOTE: Most of the values are optional, since if an observation/forecast isn't available,
there's not much we can do.
"""
id: Optional[int]
id: Optional[int] = None
station_code: int
station_name: str
zone_code: Optional[str]
zone_code: Optional[str] = None
elevation: int
fuel_type: FuelTypeEnum
status: str
temp: Optional[float]
rh: Optional[float]
wind_direction: Optional[int]
wind_speed: Optional[float]
precipitation: Optional[float]
grass_cure: Optional[float]
fine_fuel_moisture_code: Optional[float]
drought_code: Optional[float]
initial_spread_index: Optional[float]
build_up_index: Optional[float]
duff_moisture_code: Optional[float]
fire_weather_index: Optional[float]
head_fire_intensity: Optional[float]
rate_of_spread: Optional[float]
fire_type: Optional[str]
percentage_crown_fraction_burned: Optional[float]
flame_length: Optional[float]
sixty_minute_fire_size: Optional[float]
thirty_minute_fire_size: Optional[float]
critical_hours_hfi_4000: Optional[CriticalHoursHFI]
critical_hours_hfi_10000: Optional[CriticalHoursHFI]
temp: Optional[float] = None
rh: Optional[float] = None
wind_direction: Optional[int] = None
wind_speed: Optional[float] = None
precipitation: Optional[float] = None
grass_cure: Optional[float] = None
fine_fuel_moisture_code: Optional[float] = None
drought_code: Optional[float] = None
initial_spread_index: Optional[float] = None
build_up_index: Optional[float] = None
duff_moisture_code: Optional[float] = None
fire_weather_index: Optional[float] = None
head_fire_intensity: Optional[float] = None
rate_of_spread: Optional[float] = None
fire_type: Optional[str] = None
percentage_crown_fraction_burned: Optional[float] = None
flame_length: Optional[float] = None
sixty_minute_fire_size: Optional[float] = None
thirty_minute_fire_size: Optional[float] = None
critical_hours_hfi_4000: Optional[CriticalHoursHFI] = None
critical_hours_hfi_10000: Optional[CriticalHoursHFI] = None


class StationsListResponse(BaseModel):
Expand Down
24 changes: 12 additions & 12 deletions api/app/schemas/forecasts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" This module contains pydantic schemas relating to forecasts made by weather forecasters for the API.
"""
from datetime import datetime
from typing import List
from typing import List, Optional
from pydantic import BaseModel
from app.schemas.stations import WeatherStation

Expand All @@ -10,23 +10,23 @@ class NoonForecastValue(BaseModel):
""" Data structure for a noon forecast retrieved from BC FireWeather Phase 1 """
datetime: datetime
temp_valid: bool
temperature: int = None
temperature: Optional[int] = None
rh_valid: bool
relative_humidity: int = None
relative_humidity: Optional[int] = None
wdir_valid: bool
wind_direction: int = None
wind_direction: Optional[int] = None
wspeed_valid: bool
wind_speed: float
precip_valid: bool
total_precipitation: float
gc: float = None
ffmc: float = None
dmc: float = None
dc: float = None
isi: float = None
bui: float = None
fwi: float = None
danger_rating: int = None
gc: Optional[float] = None
ffmc: Optional[float] = None
dmc: Optional[float] = None
dc: Optional[float] = None
isi: Optional[float] = None
bui: Optional[float] = None
fwi: Optional[float] = None
danger_rating: Optional[int] = None
created_at: datetime


Expand Down
20 changes: 10 additions & 10 deletions api/app/schemas/hfi_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class DailyResult(BaseModel):
date: date
dailies: List[ValidatedStationDaily]
fire_starts: FireStartRange
mean_intensity_group: Optional[float]
prep_level: Optional[float]
mean_intensity_group: Optional[float] = None
prep_level: Optional[float] = None


class PlanningAreaResult(BaseModel):
Expand All @@ -92,8 +92,8 @@ class PlanningAreaResult(BaseModel):
"""
planning_area_id: int
all_dailies_valid: bool
highest_daily_intensity_group: Optional[float]
mean_prep_level: Optional[float]
highest_daily_intensity_group: Optional[float] = None
mean_prep_level: Optional[float] = None
daily_results: List[DailyResult]


Expand All @@ -108,15 +108,15 @@ class WeatherStation(BaseModel):
""" A fire weather station has a code, planning area, and other properties specific to the station. """
code: int
station_props: WeatherStationProperties
order_of_appearance_in_planning_area_list: Optional[int]
order_of_appearance_in_planning_area_list: Optional[int] = None


class PlanningArea(BaseModel):
""" A planning area (a.k.a. zone) is a small group of stations selected to represent a particular
zone within a fire centre. """
id: int
name: str
order_of_appearance_in_list: Optional[int]
order_of_appearance_in_list: Optional[int] = None
stations: List[WeatherStation]


Expand Down Expand Up @@ -234,8 +234,8 @@ class PrepTablePlanningAreaPDFData(BaseModel):
""" Data needed for prep cycle PDF sheet """
planning_area_name: str
order: int
highest_daily_intensity_group: Optional[float]
mean_prep_level: Optional[float]
highest_daily_intensity_group: Optional[float] = None
mean_prep_level: Optional[float] = None
mean_intensity_groups: List[Optional[float]]
fire_starts_labels: List[str]
prep_levels: List[Optional[int]]
Expand All @@ -247,8 +247,8 @@ class DailyTablePlanningAreaPDFData(BaseModel):
""" Data needed for daily PDF sheet """
planning_area_name: str
order: int
mean_intensity_group: Optional[float]
prep_level: Optional[float]
mean_intensity_group: Optional[float] = None
prep_level: Optional[float] = None
fire_starts: str
date: str
# Every station daily in the above planning area for the specific day
Expand Down
8 changes: 4 additions & 4 deletions api/app/schemas/morecast_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class MoreCastForecastInput(BaseModel):
rh: int
precip: float
wind_speed: float
wind_direction: int | None
wind_direction: int | None = None


class MoreCastForecastRequest(BaseModel):
Expand Down Expand Up @@ -142,14 +142,14 @@ class WF1ForecastRecordType(BaseModel):
class WF1PostForecast(BaseModel):
""" Used to represent a forecast to be POSTed to WF1 """
archive: str = 'false'
createdBy: Optional[str]
id: Optional[str]
createdBy: Optional[str] = None
id: Optional[str] = None
station: str # station URL
stationId: str # station UUID
weatherTimestamp: int # UTC timestamp in millis
temperature: float
relativeHumidity: float
precipitation: float
windSpeed: float
windDirection: Optional[float]
windDirection: Optional[float] = None
recordType: WF1ForecastRecordType
4 changes: 2 additions & 2 deletions api/app/schemas/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ class FuelType(BaseModel):
abbrev: str
fuel_type_code: str
description: str
percentage_conifer: Optional[int]
percentage_dead_fir: Optional[int]
percentage_conifer: Optional[int] = None
percentage_dead_fir: Optional[int] = None
18 changes: 9 additions & 9 deletions api/app/schemas/stations.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ class WeatherStationProperties(BaseModel):
""" Non-geometrical weather station properties """
code: int
name: str
ecodivision_name: str = None
core_season: Season = None
ecodivision_name: Optional[str] = None
core_season: Optional[Season] = None


class WeatherVariables(BaseModel):
""" Weather variables """
temperature: float = None
relative_humidity: float = None
temperature: Optional[float] = None
relative_humidity: Optional[float] = None


class DetailedWeatherStationProperties(WeatherStationProperties):
""" Detailed, non-geometrical weather station properties """
observations: WeatherVariables = None
forecasts: WeatherVariables = None
observations: Optional[WeatherVariables] = None
forecasts: Optional[WeatherVariables] = None


class WeatherStationGeometry(BaseModel):
Expand Down Expand Up @@ -71,8 +71,8 @@ class WeatherStation(BaseModel):
name: str
lat: float
long: float
ecodivision_name: str = None
core_season: Season = None
ecodivision_name: Optional[str] = None
core_season: Optional[Season] = None
elevation: Optional[int] = None
wfwx_station_uuid: Optional[str] = None

Expand Down Expand Up @@ -112,7 +112,7 @@ class WeatherStationGroupMembersResponse(BaseModel):
class WeatherStationGroup(BaseModel):
""" A weather station group from WF1"""
display_label: str
group_description: str | None
group_description: Optional[str] = None
group_owner_user_guid: str
group_owner_user_id: str
id: str
Expand Down
3 changes: 2 additions & 1 deletion api/app/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" Util & common files for tests
"""
from typing import IO, Any, Callable, Optional, Tuple
from dateutil import parser
import os
import datetime
import json
Expand Down Expand Up @@ -111,7 +112,7 @@ def de_serialize_record(record):
# Handle the special case, where the type is timestamp, converting the string to the
# correct data type.
if isinstance(getattr(class_, key).type, TZTimeStamp):
record_data[key] = datetime.datetime.fromisoformat(value)
record_data[key] = parser.isoparse(value)
else:
record_data[key] = value
return class_(**record_data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
"name": "GDPS",
"abbrev": "GDPS"
},
"model_run_timestamp": "2021-06-08T12:00:00+00:00",
"model_run_timestamp": "2021-06-08T12:00:00Z",
"prediction_timestamps": [
"2021-06-09T00:00:00+00:00",
"2021-06-09T03:00:00+00:00"
"2021-06-09T00:00:00Z",
"2021-06-09T03:00:00Z"
]
},
{
"model": {
"name": "RDPS",
"abbrev": "RDPS"
},
"model_run_timestamp": "2021-06-08T00:00:00+00:00",
"model_run_timestamp": "2021-06-08T00:00:00Z",
"prediction_timestamps": [
"2021-06-09T00:00:00+00:00",
"2021-06-09T03:00:00+00:00"
"2021-06-09T00:00:00Z",
"2021-06-09T03:00:00Z"
]
}
]
Expand Down
2 changes: 1 addition & 1 deletion api/app/tests/forecasts/test_noon_forecasts.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@
"fwi": 1.1,
"created_at": "2020-07-22T23:00:00+00:00"
}
]
]
2 changes: 1 addition & 1 deletion api/app/tests/forecasts/test_noon_forecasts_summaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ def assert_response(response, codes: List):
if len(result['summaries']) == 1:
summary = result['summaries'][0]
assert summary['station']['code'] == codes[0]
assert summary['values'] == [{'datetime': weather_date.isoformat(), 'tmp_min': tmp_min,
assert summary['values'] == [{'datetime': weather_date.isoformat().replace("+00:00", "Z"), 'tmp_min': tmp_min,
'tmp_max': tmp_max, 'rh_min': rh_min, 'rh_max': rh_max}]
Loading

0 comments on commit 08a0907

Please sign in to comment.