From ea38419c80874e28c2183bc86fc44a6b84b2a7a5 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 31 Oct 2023 13:58:10 -0700 Subject: [PATCH] Lint fixes --- api/app/tests/fixtures/loader.py | 4 ++-- api/app/tests/weather_models/test_env_canada_gdps.py | 4 ---- api/app/tests/weather_models/test_env_canada_hrdps.py | 5 ----- api/app/tests/weather_models/test_env_canada_rdps.py | 5 ----- api/app/tests/wildfire_one/test_schema_parsers.py | 2 +- api/app/weather_models/precip_model.py | 2 -- 6 files changed, 3 insertions(+), 19 deletions(-) diff --git a/api/app/tests/fixtures/loader.py b/api/app/tests/fixtures/loader.py index fdde563c7..e4cf7d6e9 100644 --- a/api/app/tests/fixtures/loader.py +++ b/api/app/tests/fixtures/loader.py @@ -92,7 +92,7 @@ def guess_filename(self, url: str, params: dict): if params: filename = filename + '_' for key, value in params.items(): - if type(value) == str: + if type(value) == str: # noqa: E721 value = value.replace(' ', '_') filename = '{}_{}_{}'.format(filename, key, value) filename = filename[:200] + '.json' @@ -110,7 +110,7 @@ def lookup_fixture_filename(self, lookup = nested_defaultdict(lookup) fixture = lookup[url][verb][str(params)][str(data)] - if type(fixture) is not str: + if type(fixture) is not str: # noqa: E721 if config.get('AUTO_MAKE_FIXTURES'): logger.warning('inserting fixture into lookup') lookup[url][verb][str(params)][str(data)] = self.guess_filename(url, params) diff --git a/api/app/tests/weather_models/test_env_canada_gdps.py b/api/app/tests/weather_models/test_env_canada_gdps.py index d3e2a9eca..694bd0a76 100644 --- a/api/app/tests/weather_models/test_env_canada_gdps.py +++ b/api/app/tests/weather_models/test_env_canada_gdps.py @@ -8,7 +8,6 @@ import pytest import requests from sqlalchemy.orm import Session -from shapely import wkt from app.jobs import env_canada from app.jobs import common_model_fetchers import app.utils.time as time_utils @@ -48,9 +47,6 @@ def mock_get_actuals_left_outer_join_with_predictions(monkeypatch): @pytest.fixture() def mock_database(monkeypatch): """ Mocked out database queries """ - geom = ("POLYGON ((-120.525 50.77500000000001, -120.375 50.77500000000001,-120.375 50.62500000000001," - " -120.525 50.62500000000001, -120.525 50.77500000000001))") - shape = wkt.loads(geom) gdps_url = ('https://dd.weather.gc.ca/model_gem_global/15km/grib2/lat_lon/00/000/' 'CMC_glb_TMP_TGL_2_latlon.15x.15_2020052100_P000.grib2') gdps_processed_model_run = ProcessedModelRunUrl(url=gdps_url) diff --git a/api/app/tests/weather_models/test_env_canada_hrdps.py b/api/app/tests/weather_models/test_env_canada_hrdps.py index ce2a572b6..1aeace0d7 100644 --- a/api/app/tests/weather_models/test_env_canada_hrdps.py +++ b/api/app/tests/weather_models/test_env_canada_hrdps.py @@ -6,7 +6,6 @@ from typing import Optional import pytest import requests -import shapely import datetime from sqlalchemy.orm import Session from pytest_mock import MockerFixture @@ -29,10 +28,6 @@ @pytest.fixture() def mock_database(monkeypatch): """ Mocked out database queries """ - geom = ("POLYGON ((-120.525 50.77500000000001, -120.375 50.77500000000001,-120.375 50.62500000000001," - " -120.525 50.62500000000001, -120.525 50.77500000000001))") - shape = shapely.wkt.loads(geom) - hrdps_url = 'https://dd.weather.gc.ca/model_hrdps/continental/2.5km/' \ '00/001/20200521T00Z_MSC_HRDPS_RH_AGL-2m_RLatLon0.0225_PT001H.grib2' hrdps_processed_model_run = ProcessedModelRunUrl(url=hrdps_url) diff --git a/api/app/tests/weather_models/test_env_canada_rdps.py b/api/app/tests/weather_models/test_env_canada_rdps.py index 7cf2f389c..7874f43e7 100644 --- a/api/app/tests/weather_models/test_env_canada_rdps.py +++ b/api/app/tests/weather_models/test_env_canada_rdps.py @@ -6,7 +6,6 @@ import pytest import requests from typing import Optional -from shapely import wkt from sqlalchemy.orm import Session import app.utils.time as time_utils import app.weather_models.process_grib @@ -24,10 +23,6 @@ @pytest.fixture() def mock_database(monkeypatch): """ Mocked out database queries """ - geom = ("POLYGON ((-120.525 50.77500000000001, -120.375 50.77500000000001,-120.375 50.62500000000001," - " -120.525 50.62500000000001, -120.525 50.77500000000001))") - shape = wkt.loads(geom) - rdps_url = ('https://dd.weather.gc.ca/model_gem_regional/10km/grib2/00/034/' 'CMC_reg_RH_TGL_2_ps10km_2020052100_P034.grib2') rdps_processed_model_run = ProcessedModelRunUrl(url=rdps_url) diff --git a/api/app/tests/wildfire_one/test_schema_parsers.py b/api/app/tests/wildfire_one/test_schema_parsers.py index 7669fbef5..0c695f61c 100644 --- a/api/app/tests/wildfire_one/test_schema_parsers.py +++ b/api/app/tests/wildfire_one/test_schema_parsers.py @@ -1,5 +1,5 @@ from typing import List -from app.schemas.morecast_v2 import StationDailyFromWF1, WeatherDeterminate, WeatherIndeterminate +from app.schemas.morecast_v2 import StationDailyFromWF1, WeatherDeterminate from app.wildfire_one.schema_parsers import (WF1RecordTypeEnum, parse_noon_forecast, parse_hourly_actual, unique_weather_stations_mapper, weather_indeterminate_list_mapper, diff --git a/api/app/weather_models/precip_model.py b/api/app/weather_models/precip_model.py index 14e5bdb49..a96684e18 100644 --- a/api/app/weather_models/precip_model.py +++ b/api/app/weather_models/precip_model.py @@ -1,7 +1,5 @@ import logging -import math from datetime import datetime -from typing import List from app.weather_models.linear_model import LinearModel from app.weather_models.regression_model import RegressionModelBase