From 8c43420a6e1d9b762bcbc0bce1574b09b01a50f8 Mon Sep 17 00:00:00 2001 From: Austin Orr Date: Wed, 14 Jun 2023 17:19:43 -0700 Subject: [PATCH 1/3] drop online facility base --- .../models/treatment_facility_models.py | 22 +++++++++---------- nereid/nereid/tests/test_api/test_models.py | 2 +- nereid/nereid/tests/utils.py | 1 - 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/nereid/nereid/api/api_v1/models/treatment_facility_models.py b/nereid/nereid/api/api_v1/models/treatment_facility_models.py index 8ba36ec1..b96d30be 100644 --- a/nereid/nereid/api/api_v1/models/treatment_facility_models.py +++ b/nereid/nereid/api/api_v1/models/treatment_facility_models.py @@ -113,7 +113,7 @@ class DryWeatherTreatmentLowFlowFacility(LowFlowFacility): _constructor: str = "dry_weather_treatment_low_flow_facility_constructor" -class OnlineFaciltyBase(FacilityBase): +class OnlineFacilityBase(FacilityBase): # pragma: no cover is_online: bool = True tributary_area_tc_min: float = Field(5.0, le=60) offline_diversion_rate_cfs: Optional[float] = None @@ -128,33 +128,33 @@ def required_if_offline(cls, v, values): return v -class RetentionFacility(OnlineFaciltyBase): +class RetentionFacility(FacilityBase): total_volume_cuft: float area_sqft: float inf_rate_inhr: float _constructor: str = "retention_facility_constructor" -class RetentionFacilityHSG(OnlineFaciltyBase): +class RetentionFacilityHSG(FacilityBase): total_volume_cuft: float area_sqft: float hsg: str _constructor: str = "retention_facility_constructor" -class DryWellFacility(OnlineFaciltyBase): +class DryWellFacility(FacilityBase): total_volume_cuft: float treatment_rate_cfs: float _constructor: str = "dry_well_facility_constructor" -class DryWellFacilityFlowOrVolume(OnlineFaciltyBase): +class DryWellFacilityFlowOrVolume(FacilityBase): total_volume_cuft: float treatment_rate_cfs: float _constructor: str = "dry_well_facility_flow_or_volume_constructor" -class BioInfFacility(OnlineFaciltyBase): +class BioInfFacility(FacilityBase): total_volume_cuft: float retention_volume_cuft: float area_sqft: float @@ -163,7 +163,7 @@ class BioInfFacility(OnlineFaciltyBase): _constructor: str = "bioinfiltration_facility_constructor" -class RetAndTmntFacility(OnlineFaciltyBase): +class RetAndTmntFacility(FacilityBase): total_volume_cuft: float retention_volume_cuft: float area_sqft: float @@ -172,7 +172,7 @@ class RetAndTmntFacility(OnlineFaciltyBase): _constructor: str = "retention_and_treatment_facility_constructor" -class TmntFacility(OnlineFaciltyBase): +class TmntFacility(FacilityBase): total_volume_cuft: float area_sqft: float media_filtration_rate_inhr: float @@ -194,7 +194,7 @@ class TmntFacilityWithRetentionOverride(TmntFacility): ) -class FlowAndRetFacility(OnlineFaciltyBase): +class FlowAndRetFacility(FacilityBase): treatment_rate_cfs: float area_sqft: float depth_ft: float @@ -202,14 +202,14 @@ class FlowAndRetFacility(OnlineFaciltyBase): _constructor: str = "flow_and_retention_facility_constructor" -class CisternFacility(OnlineFaciltyBase): +class CisternFacility(FacilityBase): total_volume_cuft: float winter_demand_cfs: float = 0.0 summer_demand_cfs: float = 0.0 _constructor: str = "cistern_facility_constructor" -class PermPoolFacility(OnlineFaciltyBase): +class PermPoolFacility(FacilityBase): pool_volume_cuft: float = 0.0 treatment_volume_cuft: float = 0.0 _constructor: str = "perm_pool_facility_constructor" diff --git a/nereid/nereid/tests/test_api/test_models.py b/nereid/nereid/tests/test_api/test_models.py index cc35a572..b8990740 100644 --- a/nereid/nereid/tests/test_api/test_models.py +++ b/nereid/nereid/tests/test_api/test_models.py @@ -25,7 +25,7 @@ }, ), ( - "validation error", + False, { "node_id": "1", "facility_type": "biofiltration", diff --git a/nereid/nereid/tests/utils.py b/nereid/nereid/tests/utils.py index bd52483f..1a8710bd 100644 --- a/nereid/nereid/tests/utils.py +++ b/nereid/nereid/tests/utils.py @@ -195,7 +195,6 @@ def generate_random_treatment_facility_request_node( dct["captured_pct"] = numpy.random.uniform(0.1, 99.0) del dct["retained_pct"] dct["design_storm_depth_inches"] = numpy.random.uniform(0.75, 1.5) - dct["is_online"] = True if "tributary_area_tc_min" in dct: dct["tributary_area_tc_min"] = int(numpy.random.choice(range(5, 60, 5))) From fe7c03b85645413e4b91407547fc3f3fc4b5b585 Mon Sep 17 00:00:00 2001 From: Austin Orr Date: Thu, 15 Jun 2023 09:40:19 -0700 Subject: [PATCH 2/3] patch install --- .github/workflows/test.yml | 11 +++++------ setup.cfg | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c4070370..da7b5940 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - name: Install Deps run: pip install -r nereid/requirements.txt -r nereid/requirements_tests.txt - name: Run Tests @@ -33,19 +33,18 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - name: Install nereid as library run: | pip install . - pip install pytest pytest-xdist - - name: Run Tests - run: pytest nereid/nereid/tests/test_src -xv -n 2 + - name: Test Import + run: python -c "import nereid" python-edge-test: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.10", "3.11"] steps: - run: sudo apt-get install graphviz - uses: actions/checkout@v3 diff --git a/setup.cfg b/setup.cfg index 9b4f8269..d770bda8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -48,7 +48,6 @@ async-app = dev = nereid[async-app] black==22.1.0 - codecov coverage>=6.0.0 isort>=5.0.0 mypy>=0.910 From fa21a0982cfad670dcc6969fba7b3002705469f0 Mon Sep 17 00:00:00 2001 From: Austin Orr Date: Thu, 15 Jun 2023 11:09:14 -0700 Subject: [PATCH 3/3] refactor dry well model --- nereid/nereid/api/api_v1/models/treatment_facility_models.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nereid/nereid/api/api_v1/models/treatment_facility_models.py b/nereid/nereid/api/api_v1/models/treatment_facility_models.py index b96d30be..eb301351 100644 --- a/nereid/nereid/api/api_v1/models/treatment_facility_models.py +++ b/nereid/nereid/api/api_v1/models/treatment_facility_models.py @@ -148,9 +148,7 @@ class DryWellFacility(FacilityBase): _constructor: str = "dry_well_facility_constructor" -class DryWellFacilityFlowOrVolume(FacilityBase): - total_volume_cuft: float - treatment_rate_cfs: float +class DryWellFacilityFlowOrVolume(FlowFacility, DryWellFacility): _constructor: str = "dry_well_facility_flow_or_volume_constructor"