From 4dd759997630a59c4f9baf03971e9701764bf703 Mon Sep 17 00:00:00 2001 From: Alan Pinkert Date: Wed, 22 Nov 2023 01:57:51 +0000 Subject: [PATCH] fix lints --- rules-engine/src/rules_engine/engine.py | 17 ++++++++++++----- .../src/rules_engine/pydantic_models.py | 2 +- .../tests/test_rules_engine/test_engine.py | 12 +++++++++--- .../tests/test_rules_engine/test_examples.py | 14 +++++++++----- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/rules-engine/src/rules_engine/engine.py b/rules-engine/src/rules_engine/engine.py index e182c5e9..dea4a06e 100644 --- a/rules-engine/src/rules_engine/engine.py +++ b/rules-engine/src/rules_engine/engine.py @@ -5,11 +5,18 @@ from typing import Any, List, Optional, Tuple import numpy as np -from rules_engine.pydantic_models import (AnalysisType, BalancePointGraph, - DhwInput, FuelType, - NaturalGasBillingInput, - OilPropaneBillingInput, SummaryInput, - SummaryOutput, TemperatureInput) + +from rules_engine.pydantic_models import ( + AnalysisType, + BalancePointGraph, + DhwInput, + FuelType, + NaturalGasBillingInput, + OilPropaneBillingInput, + SummaryInput, + SummaryOutput, + TemperatureInput, +) def get_outputs_oil_propane( diff --git a/rules-engine/src/rules_engine/pydantic_models.py b/rules-engine/src/rules_engine/pydantic_models.py index e13cd955..5d4e1c1e 100644 --- a/rules-engine/src/rules_engine/pydantic_models.py +++ b/rules-engine/src/rules_engine/pydantic_models.py @@ -23,7 +23,7 @@ class FuelType(Enum): PROPANE = 91333 -def validate_fuel_type(value: Any): +def validate_fuel_type(value: Any) -> FuelType: if isinstance(value, FuelType): return value diff --git a/rules-engine/tests/test_rules_engine/test_engine.py b/rules-engine/tests/test_rules_engine/test_engine.py index eb631931..0f756a7e 100644 --- a/rules-engine/tests/test_rules_engine/test_engine.py +++ b/rules-engine/tests/test_rules_engine/test_engine.py @@ -1,9 +1,15 @@ import pytest from pytest import approx + from rules_engine import engine -from rules_engine.pydantic_models import (BalancePointGraph, DhwInput, - FuelType, NaturalGasBillingInput, - SummaryInput, SummaryOutput) +from rules_engine.pydantic_models import ( + BalancePointGraph, + DhwInput, + FuelType, + NaturalGasBillingInput, + SummaryInput, + SummaryOutput, +) @pytest.mark.parametrize( diff --git a/rules-engine/tests/test_rules_engine/test_examples.py b/rules-engine/tests/test_rules_engine/test_examples.py index b5f81b9b..8dcc1b89 100644 --- a/rules-engine/tests/test_rules_engine/test_examples.py +++ b/rules-engine/tests/test_rules_engine/test_examples.py @@ -8,13 +8,17 @@ import pytest from pydantic import BaseModel from pytest import approx -from rules_engine import engine -from rules_engine.pydantic_models import (NaturalGasBillingInput, - NaturalGasBillingRecordInput, - SummaryInput, SummaryOutput, - TemperatureInput) from typing_extensions import Annotated +from rules_engine import engine +from rules_engine.pydantic_models import ( + NaturalGasBillingInput, + NaturalGasBillingRecordInput, + SummaryInput, + SummaryOutput, + TemperatureInput, +) + # Test inputs are provided as separate directory within the "cases/examples" directory # Each subdirectory contains a JSON file (named summary.json) which specifies the inputs for the test runner ROOT_DIR = pathlib.Path(__file__).parent / "cases" / "examples"