diff --git a/.pylintrc b/.pylintrc index b0bfeed..1a254ee 100644 --- a/.pylintrc +++ b/.pylintrc @@ -10,7 +10,4 @@ ignore-paths=src/s2python/generated/ # avoid hangs. jobs=1 -disable=missing-class-docstring,missing-module-docstring,too-few-public-methods,missing-function-docstring,no-member - -[Format] -max-line-length=120 +disable=missing-class-docstring,missing-module-docstring,too-few-public-methods,missing-function-docstring,no-member,unsubscriptable-object,line-too-long diff --git a/ci/typecheck.sh b/ci/typecheck.sh index 706035c..6864b6a 100755 --- a/ci/typecheck.sh +++ b/ci/typecheck.sh @@ -2,3 +2,4 @@ . .venv/bin/activate mypy --config-file mypy.ini src/ ./tests/unit/ examples/ +pyright diff --git a/dev-requirements.txt b/dev-requirements.txt index 183afa3..5b3daa2 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -8,27 +8,27 @@ alabaster==0.7.13 # via sphinx annotated-types==0.7.0 # via pydantic -argcomplete==3.5.0 +argcomplete==3.5.3 # via datamodel-code-generator astroid==3.2.4 # via pylint -babel==2.16.0 +babel==2.17.0 # via sphinx black==24.8.0 # via datamodel-code-generator -build==1.2.1 +build==1.2.2.post1 # via pip-tools -cachetools==5.5.0 +cachetools==5.5.2 # via tox -certifi==2024.8.30 +certifi==2025.1.31 # via requests cfgv==3.4.0 # via pre-commit chardet==5.2.0 # via tox -charset-normalizer==3.3.2 +charset-normalizer==3.4.1 # via requests -click==8.1.7 +click==8.1.8 # via # black # pip-tools @@ -37,38 +37,32 @@ colorama==0.4.6 # via tox coverage[toml]==7.6.1 # via pytest-cov -datamodel-code-generator==0.26.0 +datamodel-code-generator==0.27.3 # via s2-python (setup.cfg) -dill==0.3.8 +dill==0.3.9 # via pylint -distlib==0.3.8 +distlib==0.3.9 # via virtualenv -dnspython==2.6.1 - # via email-validator docutils==0.20.1 # via # sphinx # sphinx-rtd-theme # sphinx-tabs -email-validator==2.2.0 - # via pydantic exceptiongroup==1.2.2 # via pytest -filelock==3.15.4 +filelock==3.16.1 # via # tox # virtualenv genson==1.3.0 # via datamodel-code-generator -identify==2.6.0 +identify==2.6.1 # via pre-commit -idna==3.8 - # via - # email-validator - # requests +idna==3.10 + # via requests imagesize==1.4.1 # via sphinx -importlib-metadata==8.4.0 +importlib-metadata==8.5.0 # via # build # sphinx @@ -80,7 +74,7 @@ isort==5.13.2 # via # datamodel-code-generator # pylint -jinja2==3.1.4 +jinja2==3.1.5 # via # datamodel-code-generator # sphinx @@ -88,15 +82,17 @@ markupsafe==2.1.5 # via jinja2 mccabe==0.7.0 # via pylint -mypy==1.11.2 +mypy==1.14.1 # via s2-python (setup.cfg) mypy-extensions==1.0.0 # via # black # mypy nodeenv==1.9.1 - # via pre-commit -packaging==24.1 + # via + # pre-commit + # pyright +packaging==24.2 # via # black # build @@ -109,7 +105,7 @@ pathspec==0.12.1 # via black pip-tools==7.4.1 # via s2-python (setup.cfg) -platformdirs==4.2.2 +platformdirs==4.3.6 # via # black # pylint @@ -121,25 +117,27 @@ pluggy==1.5.0 # tox pre-commit==3.5.0 # via s2-python (setup.cfg) -pydantic[email]==2.8.2 +pydantic==2.10.6 # via # datamodel-code-generator # s2-python (setup.cfg) -pydantic-core==2.20.1 +pydantic-core==2.27.2 # via pydantic -pygments==2.18.0 +pygments==2.19.1 # via # sphinx # sphinx-tabs pylint==3.2.7 # via s2-python (setup.cfg) -pyproject-api==1.7.1 +pyproject-api==1.8.0 # via tox -pyproject-hooks==1.1.0 +pyproject-hooks==1.2.0 # via # build # pip-tools -pytest==8.3.2 +pyright==1.1.396 + # via s2-python (setup.cfg) +pytest==8.3.5 # via # pytest-cov # pytest-timer @@ -152,7 +150,7 @@ pytest-coverage==0.0 # via s2-python (setup.cfg) pytest-timer==1.0.0 # via s2-python (setup.cfg) -pytz==2024.1 +pytz==2025.1 # via # babel # s2-python (setup.cfg) @@ -162,7 +160,7 @@ pyyaml==6.0.2 # pre-commit requests==2.32.3 # via sphinx -six==1.16.0 +six==1.17.0 # via sphinxcontrib-httpdomain snowballstemmer==2.2.0 # via sphinx @@ -179,9 +177,9 @@ sphinx-copybutton==0.5.2 # via s2-python (setup.cfg) sphinx-fontawesome==0.0.6 # via s2-python (setup.cfg) -sphinx-rtd-theme==2.0.0 +sphinx-rtd-theme==3.0.2 # via s2-python (setup.cfg) -sphinx-tabs==3.4.5 +sphinx-tabs==3.4.7 # via s2-python (setup.cfg) sphinxcontrib-applehelp==1.0.4 # via sphinx @@ -199,13 +197,12 @@ sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.5 # via sphinx -toml==0.10.2 - # via datamodel-code-generator -tomli==2.0.1 +tomli==2.2.1 # via # black # build # coverage + # datamodel-code-generator # mypy # pip-tools # pylint @@ -214,9 +211,9 @@ tomli==2.0.1 # tox tomlkit==0.13.2 # via pylint -tox==4.18.0 +tox==4.24.1 # via s2-python (setup.cfg) -types-pytz==2024.1.0.20240417 +types-pytz==2024.2.0.20241221 # via s2-python (setup.cfg) typing-extensions==4.12.2 # via @@ -227,17 +224,19 @@ typing-extensions==4.12.2 # pydantic # pydantic-core # pylint -urllib3==2.2.2 + # pyright + # tox +urllib3==2.2.3 # via requests -virtualenv==20.26.3 +virtualenv==20.29.2 # via # pre-commit # tox -websockets==13.0.1 +websockets==13.1 # via s2-python (setup.cfg) -wheel==0.44.0 +wheel==0.45.1 # via pip-tools -zipp==3.20.1 +zipp==3.20.2 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: diff --git a/examples/example_frbc_rm.py b/examples/example_frbc_rm.py index 36d8fb7..d69473d 100644 --- a/examples/example_frbc_rm.py +++ b/examples/example_frbc_rm.py @@ -1,5 +1,4 @@ import argparse -import re from functools import partial import logging import sys @@ -93,9 +92,7 @@ def activate(self, conn: S2Connection) -> None: ) ], storage=FRBCStorageDescription( - fill_level_range=NumberRange( - start_of_range=0.0, end_of_range=100.0 - ), + fill_level_range=NumberRange(start_of_range=0.0, end_of_range=100.0), fill_level_label="%", diagnostic_label="Imaginary battery", provides_fill_level_target_profile=True, @@ -113,15 +110,11 @@ def activate(self, conn: S2Connection) -> None: elements=[ FRBCFillLevelTargetProfileElement( duration=Duration.from_milliseconds(30_000), - fill_level_range=NumberRange( - start_of_range=20.0, end_of_range=30.0 - ), + fill_level_range=NumberRange(start_of_range=20.0, end_of_range=30.0), ), FRBCFillLevelTargetProfileElement( duration=Duration.from_milliseconds(300_000), - fill_level_range=NumberRange( - start_of_range=40.0, end_of_range=50.0 - ), + fill_level_range=NumberRange(start_of_range=40.0, end_of_range=50.0), ), ], ) @@ -153,10 +146,12 @@ def activate(self, conn: S2Connection) -> None: def deactivate(self, conn: S2Connection) -> None: print("The control type NoControl is now deactivated.") + def stop(s2_connection, signal_num, _current_stack_frame): print(f"Received signal {signal_num}. Will stop S2 connection.") s2_connection.stop() + def start_s2_session(url, client_node_id=str(uuid.uuid4())): s2_conn = S2Connection( url=url, @@ -169,19 +164,25 @@ def start_s2_session(url, client_node_id=str(uuid.uuid4())): roles=[Role(role=RoleType.ENERGY_CONSUMER, commodity=Commodity.ELECTRICITY)], currency=Currency.EUR, provides_forecast=False, - provides_power_measurements=[CommodityQuantity.ELECTRIC_POWER_L1] + provides_power_measurements=[CommodityQuantity.ELECTRIC_POWER_L1], ), reconnect=True, - verify_certificate=False + verify_certificate=False, ) signal.signal(signal.SIGINT, partial(stop, s2_conn)) signal.signal(signal.SIGTERM, partial(stop, s2_conn)) s2_conn.start_as_rm() + if __name__ == "__main__": parser = argparse.ArgumentParser(description="A simple S2 reseource manager example.") - parser.add_argument('endpoint', type=str, help="WebSocket endpoint uri for the server (CEM) e.g. ws://localhost:8080/backend/rm/s2python-frbc/cem/dummy_model/ws") + parser.add_argument( + "endpoint", + type=str, + help="WebSocket endpoint uri for the server (CEM) e.g. " + "ws://localhost:8080/backend/rm/s2python-frbc/cem/dummy_model/ws", + ) args = parser.parse_args() start_s2_session(args.endpoint) diff --git a/pyrightconfig.json b/pyrightconfig.json new file mode 100644 index 0000000..0df0c10 --- /dev/null +++ b/pyrightconfig.json @@ -0,0 +1,10 @@ +{ + "include": [ + "src", + "tests" + ], + + "defineConstant": { + "DEBUG": true + } +} diff --git a/setup.cfg b/setup.cfg index b23fdfb..602d3da 100644 --- a/setup.cfg +++ b/setup.cfg @@ -57,6 +57,7 @@ testing = mypy types-pytz pylint + pyright development = diff --git a/src/s2python/common/__init__.py b/src/s2python/common/__init__.py index 806de7e..785b8c8 100644 --- a/src/s2python/common/__init__.py +++ b/src/s2python/common/__init__.py @@ -30,3 +30,35 @@ from s2python.common.session_request import SessionRequest from s2python.common.timer import Timer from s2python.common.transition import Transition + +__all__ = [ + "RoleType", + "Currency", + "CommodityQuantity", + "Commodity", + "InstructionStatus", + "ReceptionStatusValues", + "EnergyManagementRole", + "SessionRequestType", + "ControlType", + "RevokableObjects", + "Duration", + "Role", + "Handshake", + "HandshakeResponse", + "InstructionStatusUpdate", + "NumberRange", + "PowerForecastValue", + "PowerForecastElement", + "PowerForecast", + "PowerValue", + "PowerMeasurement", + "PowerRange", + "ReceptionStatus", + "ResourceManagerDetails", + "RevokeObject", + "SelectControlType", + "SessionRequest", + "Timer", + "Transition", +] diff --git a/src/s2python/common/duration.py b/src/s2python/common/duration.py index a8f6708..3fd2cd5 100644 --- a/src/s2python/common/duration.py +++ b/src/s2python/common/duration.py @@ -9,7 +9,9 @@ @catch_and_convert_exceptions -class Duration(GenDuration, S2MessageComponent["Duration"]): +class Duration( # pyright: ignore[reportIncompatibleMethodOverride] + GenDuration, S2MessageComponent +): def to_timedelta(self) -> timedelta: return timedelta(milliseconds=self.root) diff --git a/src/s2python/common/handshake.py b/src/s2python/common/handshake.py index 9598c95..55e1c7d 100644 --- a/src/s2python/common/handshake.py +++ b/src/s2python/common/handshake.py @@ -8,8 +8,8 @@ @catch_and_convert_exceptions -class Handshake(GenHandshake, S2MessageComponent["Handshake"]): +class Handshake(GenHandshake, S2MessageComponent): model_config = GenHandshake.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenHandshake.model_fields["message_id"] # type: ignore[assignment] + message_id: uuid.UUID = GenHandshake.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/common/handshake_response.py b/src/s2python/common/handshake_response.py index e6a9d95..a451e42 100644 --- a/src/s2python/common/handshake_response.py +++ b/src/s2python/common/handshake_response.py @@ -8,8 +8,8 @@ @catch_and_convert_exceptions -class HandshakeResponse(GenHandshakeResponse, S2MessageComponent["HandshakeResponse"]): +class HandshakeResponse(GenHandshakeResponse, S2MessageComponent): model_config = GenHandshakeResponse.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenHandshakeResponse.model_fields["message_id"] # type: ignore[assignment] + message_id: uuid.UUID = GenHandshakeResponse.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/common/instruction_status_update.py b/src/s2python/common/instruction_status_update.py index 6420058..73732e8 100644 --- a/src/s2python/common/instruction_status_update.py +++ b/src/s2python/common/instruction_status_update.py @@ -10,9 +10,9 @@ @catch_and_convert_exceptions -class InstructionStatusUpdate(GenInstructionStatusUpdate, S2MessageComponent["InstructionStatusUpdate"]): +class InstructionStatusUpdate(GenInstructionStatusUpdate, S2MessageComponent): model_config = GenInstructionStatusUpdate.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenInstructionStatusUpdate.model_fields["message_id"] # type: ignore[assignment] - instruction_id: uuid.UUID = GenInstructionStatusUpdate.model_fields["instruction_id"] # type: ignore[assignment] + message_id: uuid.UUID = GenInstructionStatusUpdate.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + instruction_id: uuid.UUID = GenInstructionStatusUpdate.model_fields["instruction_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/common/number_range.py b/src/s2python/common/number_range.py index 40525a2..6181362 100644 --- a/src/s2python/common/number_range.py +++ b/src/s2python/common/number_range.py @@ -5,7 +5,7 @@ @catch_and_convert_exceptions -class NumberRange(GenNumberRange, S2MessageComponent["NumberRange"]): +class NumberRange(GenNumberRange, S2MessageComponent): model_config = GenNumberRange.model_config model_config["validate_assignment"] = True diff --git a/src/s2python/common/power_forecast.py b/src/s2python/common/power_forecast.py index dff4fe2..5dac5bb 100644 --- a/src/s2python/common/power_forecast.py +++ b/src/s2python/common/power_forecast.py @@ -10,9 +10,9 @@ @catch_and_convert_exceptions -class PowerForecast(GenPowerForecast, S2MessageComponent["PowerForecast"]): +class PowerForecast(GenPowerForecast, S2MessageComponent): model_config = GenPowerForecast.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenPowerForecast.model_fields["message_id"] # type: ignore[assignment] - elements: List[PowerForecastElement] = GenPowerForecast.model_fields["elements"] # type: ignore[assignment] + message_id: uuid.UUID = GenPowerForecast.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + elements: List[PowerForecastElement] = GenPowerForecast.model_fields["elements"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/common/power_forecast_element.py b/src/s2python/common/power_forecast_element.py index 5f1626d..7d84a73 100644 --- a/src/s2python/common/power_forecast_element.py +++ b/src/s2python/common/power_forecast_element.py @@ -10,11 +10,11 @@ @catch_and_convert_exceptions -class PowerForecastElement(GenPowerForecastElement, S2MessageComponent["PowerForecastElement"]): +class PowerForecastElement(GenPowerForecastElement, S2MessageComponent): model_config = GenPowerForecastElement.model_config model_config["validate_assignment"] = True - duration: Duration = GenPowerForecastElement.model_fields["duration"] # type: ignore[assignment] - power_values: List[PowerForecastValue] = GenPowerForecastElement.model_fields[ - "power_values" - ] # type: ignore[assignment] + duration: Duration = GenPowerForecastElement.model_fields["duration"] # type: ignore[assignment,reportIncompatibleVariableOverride] + power_values: List[PowerForecastValue] = ( # type: ignore[reportIncompatibleVariableOverride] + GenPowerForecastElement.model_fields["power_values"] # type: ignore[assignment] + ) diff --git a/src/s2python/common/power_forecast_value.py b/src/s2python/common/power_forecast_value.py index 296b35e..dbf2896 100644 --- a/src/s2python/common/power_forecast_value.py +++ b/src/s2python/common/power_forecast_value.py @@ -6,6 +6,6 @@ @catch_and_convert_exceptions -class PowerForecastValue(GenPowerForecastValue, S2MessageComponent["PowerForecastValue"]): +class PowerForecastValue(GenPowerForecastValue, S2MessageComponent): model_config = GenPowerForecastValue.model_config model_config["validate_assignment"] = True diff --git a/src/s2python/common/power_measurement.py b/src/s2python/common/power_measurement.py index b4c1749..afd15cf 100644 --- a/src/s2python/common/power_measurement.py +++ b/src/s2python/common/power_measurement.py @@ -10,9 +10,9 @@ @catch_and_convert_exceptions -class PowerMeasurement(GenPowerMeasurement, S2MessageComponent["PowerMeasurement"]): +class PowerMeasurement(GenPowerMeasurement, S2MessageComponent): model_config = GenPowerMeasurement.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenPowerMeasurement.model_fields["message_id"] # type: ignore[assignment] - values: List[PowerValue] = GenPowerMeasurement.model_fields["values"] # type: ignore[assignment] + message_id: uuid.UUID = GenPowerMeasurement.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + values: List[PowerValue] = GenPowerMeasurement.model_fields["values"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/common/power_range.py b/src/s2python/common/power_range.py index dc0e0bf..b0f4d90 100644 --- a/src/s2python/common/power_range.py +++ b/src/s2python/common/power_range.py @@ -10,7 +10,7 @@ @catch_and_convert_exceptions -class PowerRange(GenPowerRange, S2MessageComponent["PowerRange"]): +class PowerRange(GenPowerRange, S2MessageComponent): model_config = GenPowerRange.model_config model_config["validate_assignment"] = True diff --git a/src/s2python/common/power_value.py b/src/s2python/common/power_value.py index a210bf2..cb55542 100644 --- a/src/s2python/common/power_value.py +++ b/src/s2python/common/power_value.py @@ -6,6 +6,6 @@ @catch_and_convert_exceptions -class PowerValue(GenPowerValue, S2MessageComponent["PowerValue"]): +class PowerValue(GenPowerValue, S2MessageComponent): model_config = GenPowerValue.model_config model_config["validate_assignment"] = True diff --git a/src/s2python/common/reception_status.py b/src/s2python/common/reception_status.py index edae59c..12bf559 100644 --- a/src/s2python/common/reception_status.py +++ b/src/s2python/common/reception_status.py @@ -8,8 +8,8 @@ @catch_and_convert_exceptions -class ReceptionStatus(GenReceptionStatus, S2MessageComponent["ReceptionStatus"]): +class ReceptionStatus(GenReceptionStatus, S2MessageComponent): model_config = GenReceptionStatus.model_config model_config["validate_assignment"] = True - subject_message_id: uuid.UUID = GenReceptionStatus.model_fields["subject_message_id"] # type: ignore[assignment] + subject_message_id: uuid.UUID = GenReceptionStatus.model_fields["subject_message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/common/resource_manager_details.py b/src/s2python/common/resource_manager_details.py index 35b00b6..9333fba 100644 --- a/src/s2python/common/resource_manager_details.py +++ b/src/s2python/common/resource_manager_details.py @@ -13,13 +13,13 @@ @catch_and_convert_exceptions -class ResourceManagerDetails(GenResourceManagerDetails, S2MessageComponent["ResourceManagerDetails"]): +class ResourceManagerDetails(GenResourceManagerDetails, S2MessageComponent): model_config = GenResourceManagerDetails.model_config model_config["validate_assignment"] = True - instruction_processing_delay: Duration = GenResourceManagerDetails.model_fields[ + instruction_processing_delay: Duration = GenResourceManagerDetails.model_fields[ # type: ignore[assignment,reportIncompatibleVariableOverride] "instruction_processing_delay" - ] # type: ignore[assignment] - message_id: uuid.UUID = GenResourceManagerDetails.model_fields["message_id"] # type: ignore[assignment] - resource_id: uuid.UUID = GenResourceManagerDetails.model_fields["resource_id"] # type: ignore[assignment] - roles: List[Role] = GenResourceManagerDetails.model_fields["roles"] # type: ignore[assignment] + ] + message_id: uuid.UUID = GenResourceManagerDetails.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + resource_id: uuid.UUID = GenResourceManagerDetails.model_fields["resource_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + roles: List[Role] = GenResourceManagerDetails.model_fields["roles"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/common/revoke_object.py b/src/s2python/common/revoke_object.py index 250628b..7fc6678 100644 --- a/src/s2python/common/revoke_object.py +++ b/src/s2python/common/revoke_object.py @@ -8,9 +8,9 @@ @catch_and_convert_exceptions -class RevokeObject(GenRevokeObject, S2MessageComponent["RevokeObject"]): +class RevokeObject(GenRevokeObject, S2MessageComponent): model_config = GenRevokeObject.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenRevokeObject.model_fields["message_id"] # type: ignore[assignment] - object_id: uuid.UUID = GenRevokeObject.model_fields["object_id"] # type: ignore[assignment] + message_id: uuid.UUID = GenRevokeObject.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + object_id: uuid.UUID = GenRevokeObject.model_fields["object_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/common/role.py b/src/s2python/common/role.py index 293983c..7f8f253 100644 --- a/src/s2python/common/role.py +++ b/src/s2python/common/role.py @@ -6,6 +6,6 @@ @catch_and_convert_exceptions -class Role(GenRole, S2MessageComponent["Role"]): +class Role(GenRole, S2MessageComponent): model_config = GenRole.model_config model_config["validate_assignment"] = True diff --git a/src/s2python/common/select_control_type.py b/src/s2python/common/select_control_type.py index 675fcc8..e8ac142 100644 --- a/src/s2python/common/select_control_type.py +++ b/src/s2python/common/select_control_type.py @@ -8,8 +8,8 @@ @catch_and_convert_exceptions -class SelectControlType(GenSelectControlType, S2MessageComponent["SelectControlType"]): +class SelectControlType(GenSelectControlType, S2MessageComponent): model_config = GenSelectControlType.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenSelectControlType.model_fields["message_id"] # type: ignore[assignment] + message_id: uuid.UUID = GenSelectControlType.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/common/session_request.py b/src/s2python/common/session_request.py index 907eb67..b5a62a5 100644 --- a/src/s2python/common/session_request.py +++ b/src/s2python/common/session_request.py @@ -8,8 +8,8 @@ @catch_and_convert_exceptions -class SessionRequest(GenSessionRequest, S2MessageComponent["SessionRequest"]): +class SessionRequest(GenSessionRequest, S2MessageComponent): model_config = GenSessionRequest.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenSessionRequest.model_fields["message_id"] # type: ignore[assignment] + message_id: uuid.UUID = GenSessionRequest.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/common/timer.py b/src/s2python/common/timer.py index e4f313e..67e226b 100644 --- a/src/s2python/common/timer.py +++ b/src/s2python/common/timer.py @@ -9,9 +9,9 @@ @catch_and_convert_exceptions -class Timer(GenTimer, S2MessageComponent["Timer"]): +class Timer(GenTimer, S2MessageComponent): model_config = GenTimer.model_config model_config["validate_assignment"] = True - id: uuid.UUID = GenTimer.model_fields["id"] # type: ignore[assignment] - duration: Duration = GenTimer.model_fields["duration"] # type: ignore[assignment] + id: uuid.UUID = GenTimer.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + duration: Duration = GenTimer.model_fields["duration"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/common/transition.py b/src/s2python/common/transition.py index 2c10a06..b43334f 100644 --- a/src/s2python/common/transition.py +++ b/src/s2python/common/transition.py @@ -10,15 +10,15 @@ @catch_and_convert_exceptions -class Transition(GenTransition, S2MessageComponent["Transition"]): +class Transition(GenTransition, S2MessageComponent): model_config = GenTransition.model_config model_config["validate_assignment"] = True - id: uuid.UUID = GenTransition.model_fields["id"] # type: ignore[assignment] - from_: uuid.UUID = GenTransition.model_fields["from_"] # type: ignore[assignment] - to: uuid.UUID = GenTransition.model_fields["to"] # type: ignore[assignment] - start_timers: List[uuid.UUID] = GenTransition.model_fields["start_timers"] # type: ignore[assignment] - blocking_timers: List[uuid.UUID] = GenTransition.model_fields["blocking_timers"] # type: ignore[assignment] - transition_duration: Optional[Duration] = GenTransition.model_fields[ + id: uuid.UUID = GenTransition.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + from_: uuid.UUID = GenTransition.model_fields["from_"] # type: ignore[assignment,reportIncompatibleVariableOverride] + to: uuid.UUID = GenTransition.model_fields["to"] # type: ignore[assignment,reportIncompatibleVariableOverride] + start_timers: List[uuid.UUID] = GenTransition.model_fields["start_timers"] # type: ignore[assignment,reportIncompatibleVariableOverride] + blocking_timers: List[uuid.UUID] = GenTransition.model_fields["blocking_timers"] # type: ignore[assignment,reportIncompatibleVariableOverride] + transition_duration: Optional[Duration] = GenTransition.model_fields[ # type: ignore[assignment,reportIncompatibleVariableOverride] "transition_duration" - ] # type: ignore[assignment] + ] diff --git a/src/s2python/ddbc/__init__.py b/src/s2python/ddbc/__init__.py index efc12b8..d154814 100644 --- a/src/s2python/ddbc/__init__.py +++ b/src/s2python/ddbc/__init__.py @@ -5,8 +5,17 @@ from s2python.ddbc.ddbc_average_demand_rate_forecast_element import ( DDBCAverageDemandRateForecastElement, ) -from s2python.ddbc.ddbc_average_demand_rate_forecast import ( - DDBCAverageDemandRateForecast, -) +from s2python.ddbc.ddbc_average_demand_rate_forecast import DDBCAverageDemandRateForecast from s2python.ddbc.ddbc_system_description import DDBCSystemDescription from s2python.ddbc.ddbc_timer_status import DDBCTimerStatus + +__all__ = [ + "DDBCActuatorDescription", + "DDBCOperationMode", + "DDBCInstruction", + "DDBCActuatorStatus", + "DDBCAverageDemandRateForecastElement", + "DDBCAverageDemandRateForecast", + "DDBCSystemDescription", + "DDBCTimerStatus", +] diff --git a/src/s2python/ddbc/ddbc_actuator_description.py b/src/s2python/ddbc/ddbc_actuator_description.py index 4bd4b8b..a460971 100644 --- a/src/s2python/ddbc/ddbc_actuator_description.py +++ b/src/s2python/ddbc/ddbc_actuator_description.py @@ -16,15 +16,15 @@ @catch_and_convert_exceptions -class DDBCActuatorDescription(GenDDBCActuatorDescription, S2MessageComponent["DDBCActuatorDescription"]): +class DDBCActuatorDescription(GenDDBCActuatorDescription, S2MessageComponent): model_config = GenDDBCActuatorDescription.model_config model_config["validate_assignment"] = True - id: uuid.UUID = GenDDBCActuatorDescription.model_fields["id"] # type: ignore[assignment] + id: uuid.UUID = GenDDBCActuatorDescription.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] supported_commodites: List[Commodity] = GenDDBCActuatorDescription.model_fields[ "supported_commodites" - ] # type: ignore[assignment] - timers: List[Timer] = GenDDBCActuatorDescription.model_fields["timers"] # type: ignore[assignment] - operation_modes: List[DDBCOperationMode] = GenDDBCActuatorDescription.model_fields[ + ] # type: ignore[assignment,reportIncompatibleVariableOverride] + timers: List[Timer] = GenDDBCActuatorDescription.model_fields["timers"] # type: ignore[assignment,reportIncompatibleVariableOverride] + operation_modes: List[DDBCOperationMode] = GenDDBCActuatorDescription.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "operation_modes" ] # type: ignore[assignment] diff --git a/src/s2python/ddbc/ddbc_actuator_status.py b/src/s2python/ddbc/ddbc_actuator_status.py index 19b457b..57d2ffe 100644 --- a/src/s2python/ddbc/ddbc_actuator_status.py +++ b/src/s2python/ddbc/ddbc_actuator_status.py @@ -8,15 +8,15 @@ @catch_and_convert_exceptions -class DDBCActuatorStatus(GenDDBCActuatorStatus, S2MessageComponent["DDBCActuatorStatus"]): +class DDBCActuatorStatus(GenDDBCActuatorStatus, S2MessageComponent): model_config = GenDDBCActuatorStatus.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenDDBCActuatorStatus.model_fields["message_id"] # type: ignore[assignment] - actuator_id: uuid.UUID = GenDDBCActuatorStatus.model_fields["actuator_id"] # type: ignore[assignment] - active_operation_mode_id: uuid.UUID = GenDDBCActuatorStatus.model_fields[ + message_id: uuid.UUID = GenDDBCActuatorStatus.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + actuator_id: uuid.UUID = GenDDBCActuatorStatus.model_fields["actuator_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + active_operation_mode_id: uuid.UUID = GenDDBCActuatorStatus.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "active_operation_mode_id" ] # type: ignore[assignment] - operation_mode_factor: float = GenDDBCActuatorStatus.model_fields[ + operation_mode_factor: float = GenDDBCActuatorStatus.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "operation_mode_factor" ] # type: ignore[assignment] diff --git a/src/s2python/ddbc/ddbc_average_demand_rate_forecast.py b/src/s2python/ddbc/ddbc_average_demand_rate_forecast.py index c265b72..313aadd 100644 --- a/src/s2python/ddbc/ddbc_average_demand_rate_forecast.py +++ b/src/s2python/ddbc/ddbc_average_demand_rate_forecast.py @@ -17,14 +17,12 @@ @catch_and_convert_exceptions class DDBCAverageDemandRateForecast( GenDDBCAverageDemandRateForecast, - S2MessageComponent["DDBCAverageDemandRateForecast"], + S2MessageComponent, ): model_config = GenDDBCAverageDemandRateForecast.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenDDBCAverageDemandRateForecast.model_fields["message_id"] # type: ignore[assignment] - elements: List[ - DDBCAverageDemandRateForecastElement - ] = GenDDBCAverageDemandRateForecast.model_fields[ - "elements" - ] # type: ignore[assignment] + message_id: uuid.UUID = GenDDBCAverageDemandRateForecast.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + elements: List[DDBCAverageDemandRateForecastElement] = ( # type: ignore[reportIncompatibleVariableOverride] + GenDDBCAverageDemandRateForecast.model_fields["elements"] # type: ignore[assignment] + ) diff --git a/src/s2python/ddbc/ddbc_average_demand_rate_forecast_element.py b/src/s2python/ddbc/ddbc_average_demand_rate_forecast_element.py index 4768e1a..8e8bdee 100644 --- a/src/s2python/ddbc/ddbc_average_demand_rate_forecast_element.py +++ b/src/s2python/ddbc/ddbc_average_demand_rate_forecast_element.py @@ -10,12 +10,12 @@ @catch_and_convert_exceptions class DDBCAverageDemandRateForecastElement( GenDDBCAverageDemandRateForecastElement, - S2MessageComponent["DDBCAverageDemandRateForecastElement"], + S2MessageComponent, ): model_config = GenDDBCAverageDemandRateForecastElement.model_config model_config["validate_assignment"] = True - duration: Duration = GenDDBCAverageDemandRateForecastElement.model_fields["duration"] # type: ignore[assignment] + duration: Duration = GenDDBCAverageDemandRateForecastElement.model_fields["duration"] # type: ignore[assignment,reportIncompatibleVariableOverride] demand_rate_expected: float = GenDDBCAverageDemandRateForecastElement.model_fields[ "demand_rate_expected" - ] # type: ignore[assignment] + ] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/ddbc/ddbc_instruction.py b/src/s2python/ddbc/ddbc_instruction.py index 0bfb867..2866a33 100644 --- a/src/s2python/ddbc/ddbc_instruction.py +++ b/src/s2python/ddbc/ddbc_instruction.py @@ -8,12 +8,12 @@ @catch_and_convert_exceptions -class DDBCInstruction(GenDDBCInstruction, S2MessageComponent["DDBCInstruction"]): +class DDBCInstruction(GenDDBCInstruction, S2MessageComponent): model_config = GenDDBCInstruction.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenDDBCInstruction.model_fields["message_id"] # type: ignore[assignment] - actuator_id: uuid.UUID = GenDDBCInstruction.model_fields["actuator_id"] # type: ignore[assignment] - operation_mode_id: uuid.UUID = GenDDBCInstruction.model_fields["operation_mode_id"] # type: ignore[assignment] - operation_mode_factor: float = GenDDBCInstruction.model_fields["operation_mode_factor"] # type: ignore[assignment] - abnormal_condition: bool = GenDDBCInstruction.model_fields["abnormal_condition"] # type: ignore[assignment] + message_id: uuid.UUID = GenDDBCInstruction.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + actuator_id: uuid.UUID = GenDDBCInstruction.model_fields["actuator_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + operation_mode_id: uuid.UUID = GenDDBCInstruction.model_fields["operation_mode_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + operation_mode_factor: float = GenDDBCInstruction.model_fields["operation_mode_factor"] # type: ignore[assignment,reportIncompatibleVariableOverride] + abnormal_condition: bool = GenDDBCInstruction.model_fields["abnormal_condition"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/ddbc/ddbc_operation_mode.py b/src/s2python/ddbc/ddbc_operation_mode.py index 13b35ff..d3ddfbd 100644 --- a/src/s2python/ddbc/ddbc_operation_mode.py +++ b/src/s2python/ddbc/ddbc_operation_mode.py @@ -13,14 +13,14 @@ @catch_and_convert_exceptions -class DDBCOperationMode(GenDDBCOperationMode, S2MessageComponent["DDBCOperationMode"]): +class DDBCOperationMode(GenDDBCOperationMode, S2MessageComponent): model_config = GenDDBCOperationMode.model_config model_config["validate_assignment"] = True # ? Id vs id - id: uuid.UUID = GenDDBCOperationMode.model_fields["Id"] # type: ignore[assignment] - power_ranges: List[PowerRange] = GenDDBCOperationMode.model_fields["power_ranges"] # type: ignore[assignment] - supply_range: List[NumberRange] = GenDDBCOperationMode.model_fields["supply_range"] # type: ignore[assignment] + id: uuid.UUID = GenDDBCOperationMode.model_fields["Id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + power_ranges: List[PowerRange] = GenDDBCOperationMode.model_fields["power_ranges"] # type: ignore[assignment,reportIncompatibleVariableOverride] + supply_range: List[NumberRange] = GenDDBCOperationMode.model_fields["supply_range"] # type: ignore[assignment,reportIncompatibleVariableOverride] abnormal_condition_only: bool = GenDDBCOperationMode.model_fields[ "abnormal_condition_only" - ] # type: ignore[assignment] + ] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/ddbc/ddbc_system_description.py b/src/s2python/ddbc/ddbc_system_description.py index 93724c8..007488d 100644 --- a/src/s2python/ddbc/ddbc_system_description.py +++ b/src/s2python/ddbc/ddbc_system_description.py @@ -13,17 +13,17 @@ @catch_and_convert_exceptions -class DDBCSystemDescription(GenDDBCSystemDescription, S2MessageComponent["DDBCSystemDescription"]): +class DDBCSystemDescription(GenDDBCSystemDescription, S2MessageComponent): model_config = GenDDBCSystemDescription.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenDDBCSystemDescription.model_fields["message_id"] # type: ignore[assignment] - actuators: List[DDBCActuatorDescription] = GenDDBCSystemDescription.model_fields[ + message_id: uuid.UUID = GenDDBCSystemDescription.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + actuators: List[DDBCActuatorDescription] = GenDDBCSystemDescription.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "actuators" ] # type: ignore[assignment] - present_demand_rate: NumberRange = GenDDBCSystemDescription.model_fields[ + present_demand_rate: NumberRange = GenDDBCSystemDescription.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "present_demand_rate" ] # type: ignore[assignment] - provides_average_demand_rate_forecast: bool = GenDDBCSystemDescription.model_fields[ + provides_average_demand_rate_forecast: bool = GenDDBCSystemDescription.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "provides_average_demand_rate_forecast" ] # type: ignore[assignment] diff --git a/src/s2python/ddbc/ddbc_timer_status.py b/src/s2python/ddbc/ddbc_timer_status.py index 954a883..2c4d95e 100644 --- a/src/s2python/ddbc/ddbc_timer_status.py +++ b/src/s2python/ddbc/ddbc_timer_status.py @@ -9,10 +9,10 @@ @catch_and_convert_exceptions -class DDBCTimerStatus(GenDDBCTimerStatus, S2MessageComponent["DDBCTimerStatus"]): +class DDBCTimerStatus(GenDDBCTimerStatus, S2MessageComponent): model_config = GenDDBCTimerStatus.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenDDBCTimerStatus.model_fields["message_id"] # type: ignore[assignment] - timer_id: uuid.UUID = GenDDBCTimerStatus.model_fields["timer_id"] # type: ignore[assignment] - actuator_id: uuid.UUID = GenDDBCTimerStatus.model_fields["actuator_id"] # type: ignore[assignment] + message_id: uuid.UUID = GenDDBCTimerStatus.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + timer_id: uuid.UUID = GenDDBCTimerStatus.model_fields["timer_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + actuator_id: uuid.UUID = GenDDBCTimerStatus.model_fields["actuator_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/frbc/__init__.py b/src/s2python/frbc/__init__.py index da3d5bc..687684e 100644 --- a/src/s2python/frbc/__init__.py +++ b/src/s2python/frbc/__init__.py @@ -1,6 +1,4 @@ -from s2python.frbc.frbc_fill_level_target_profile_element import ( - FRBCFillLevelTargetProfileElement, -) +from s2python.frbc.frbc_fill_level_target_profile_element import FRBCFillLevelTargetProfileElement from s2python.frbc.frbc_fill_level_target_profile import FRBCFillLevelTargetProfile from s2python.frbc.frbc_instruction import FRBCInstruction from s2python.frbc.frbc_leakage_behaviour_element import FRBCLeakageBehaviourElement @@ -15,3 +13,21 @@ from s2python.frbc.frbc_storage_status import FRBCStorageStatus from s2python.frbc.frbc_system_description import FRBCSystemDescription from s2python.frbc.frbc_timer_status import FRBCTimerStatus + +__all__ = [ + "FRBCFillLevelTargetProfileElement", + "FRBCFillLevelTargetProfile", + "FRBCInstruction", + "FRBCLeakageBehaviourElement", + "FRBCLeakageBehaviour", + "FRBCUsageForecastElement", + "FRBCUsageForecast", + "FRBCOperationModeElement", + "FRBCOperationMode", + "FRBCActuatorDescription", + "FRBCActuatorStatus", + "FRBCStorageDescription", + "FRBCStorageStatus", + "FRBCSystemDescription", + "FRBCTimerStatus", +] diff --git a/src/s2python/frbc/frbc_actuator_description.py b/src/s2python/frbc/frbc_actuator_description.py index eee1132..7d05778 100644 --- a/src/s2python/frbc/frbc_actuator_description.py +++ b/src/s2python/frbc/frbc_actuator_description.py @@ -18,19 +18,19 @@ @catch_and_convert_exceptions -class FRBCActuatorDescription(GenFRBCActuatorDescription, S2MessageComponent["FRBCActuatorDescription"]): +class FRBCActuatorDescription(GenFRBCActuatorDescription, S2MessageComponent): model_config = GenFRBCActuatorDescription.model_config model_config["validate_assignment"] = True - id: uuid.UUID = GenFRBCActuatorDescription.model_fields["id"] # type: ignore[assignment] - operation_modes: List[FRBCOperationMode] = GenFRBCActuatorDescription.model_fields[ + id: uuid.UUID = GenFRBCActuatorDescription.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + operation_modes: List[FRBCOperationMode] = GenFRBCActuatorDescription.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "operation_modes" ] # type: ignore[assignment] - transitions: List[Transition] = GenFRBCActuatorDescription.model_fields["transitions"] # type: ignore[assignment] - timers: List[Timer] = GenFRBCActuatorDescription.model_fields["timers"] # type: ignore[assignment] + transitions: List[Transition] = GenFRBCActuatorDescription.model_fields["transitions"] # type: ignore[assignment,reportIncompatibleVariableOverride] + timers: List[Timer] = GenFRBCActuatorDescription.model_fields["timers"] # type: ignore[assignment,reportIncompatibleVariableOverride] supported_commodities: List[Commodity] = GenFRBCActuatorDescription.model_fields[ "supported_commodities" - ] # type: ignore[assignment] + ] # type: ignore[assignment,reportIncompatibleVariableOverride] @model_validator(mode="after") def validate_timers_in_transitions(self) -> Self: @@ -68,7 +68,9 @@ def validate_timers_unique_ids(self) -> Self: @model_validator(mode="after") def validate_operation_modes_in_transitions(self) -> Self: - operation_mode_by_id = {operation_mode.id: operation_mode for operation_mode in self.operation_modes} + operation_mode_by_id = { + operation_mode.id: operation_mode for operation_mode in self.operation_modes + } transition: Transition for transition in self.transitions: if transition.from_ not in operation_mode_by_id: diff --git a/src/s2python/frbc/frbc_actuator_status.py b/src/s2python/frbc/frbc_actuator_status.py index a9d6072..ecf3b15 100644 --- a/src/s2python/frbc/frbc_actuator_status.py +++ b/src/s2python/frbc/frbc_actuator_status.py @@ -9,15 +9,15 @@ @catch_and_convert_exceptions -class FRBCActuatorStatus(GenFRBCActuatorStatus, S2MessageComponent["FRBCActuatorStatus"]): +class FRBCActuatorStatus(GenFRBCActuatorStatus, S2MessageComponent): model_config = GenFRBCActuatorStatus.model_config model_config["validate_assignment"] = True - active_operation_mode_id: uuid.UUID = GenFRBCActuatorStatus.model_fields[ + active_operation_mode_id: uuid.UUID = GenFRBCActuatorStatus.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "active_operation_mode_id" ] # type: ignore[assignment] - actuator_id: uuid.UUID = GenFRBCActuatorStatus.model_fields["actuator_id"] # type: ignore[assignment] - message_id: uuid.UUID = GenFRBCActuatorStatus.model_fields["message_id"] # type: ignore[assignment] - previous_operation_mode_id: Optional[uuid.UUID] = GenFRBCActuatorStatus.model_fields[ + actuator_id: uuid.UUID = GenFRBCActuatorStatus.model_fields["actuator_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + message_id: uuid.UUID = GenFRBCActuatorStatus.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + previous_operation_mode_id: Optional[uuid.UUID] = GenFRBCActuatorStatus.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "previous_operation_mode_id" ] # type: ignore[assignment] diff --git a/src/s2python/frbc/frbc_fill_level_target_profile.py b/src/s2python/frbc/frbc_fill_level_target_profile.py index 5232172..f98b33a 100644 --- a/src/s2python/frbc/frbc_fill_level_target_profile.py +++ b/src/s2python/frbc/frbc_fill_level_target_profile.py @@ -14,11 +14,11 @@ @catch_and_convert_exceptions -class FRBCFillLevelTargetProfile(GenFRBCFillLevelTargetProfile, S2MessageComponent["FRBCFillLevelTargetProfile"]): +class FRBCFillLevelTargetProfile(GenFRBCFillLevelTargetProfile, S2MessageComponent): model_config = GenFRBCFillLevelTargetProfile.model_config model_config["validate_assignment"] = True - elements: List[FRBCFillLevelTargetProfileElement] = GenFRBCFillLevelTargetProfile.model_fields[ + elements: List[FRBCFillLevelTargetProfileElement] = GenFRBCFillLevelTargetProfile.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "elements" ] # type: ignore[assignment] - message_id: uuid.UUID = GenFRBCFillLevelTargetProfile.model_fields["message_id"] # type: ignore[assignment] + message_id: uuid.UUID = GenFRBCFillLevelTargetProfile.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/frbc/frbc_fill_level_target_profile_element.py b/src/s2python/frbc/frbc_fill_level_target_profile_element.py index ab32ef5..5a37c90 100644 --- a/src/s2python/frbc/frbc_fill_level_target_profile_element.py +++ b/src/s2python/frbc/frbc_fill_level_target_profile_element.py @@ -12,14 +12,12 @@ @catch_and_convert_exceptions -class FRBCFillLevelTargetProfileElement( - GenFRBCFillLevelTargetProfileElement, S2MessageComponent["FRBCFillLevelTargetProfileElement"] -): +class FRBCFillLevelTargetProfileElement(GenFRBCFillLevelTargetProfileElement, S2MessageComponent): model_config = GenFRBCFillLevelTargetProfileElement.model_config model_config["validate_assignment"] = True - duration: Duration = GenFRBCFillLevelTargetProfileElement.model_fields["duration"] # type: ignore[assignment] - fill_level_range: NumberRange = GenFRBCFillLevelTargetProfileElement.model_fields[ + duration: Duration = GenFRBCFillLevelTargetProfileElement.model_fields["duration"] # type: ignore[assignment,reportIncompatibleVariableOverride] + fill_level_range: NumberRange = GenFRBCFillLevelTargetProfileElement.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "fill_level_range" ] # type: ignore[assignment] diff --git a/src/s2python/frbc/frbc_instruction.py b/src/s2python/frbc/frbc_instruction.py index ca465f6..a7693da 100644 --- a/src/s2python/frbc/frbc_instruction.py +++ b/src/s2python/frbc/frbc_instruction.py @@ -8,11 +8,11 @@ @catch_and_convert_exceptions -class FRBCInstruction(GenFRBCInstruction, S2MessageComponent["FRBCInstruction"]): +class FRBCInstruction(GenFRBCInstruction, S2MessageComponent): model_config = GenFRBCInstruction.model_config model_config["validate_assignment"] = True - actuator_id: uuid.UUID = GenFRBCInstruction.model_fields["actuator_id"] # type: ignore[assignment] - id: uuid.UUID = GenFRBCInstruction.model_fields["id"] # type: ignore[assignment] - message_id: uuid.UUID = GenFRBCInstruction.model_fields["message_id"] # type: ignore[assignment] - operation_mode: uuid.UUID = GenFRBCInstruction.model_fields["operation_mode"] # type: ignore[assignment] + actuator_id: uuid.UUID = GenFRBCInstruction.model_fields["actuator_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + id: uuid.UUID = GenFRBCInstruction.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + message_id: uuid.UUID = GenFRBCInstruction.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + operation_mode: uuid.UUID = GenFRBCInstruction.model_fields["operation_mode"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/frbc/frbc_leakage_behaviour.py b/src/s2python/frbc/frbc_leakage_behaviour.py index 29ca901..98c44a3 100644 --- a/src/s2python/frbc/frbc_leakage_behaviour.py +++ b/src/s2python/frbc/frbc_leakage_behaviour.py @@ -10,11 +10,11 @@ @catch_and_convert_exceptions -class FRBCLeakageBehaviour(GenFRBCLeakageBehaviour, S2MessageComponent["FRBCLeakageBehaviour"]): +class FRBCLeakageBehaviour(GenFRBCLeakageBehaviour, S2MessageComponent): model_config = GenFRBCLeakageBehaviour.model_config model_config["validate_assignment"] = True - elements: List[FRBCLeakageBehaviourElement] = GenFRBCLeakageBehaviour.model_fields[ + elements: List[FRBCLeakageBehaviourElement] = GenFRBCLeakageBehaviour.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "elements" ] # type: ignore[assignment] - message_id: uuid.UUID = GenFRBCLeakageBehaviour.model_fields["message_id"] # type: ignore[assignment] + message_id: uuid.UUID = GenFRBCLeakageBehaviour.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/frbc/frbc_leakage_behaviour_element.py b/src/s2python/frbc/frbc_leakage_behaviour_element.py index 103abe9..dbe6e8f 100644 --- a/src/s2python/frbc/frbc_leakage_behaviour_element.py +++ b/src/s2python/frbc/frbc_leakage_behaviour_element.py @@ -9,13 +9,11 @@ @catch_and_convert_exceptions -class FRBCLeakageBehaviourElement( - GenFRBCLeakageBehaviourElement, S2MessageComponent["FRBCLeakageBehaviourElement"] -): +class FRBCLeakageBehaviourElement(GenFRBCLeakageBehaviourElement, S2MessageComponent): model_config = GenFRBCLeakageBehaviourElement.model_config model_config["validate_assignment"] = True - fill_level_range: NumberRange = GenFRBCLeakageBehaviourElement.model_fields[ + fill_level_range: NumberRange = GenFRBCLeakageBehaviourElement.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "fill_level_range" ] # type: ignore[assignment] diff --git a/src/s2python/frbc/frbc_operation_mode.py b/src/s2python/frbc/frbc_operation_mode.py index a37d0d9..270cd7e 100644 --- a/src/s2python/frbc/frbc_operation_mode.py +++ b/src/s2python/frbc/frbc_operation_mode.py @@ -16,17 +16,19 @@ @catch_and_convert_exceptions -class FRBCOperationMode(GenFRBCOperationMode, S2MessageComponent["FRBCOperationMode"]): +class FRBCOperationMode(GenFRBCOperationMode, S2MessageComponent): model_config = GenFRBCOperationMode.model_config model_config["validate_assignment"] = True - id: uuid.UUID = GenFRBCOperationMode.model_fields["id"] # type: ignore[assignment] - elements: List[FRBCOperationModeElement] = GenFRBCOperationMode.model_fields["elements"] # type: ignore[assignment] + id: uuid.UUID = GenFRBCOperationMode.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + elements: List[FRBCOperationModeElement] = GenFRBCOperationMode.model_fields["elements"] # type: ignore[assignment,reportIncompatibleVariableOverride] @model_validator(mode="after") def validate_contiguous_fill_levels_operation_mode_elements(self) -> Self: elements_by_fill_level_range: Dict[NumberRange, FRBCOperationModeElement] - elements_by_fill_level_range = {element.fill_level_range: element for element in self.elements} + elements_by_fill_level_range = { + element.fill_level_range: element for element in self.elements + } sorted_fill_level_ranges: List[NumberRange] sorted_fill_level_ranges = list(elements_by_fill_level_range.keys()) diff --git a/src/s2python/frbc/frbc_operation_mode_element.py b/src/s2python/frbc/frbc_operation_mode_element.py index 55f18b3..e22ddb7 100644 --- a/src/s2python/frbc/frbc_operation_mode_element.py +++ b/src/s2python/frbc/frbc_operation_mode_element.py @@ -11,17 +11,17 @@ @catch_and_convert_exceptions -class FRBCOperationModeElement(GenFRBCOperationModeElement, S2MessageComponent["FRBCOperationModeElement"]): +class FRBCOperationModeElement(GenFRBCOperationModeElement, S2MessageComponent): model_config = GenFRBCOperationModeElement.model_config model_config["validate_assignment"] = True - fill_level_range: NumberRange = GenFRBCOperationModeElement.model_fields[ + fill_level_range: NumberRange = GenFRBCOperationModeElement.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "fill_level_range" ] # type: ignore[assignment] - fill_rate: NumberRange = GenFRBCOperationModeElement.model_fields["fill_rate"] # type: ignore[assignment] - power_ranges: List[PowerRange] = GenFRBCOperationModeElement.model_fields[ + fill_rate: NumberRange = GenFRBCOperationModeElement.model_fields["fill_rate"] # type: ignore[assignment,reportIncompatibleVariableOverride] + power_ranges: List[PowerRange] = GenFRBCOperationModeElement.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "power_ranges" ] # type: ignore[assignment] - running_costs: Optional[NumberRange] = GenFRBCOperationModeElement.model_fields[ + running_costs: Optional[NumberRange] = GenFRBCOperationModeElement.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "running_costs" ] # type: ignore[assignment] diff --git a/src/s2python/frbc/frbc_storage_description.py b/src/s2python/frbc/frbc_storage_description.py index 3b2c985..7672d85 100644 --- a/src/s2python/frbc/frbc_storage_description.py +++ b/src/s2python/frbc/frbc_storage_description.py @@ -9,10 +9,10 @@ @catch_and_convert_exceptions -class FRBCStorageDescription(GenFRBCStorageDescription, S2MessageComponent["FRBCStorageDescription"]): +class FRBCStorageDescription(GenFRBCStorageDescription, S2MessageComponent): model_config = GenFRBCStorageDescription.model_config model_config["validate_assignment"] = True - fill_level_range: NumberRange = GenFRBCStorageDescription.model_fields[ + fill_level_range: NumberRange = GenFRBCStorageDescription.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "fill_level_range" ] # type: ignore[assignment] diff --git a/src/s2python/frbc/frbc_storage_status.py b/src/s2python/frbc/frbc_storage_status.py index d0ce3e1..04ade4c 100644 --- a/src/s2python/frbc/frbc_storage_status.py +++ b/src/s2python/frbc/frbc_storage_status.py @@ -8,8 +8,8 @@ @catch_and_convert_exceptions -class FRBCStorageStatus(GenFRBCStorageStatus, S2MessageComponent["FRBCStorageStatus"]): +class FRBCStorageStatus(GenFRBCStorageStatus, S2MessageComponent): model_config = GenFRBCStorageStatus.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenFRBCStorageStatus.model_fields["message_id"] # type: ignore[assignment] + message_id: uuid.UUID = GenFRBCStorageStatus.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/frbc/frbc_system_description.py b/src/s2python/frbc/frbc_system_description.py index 4497d44..f1efdf8 100644 --- a/src/s2python/frbc/frbc_system_description.py +++ b/src/s2python/frbc/frbc_system_description.py @@ -11,12 +11,12 @@ @catch_and_convert_exceptions -class FRBCSystemDescription(GenFRBCSystemDescription, S2MessageComponent["FRBCSystemDescription"]): +class FRBCSystemDescription(GenFRBCSystemDescription, S2MessageComponent): model_config = GenFRBCSystemDescription.model_config model_config["validate_assignment"] = True - actuators: List[FRBCActuatorDescription] = GenFRBCSystemDescription.model_fields[ + actuators: List[FRBCActuatorDescription] = GenFRBCSystemDescription.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "actuators" ] # type: ignore[assignment] - message_id: uuid.UUID = GenFRBCSystemDescription.model_fields["message_id"] # type: ignore[assignment] - storage: FRBCStorageDescription = GenFRBCSystemDescription.model_fields["storage"] # type: ignore[assignment] + message_id: uuid.UUID = GenFRBCSystemDescription.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + storage: FRBCStorageDescription = GenFRBCSystemDescription.model_fields["storage"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/frbc/frbc_timer_status.py b/src/s2python/frbc/frbc_timer_status.py index 02a6d22..b374750 100644 --- a/src/s2python/frbc/frbc_timer_status.py +++ b/src/s2python/frbc/frbc_timer_status.py @@ -8,10 +8,10 @@ @catch_and_convert_exceptions -class FRBCTimerStatus(GenFRBCTimerStatus, S2MessageComponent["FRBCTimerStatus"]): +class FRBCTimerStatus(GenFRBCTimerStatus, S2MessageComponent): model_config = GenFRBCTimerStatus.model_config model_config["validate_assignment"] = True - actuator_id: uuid.UUID = GenFRBCTimerStatus.model_fields["actuator_id"] # type: ignore[assignment] - message_id: uuid.UUID = GenFRBCTimerStatus.model_fields["message_id"] # type: ignore[assignment] - timer_id: uuid.UUID = GenFRBCTimerStatus.model_fields["timer_id"] # type: ignore[assignment] + actuator_id: uuid.UUID = GenFRBCTimerStatus.model_fields["actuator_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + message_id: uuid.UUID = GenFRBCTimerStatus.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + timer_id: uuid.UUID = GenFRBCTimerStatus.model_fields["timer_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/frbc/frbc_usage_forecast.py b/src/s2python/frbc/frbc_usage_forecast.py index bab3297..777d7cb 100644 --- a/src/s2python/frbc/frbc_usage_forecast.py +++ b/src/s2python/frbc/frbc_usage_forecast.py @@ -10,9 +10,9 @@ @catch_and_convert_exceptions -class FRBCUsageForecast(GenFRBCUsageForecast, S2MessageComponent["FRBCUsageForecast"]): +class FRBCUsageForecast(GenFRBCUsageForecast, S2MessageComponent): model_config = GenFRBCUsageForecast.model_config model_config["validate_assignment"] = True - elements: List[FRBCUsageForecastElement] = GenFRBCUsageForecast.model_fields["elements"] # type: ignore[assignment] - message_id: uuid.UUID = GenFRBCUsageForecast.model_fields["message_id"] # type: ignore[assignment] + elements: List[FRBCUsageForecastElement] = GenFRBCUsageForecast.model_fields["elements"] # type: ignore[assignment,reportIncompatibleVariableOverride] + message_id: uuid.UUID = GenFRBCUsageForecast.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/frbc/frbc_usage_forecast_element.py b/src/s2python/frbc/frbc_usage_forecast_element.py index 97e9524..c81467a 100644 --- a/src/s2python/frbc/frbc_usage_forecast_element.py +++ b/src/s2python/frbc/frbc_usage_forecast_element.py @@ -10,8 +10,8 @@ @catch_and_convert_exceptions -class FRBCUsageForecastElement(GenFRBCUsageForecastElement, S2MessageComponent["FRBCUsageForecastElement"]): +class FRBCUsageForecastElement(GenFRBCUsageForecastElement, S2MessageComponent): model_config = GenFRBCUsageForecastElement.model_config model_config["validate_assignment"] = True - duration: Duration = GenFRBCUsageForecastElement.model_fields["duration"] # type: ignore[assignment] + duration: Duration = GenFRBCUsageForecastElement.model_fields["duration"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/generated/gen_s2.py b/src/s2python/generated/gen_s2.py index c7febd6..f09a9f6 100644 --- a/src/s2python/generated/gen_s2.py +++ b/src/s2python/generated/gen_s2.py @@ -20,805 +20,781 @@ class Duration(RootModel[conint(ge=0)]): - root: conint(ge=0) = Field(..., description='Duration in milliseconds') + root: conint(ge=0) = Field( # pyright: ignore[reportInvalidTypeForm] + ..., description="Duration in milliseconds" + ) -class ID(RootModel[constr(pattern=r'[a-zA-Z0-9\-_:]{2,64}')]): - root: constr(pattern=r'[a-zA-Z0-9\-_:]{2,64}') = Field(..., description='UUID') +class ID(RootModel[constr(pattern=r"[a-zA-Z0-9\-_:]{2,64}")]): + root: constr(pattern=r"[a-zA-Z0-9\-_:]{2,64}") = ( # pyright: ignore[reportInvalidTypeForm] + Field(..., description="UUID") + ) class Currency(Enum): - AED = 'AED' - ANG = 'ANG' - AUD = 'AUD' - CHE = 'CHE' - CHF = 'CHF' - CHW = 'CHW' - EUR = 'EUR' - GBP = 'GBP' - LBP = 'LBP' - LKR = 'LKR' - LRD = 'LRD' - LSL = 'LSL' - LYD = 'LYD' - MAD = 'MAD' - MDL = 'MDL' - MGA = 'MGA' - MKD = 'MKD' - MMK = 'MMK' - MNT = 'MNT' - MOP = 'MOP' - MRO = 'MRO' - MUR = 'MUR' - MVR = 'MVR' - MWK = 'MWK' - MXN = 'MXN' - MXV = 'MXV' - MYR = 'MYR' - MZN = 'MZN' - NAD = 'NAD' - NGN = 'NGN' - NIO = 'NIO' - NOK = 'NOK' - NPR = 'NPR' - NZD = 'NZD' - OMR = 'OMR' - PAB = 'PAB' - PEN = 'PEN' - PGK = 'PGK' - PHP = 'PHP' - PKR = 'PKR' - PLN = 'PLN' - PYG = 'PYG' - QAR = 'QAR' - RON = 'RON' - RSD = 'RSD' - RUB = 'RUB' - RWF = 'RWF' - SAR = 'SAR' - SBD = 'SBD' - SCR = 'SCR' - SDG = 'SDG' - SEK = 'SEK' - SGD = 'SGD' - SHP = 'SHP' - SLL = 'SLL' - SOS = 'SOS' - SRD = 'SRD' - SSP = 'SSP' - STD = 'STD' - SYP = 'SYP' - SZL = 'SZL' - THB = 'THB' - TJS = 'TJS' - TMT = 'TMT' - TND = 'TND' - TOP = 'TOP' - TRY = 'TRY' - TTD = 'TTD' - TWD = 'TWD' - TZS = 'TZS' - UAH = 'UAH' - UGX = 'UGX' - USD = 'USD' - USN = 'USN' - UYI = 'UYI' - UYU = 'UYU' - UZS = 'UZS' - VEF = 'VEF' - VND = 'VND' - VUV = 'VUV' - WST = 'WST' - XAG = 'XAG' - XAU = 'XAU' - XBA = 'XBA' - XBB = 'XBB' - XBC = 'XBC' - XBD = 'XBD' - XCD = 'XCD' - XOF = 'XOF' - XPD = 'XPD' - XPF = 'XPF' - XPT = 'XPT' - XSU = 'XSU' - XTS = 'XTS' - XUA = 'XUA' - XXX = 'XXX' - YER = 'YER' - ZAR = 'ZAR' - ZMW = 'ZMW' - ZWL = 'ZWL' + AED = "AED" + ANG = "ANG" + AUD = "AUD" + CHE = "CHE" + CHF = "CHF" + CHW = "CHW" + EUR = "EUR" + GBP = "GBP" + LBP = "LBP" + LKR = "LKR" + LRD = "LRD" + LSL = "LSL" + LYD = "LYD" + MAD = "MAD" + MDL = "MDL" + MGA = "MGA" + MKD = "MKD" + MMK = "MMK" + MNT = "MNT" + MOP = "MOP" + MRO = "MRO" + MUR = "MUR" + MVR = "MVR" + MWK = "MWK" + MXN = "MXN" + MXV = "MXV" + MYR = "MYR" + MZN = "MZN" + NAD = "NAD" + NGN = "NGN" + NIO = "NIO" + NOK = "NOK" + NPR = "NPR" + NZD = "NZD" + OMR = "OMR" + PAB = "PAB" + PEN = "PEN" + PGK = "PGK" + PHP = "PHP" + PKR = "PKR" + PLN = "PLN" + PYG = "PYG" + QAR = "QAR" + RON = "RON" + RSD = "RSD" + RUB = "RUB" + RWF = "RWF" + SAR = "SAR" + SBD = "SBD" + SCR = "SCR" + SDG = "SDG" + SEK = "SEK" + SGD = "SGD" + SHP = "SHP" + SLL = "SLL" + SOS = "SOS" + SRD = "SRD" + SSP = "SSP" + STD = "STD" + SYP = "SYP" + SZL = "SZL" + THB = "THB" + TJS = "TJS" + TMT = "TMT" + TND = "TND" + TOP = "TOP" + TRY = "TRY" + TTD = "TTD" + TWD = "TWD" + TZS = "TZS" + UAH = "UAH" + UGX = "UGX" + USD = "USD" + USN = "USN" + UYI = "UYI" + UYU = "UYU" + UZS = "UZS" + VEF = "VEF" + VND = "VND" + VUV = "VUV" + WST = "WST" + XAG = "XAG" + XAU = "XAU" + XBA = "XBA" + XBB = "XBB" + XBC = "XBC" + XBD = "XBD" + XCD = "XCD" + XOF = "XOF" + XPD = "XPD" + XPF = "XPF" + XPT = "XPT" + XSU = "XSU" + XTS = "XTS" + XUA = "XUA" + XXX = "XXX" + YER = "YER" + ZAR = "ZAR" + ZMW = "ZMW" + ZWL = "ZWL" class SessionRequestType(Enum): - RECONNECT = 'RECONNECT' - TERMINATE = 'TERMINATE' + RECONNECT = "RECONNECT" + TERMINATE = "TERMINATE" class RevokableObjects(Enum): - PEBC_PowerConstraints = 'PEBC.PowerConstraints' - PEBC_EnergyConstraint = 'PEBC.EnergyConstraint' - PEBC_Instruction = 'PEBC.Instruction' - PPBC_PowerProfileDefinition = 'PPBC.PowerProfileDefinition' - PPBC_ScheduleInstruction = 'PPBC.ScheduleInstruction' - PPBC_StartInterruptionInstruction = 'PPBC.StartInterruptionInstruction' - PPBC_EndInterruptionInstruction = 'PPBC.EndInterruptionInstruction' - OMBC_SystemDescription = 'OMBC.SystemDescription' - OMBC_Instruction = 'OMBC.Instruction' - FRBC_SystemDescription = 'FRBC.SystemDescription' - FRBC_Instruction = 'FRBC.Instruction' - DDBC_SystemDescription = 'DDBC.SystemDescription' - DDBC_Instruction = 'DDBC.Instruction' + PEBC_PowerConstraints = "PEBC.PowerConstraints" + PEBC_EnergyConstraint = "PEBC.EnergyConstraint" + PEBC_Instruction = "PEBC.Instruction" + PPBC_PowerProfileDefinition = "PPBC.PowerProfileDefinition" + PPBC_ScheduleInstruction = "PPBC.ScheduleInstruction" + PPBC_StartInterruptionInstruction = "PPBC.StartInterruptionInstruction" + PPBC_EndInterruptionInstruction = "PPBC.EndInterruptionInstruction" + OMBC_SystemDescription = "OMBC.SystemDescription" + OMBC_Instruction = "OMBC.Instruction" + FRBC_SystemDescription = "FRBC.SystemDescription" + FRBC_Instruction = "FRBC.Instruction" + DDBC_SystemDescription = "DDBC.SystemDescription" + DDBC_Instruction = "DDBC.Instruction" class EnergyManagementRole(Enum): - CEM = 'CEM' - RM = 'RM' + CEM = "CEM" + RM = "RM" class ReceptionStatusValues(Enum): - INVALID_DATA = 'INVALID_DATA' - INVALID_MESSAGE = 'INVALID_MESSAGE' - INVALID_CONTENT = 'INVALID_CONTENT' - TEMPORARY_ERROR = 'TEMPORARY_ERROR' - PERMANENT_ERROR = 'PERMANENT_ERROR' - OK = 'OK' + INVALID_DATA = "INVALID_DATA" + INVALID_MESSAGE = "INVALID_MESSAGE" + INVALID_CONTENT = "INVALID_CONTENT" + TEMPORARY_ERROR = "TEMPORARY_ERROR" + PERMANENT_ERROR = "PERMANENT_ERROR" + OK = "OK" class NumberRange(BaseModel): model_config = ConfigDict( - extra='forbid', - ) - start_of_range: float = Field( - ..., description='Number that defines the start of the range' - ) - end_of_range: float = Field( - ..., description='Number that defines the end of the range' + extra="forbid", ) + start_of_range: float = Field(..., description="Number that defines the start of the range") + end_of_range: float = Field(..., description="Number that defines the end of the range") class Transition(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) id: ID = Field( ..., - description='ID of the Transition. Must be unique in the scope of the OMBC.SystemDescription, FRBC.ActuatorDescription or DDBC.ActuatorDescription in which it is used.', + description="ID of the Transition. Must be unique in the scope of the OMBC.SystemDescription, FRBC.ActuatorDescription or DDBC.ActuatorDescription in which it is used.", ) from_: ID = Field( ..., - alias='from', - description='ID of the OperationMode (exact type differs per ControlType) that should be switched from.', + alias="from", + description="ID of the OperationMode (exact type differs per ControlType) that should be switched from.", ) to: ID = Field( ..., - description='ID of the OperationMode (exact type differs per ControlType) that will be switched to.', + description="ID of the OperationMode (exact type differs per ControlType) that will be switched to.", ) start_timers: List[ID] = Field( ..., - description='List of IDs of Timers that will be (re)started when this transition is initiated', + description="List of IDs of Timers that will be (re)started when this transition is initiated", max_length=1000, min_length=0, ) blocking_timers: List[ID] = Field( ..., - description='List of IDs of Timers that block this Transition from initiating while at least one of these Timers is not yet finished', + description="List of IDs of Timers that block this Transition from initiating while at least one of these Timers is not yet finished", max_length=1000, min_length=0, ) transition_costs: Optional[float] = Field( None, - description='Absolute costs for going through this Transition in the currency as described in the ResourceManagerDetails.', + description="Absolute costs for going through this Transition in the currency as described in the ResourceManagerDetails.", ) transition_duration: Optional[Duration] = Field( None, - description='Indicates the time between the initiation of this Transition, and the time at which the device behaves according to the Operation Mode which is defined in the ‘to’ data element. When no value is provided it is assumed the transition duration is negligible.', + description="Indicates the time between the initiation of this Transition, and the time at which the device behaves according to the Operation Mode which is defined in the ‘to’ data element. When no value is provided it is assumed the transition duration is negligible.", ) abnormal_condition_only: bool = Field( ..., - description='Indicates if this Transition may only be used during an abnormal condition (see Clause )', + description="Indicates if this Transition may only be used during an abnormal condition (see Clause )", ) class Timer(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) id: ID = Field( ..., - description='ID of the Timer. Must be unique in the scope of the OMBC.SystemDescription, FRBC.ActuatorDescription or DDBC.ActuatorDescription in which it is used.', + description="ID of the Timer. Must be unique in the scope of the OMBC.SystemDescription, FRBC.ActuatorDescription or DDBC.ActuatorDescription in which it is used.", ) diagnostic_label: Optional[str] = Field( None, - description='Human readable name/description of the Timer. This element is only intended for diagnostic purposes and not for HMI applications.', + description="Human readable name/description of the Timer. This element is only intended for diagnostic purposes and not for HMI applications.", ) duration: Duration = Field( ..., - description='The time it takes for the Timer to finish after it has been started', + description="The time it takes for the Timer to finish after it has been started", ) class PEBCPowerEnvelopeElement(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - duration: Duration = Field(..., description='The duration of the element') + duration: Duration = Field(..., description="The duration of the element") upper_limit: float = Field( ..., - description='Upper power limit according to the commodity_quantity of the containing PEBC.PowerEnvelope. The lower_limit must be smaller or equal to the upper_limit. The Resource Manager is requested to keep the power values for the given commodity quantity equal to or below the upper_limit. The upper_limit shall be in accordance with the constraints provided by the Resource Manager through any PEBC.AllowedLimitRange with limit_type UPPER_LIMIT.', + description="Upper power limit according to the commodity_quantity of the containing PEBC.PowerEnvelope. The lower_limit must be smaller or equal to the upper_limit. The Resource Manager is requested to keep the power values for the given commodity quantity equal to or below the upper_limit. The upper_limit shall be in accordance with the constraints provided by the Resource Manager through any PEBC.AllowedLimitRange with limit_type UPPER_LIMIT.", ) lower_limit: float = Field( ..., - description='Lower power limit according to the commodity_quantity of the containing PEBC.PowerEnvelope. The lower_limit must be smaller or equal to the upper_limit. The Resource Manager is requested to keep the power values for the given commodity quantity equal to or above the lower_limit. The lower_limit shall be in accordance with the constraints provided by the Resource Manager through any PEBC.AllowedLimitRange with limit_type LOWER_LIMIT.', + description="Lower power limit according to the commodity_quantity of the containing PEBC.PowerEnvelope. The lower_limit must be smaller or equal to the upper_limit. The Resource Manager is requested to keep the power values for the given commodity quantity equal to or above the lower_limit. The lower_limit shall be in accordance with the constraints provided by the Resource Manager through any PEBC.AllowedLimitRange with limit_type LOWER_LIMIT.", ) class FRBCStorageDescription(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) diagnostic_label: Optional[str] = Field( None, - description='Human readable name/description of the storage (e.g. hot water buffer or battery). This element is only intended for diagnostic purposes and not for HMI applications.', + description="Human readable name/description of the storage (e.g. hot water buffer or battery). This element is only intended for diagnostic purposes and not for HMI applications.", ) fill_level_label: Optional[str] = Field( None, - description='Human readable description of the (physical) units associated with the fill_level (e.g. degrees Celsius or percentage state of charge). This element is only intended for diagnostic purposes and not for HMI applications.', + description="Human readable description of the (physical) units associated with the fill_level (e.g. degrees Celsius or percentage state of charge). This element is only intended for diagnostic purposes and not for HMI applications.", ) provides_leakage_behaviour: bool = Field( ..., - description='Indicates whether the Storage could provide details of power leakage behaviour through the FRBC.LeakageBehaviour.', + description="Indicates whether the Storage could provide details of power leakage behaviour through the FRBC.LeakageBehaviour.", ) provides_fill_level_target_profile: bool = Field( ..., - description='Indicates whether the Storage could provide a target profile for the fill level through the FRBC.FillLevelTargetProfile.', + description="Indicates whether the Storage could provide a target profile for the fill level through the FRBC.FillLevelTargetProfile.", ) provides_usage_forecast: bool = Field( ..., - description='Indicates whether the Storage could provide a UsageForecast through the FRBC.UsageForecast.', + description="Indicates whether the Storage could provide a UsageForecast through the FRBC.UsageForecast.", ) fill_level_range: NumberRange = Field( ..., - description='The range in which the fill_level should remain. It is expected of the CEM to keep the fill_level within this range. When the fill_level is not within this range, the Resource Manager can ignore instructions from the CEM (except during abnormal conditions). ', + description="The range in which the fill_level should remain. It is expected of the CEM to keep the fill_level within this range. When the fill_level is not within this range, the Resource Manager can ignore instructions from the CEM (except during abnormal conditions). ", ) class FRBCLeakageBehaviourElement(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) fill_level_range: NumberRange = Field( ..., - description='The fill level range for which this FRBC.LeakageBehaviourElement applies. The start of the range must be less than the end of the range.', + description="The fill level range for which this FRBC.LeakageBehaviourElement applies. The start of the range must be less than the end of the range.", ) leakage_rate: float = Field( ..., - description='Indicates how fast the momentary fill level will decrease per second due to leakage within the given range of the fill level. A positive value indicates that the fill level decreases over time due to leakage.', + description="Indicates how fast the momentary fill level will decrease per second due to leakage within the given range of the fill level. A positive value indicates that the fill level decreases over time due to leakage.", ) class FRBCUsageForecastElement(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) duration: Duration = Field( - ..., description='Indicator for how long the given usage_rate is valid.' + ..., description="Indicator for how long the given usage_rate is valid." ) usage_rate_upper_limit: Optional[float] = Field( None, - description='The upper limit of the range with a 100 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.', + description="The upper limit of the range with a 100 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.", ) usage_rate_upper_95PPR: Optional[float] = Field( None, - description='The upper limit of the range with a 95 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.', + description="The upper limit of the range with a 95 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.", ) usage_rate_upper_68PPR: Optional[float] = Field( None, - description='The upper limit of the range with a 68 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.', + description="The upper limit of the range with a 68 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.", ) usage_rate_expected: float = Field( ..., - description='The most likely value for the usage rate; the expected increase or decrease of the fill_level per second. A positive value indicates that the fill level will decrease due to usage.', + description="The most likely value for the usage rate; the expected increase or decrease of the fill_level per second. A positive value indicates that the fill level will decrease due to usage.", ) usage_rate_lower_68PPR: Optional[float] = Field( None, - description='The lower limit of the range with a 68 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.', + description="The lower limit of the range with a 68 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.", ) usage_rate_lower_95PPR: Optional[float] = Field( None, - description='The lower limit of the range with a 95 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.', + description="The lower limit of the range with a 95 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.", ) usage_rate_lower_limit: Optional[float] = Field( None, - description='The lower limit of the range with a 100 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.', + description="The lower limit of the range with a 100 % probability that the usage rate is within that range. A positive value indicates that the fill level will decrease due to usage.", ) class FRBCFillLevelTargetProfileElement(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - duration: Duration = Field(..., description='The duration of the element.') + duration: Duration = Field(..., description="The duration of the element.") fill_level_range: NumberRange = Field( ..., - description='The target range in which the fill_level must be for the time period during which the element is active. The start of the range must be smaller or equal to the end of the range. The CEM must take best-effort actions to proactively achieve this target.', + description="The target range in which the fill_level must be for the time period during which the element is active. The start of the range must be smaller or equal to the end of the range. The CEM must take best-effort actions to proactively achieve this target.", ) class DDBCAverageDemandRateForecastElement(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - duration: Duration = Field(..., description='Duration of the element') + duration: Duration = Field(..., description="Duration of the element") demand_rate_upper_limit: Optional[float] = Field( None, - description='The upper limit of the range with a 100 % probability that the demand rate is within that range', + description="The upper limit of the range with a 100 % probability that the demand rate is within that range", ) demand_rate_upper_95PPR: Optional[float] = Field( None, - description='The upper limit of the range with a 95 % probability that the demand rate is within that range', + description="The upper limit of the range with a 95 % probability that the demand rate is within that range", ) demand_rate_upper_68PPR: Optional[float] = Field( None, - description='The upper limit of the range with a 68 % probability that the demand rate is within that range', + description="The upper limit of the range with a 68 % probability that the demand rate is within that range", ) demand_rate_expected: float = Field( ..., - description='The most likely value for the demand rate; the expected increase or decrease of the fill_level per second', + description="The most likely value for the demand rate; the expected increase or decrease of the fill_level per second", ) demand_rate_lower_68PPR: Optional[float] = Field( None, - description='The lower limit of the range with a 68 % probability that the demand rate is within that range', + description="The lower limit of the range with a 68 % probability that the demand rate is within that range", ) demand_rate_lower_95PPR: Optional[float] = Field( None, - description='The lower limit of the range with a 95 % probability that the demand rate is within that range', + description="The lower limit of the range with a 95 % probability that the demand rate is within that range", ) demand_rate_lower_limit: Optional[float] = Field( None, - description='The lower limit of the range with a 100 % probability that the demand rate is within that range', + description="The lower limit of the range with a 100 % probability that the demand rate is within that range", ) class RoleType(Enum): - ENERGY_PRODUCER = 'ENERGY_PRODUCER' - ENERGY_CONSUMER = 'ENERGY_CONSUMER' - ENERGY_STORAGE = 'ENERGY_STORAGE' + ENERGY_PRODUCER = "ENERGY_PRODUCER" + ENERGY_CONSUMER = "ENERGY_CONSUMER" + ENERGY_STORAGE = "ENERGY_STORAGE" class Commodity(Enum): - GAS = 'GAS' - HEAT = 'HEAT' - ELECTRICITY = 'ELECTRICITY' - OIL = 'OIL' + GAS = "GAS" + HEAT = "HEAT" + ELECTRICITY = "ELECTRICITY" + OIL = "OIL" class CommodityQuantity(Enum): - ELECTRIC_POWER_L1 = 'ELECTRIC.POWER.L1' - ELECTRIC_POWER_L2 = 'ELECTRIC.POWER.L2' - ELECTRIC_POWER_L3 = 'ELECTRIC.POWER.L3' - ELECTRIC_POWER_3_PHASE_SYMMETRIC = 'ELECTRIC.POWER.3_PHASE_SYMMETRIC' - NATURAL_GAS_FLOW_RATE = 'NATURAL_GAS.FLOW_RATE' - HYDROGEN_FLOW_RATE = 'HYDROGEN.FLOW_RATE' - HEAT_TEMPERATURE = 'HEAT.TEMPERATURE' - HEAT_FLOW_RATE = 'HEAT.FLOW_RATE' - HEAT_THERMAL_POWER = 'HEAT.THERMAL_POWER' - OIL_FLOW_RATE = 'OIL.FLOW_RATE' + ELECTRIC_POWER_L1 = "ELECTRIC.POWER.L1" + ELECTRIC_POWER_L2 = "ELECTRIC.POWER.L2" + ELECTRIC_POWER_L3 = "ELECTRIC.POWER.L3" + ELECTRIC_POWER_3_PHASE_SYMMETRIC = "ELECTRIC.POWER.3_PHASE_SYMMETRIC" + NATURAL_GAS_FLOW_RATE = "NATURAL_GAS.FLOW_RATE" + HYDROGEN_FLOW_RATE = "HYDROGEN.FLOW_RATE" + HEAT_TEMPERATURE = "HEAT.TEMPERATURE" + HEAT_FLOW_RATE = "HEAT.FLOW_RATE" + HEAT_THERMAL_POWER = "HEAT.THERMAL_POWER" + OIL_FLOW_RATE = "OIL.FLOW_RATE" class InstructionStatus(Enum): - NEW = 'NEW' - ACCEPTED = 'ACCEPTED' - REJECTED = 'REJECTED' - REVOKED = 'REVOKED' - STARTED = 'STARTED' - SUCCEEDED = 'SUCCEEDED' - ABORTED = 'ABORTED' + NEW = "NEW" + ACCEPTED = "ACCEPTED" + REJECTED = "REJECTED" + REVOKED = "REVOKED" + STARTED = "STARTED" + SUCCEEDED = "SUCCEEDED" + ABORTED = "ABORTED" class ControlType(Enum): - POWER_ENVELOPE_BASED_CONTROL = 'POWER_ENVELOPE_BASED_CONTROL' - POWER_PROFILE_BASED_CONTROL = 'POWER_PROFILE_BASED_CONTROL' - OPERATION_MODE_BASED_CONTROL = 'OPERATION_MODE_BASED_CONTROL' - FILL_RATE_BASED_CONTROL = 'FILL_RATE_BASED_CONTROL' - DEMAND_DRIVEN_BASED_CONTROL = 'DEMAND_DRIVEN_BASED_CONTROL' - NOT_CONTROLABLE = 'NOT_CONTROLABLE' - NO_SELECTION = 'NO_SELECTION' + POWER_ENVELOPE_BASED_CONTROL = "POWER_ENVELOPE_BASED_CONTROL" + POWER_PROFILE_BASED_CONTROL = "POWER_PROFILE_BASED_CONTROL" + OPERATION_MODE_BASED_CONTROL = "OPERATION_MODE_BASED_CONTROL" + FILL_RATE_BASED_CONTROL = "FILL_RATE_BASED_CONTROL" + DEMAND_DRIVEN_BASED_CONTROL = "DEMAND_DRIVEN_BASED_CONTROL" + NOT_CONTROLABLE = "NOT_CONTROLABLE" + NO_SELECTION = "NO_SELECTION" class PEBCPowerEnvelopeLimitType(Enum): - UPPER_LIMIT = 'UPPER_LIMIT' - LOWER_LIMIT = 'LOWER_LIMIT' + UPPER_LIMIT = "UPPER_LIMIT" + LOWER_LIMIT = "LOWER_LIMIT" class PEBCPowerEnvelopeConsequenceType(Enum): - VANISH = 'VANISH' - DEFER = 'DEFER' + VANISH = "VANISH" + DEFER = "DEFER" class PPBCPowerSequenceStatus(Enum): - NOT_SCHEDULED = 'NOT_SCHEDULED' - SCHEDULED = 'SCHEDULED' - EXECUTING = 'EXECUTING' - INTERRUPTED = 'INTERRUPTED' - FINISHED = 'FINISHED' - ABORTED = 'ABORTED' + NOT_SCHEDULED = "NOT_SCHEDULED" + SCHEDULED = "SCHEDULED" + EXECUTING = "EXECUTING" + INTERRUPTED = "INTERRUPTED" + FINISHED = "FINISHED" + ABORTED = "ABORTED" class OMBCTimerStatus(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['OMBC.TimerStatus'] = 'OMBC.TimerStatus' + message_type: Literal["OMBC.TimerStatus"] = "OMBC.TimerStatus" message_id: ID - timer_id: ID = Field(..., description='The ID of the timer this message refers to') + timer_id: ID = Field(..., description="The ID of the timer this message refers to") finished_at: AwareDatetime = Field( ..., - description='Indicates when the Timer will be finished. If the DateTimeStamp is in the future, the timer is not yet finished. If the DateTimeStamp is in the past, the timer is finished. If the timer was never started, the value can be an arbitrary DateTimeStamp in the past.', + description="Indicates when the Timer will be finished. If the DateTimeStamp is in the future, the timer is not yet finished. If the DateTimeStamp is in the past, the timer is finished. If the timer was never started, the value can be an arbitrary DateTimeStamp in the past.", ) class FRBCTimerStatus(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['FRBC.TimerStatus'] = 'FRBC.TimerStatus' + message_type: Literal["FRBC.TimerStatus"] = "FRBC.TimerStatus" message_id: ID - timer_id: ID = Field(..., description='The ID of the timer this message refers to') - actuator_id: ID = Field( - ..., description='The ID of the actuator the timer belongs to' - ) + timer_id: ID = Field(..., description="The ID of the timer this message refers to") + actuator_id: ID = Field(..., description="The ID of the actuator the timer belongs to") finished_at: AwareDatetime = Field( ..., - description='Indicates when the Timer will be finished. If the DateTimeStamp is in the future, the timer is not yet finished. If the DateTimeStamp is in the past, the timer is finished. If the timer was never started, the value can be an arbitrary DateTimeStamp in the past.', + description="Indicates when the Timer will be finished. If the DateTimeStamp is in the future, the timer is not yet finished. If the DateTimeStamp is in the past, the timer is finished. If the timer was never started, the value can be an arbitrary DateTimeStamp in the past.", ) class DDBCTimerStatus(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['DDBC.TimerStatus'] = 'DDBC.TimerStatus' + message_type: Literal["DDBC.TimerStatus"] = "DDBC.TimerStatus" message_id: ID - timer_id: ID = Field(..., description='The ID of the timer this message refers to') - actuator_id: ID = Field( - ..., description='The ID of the actuator the timer belongs to' - ) + timer_id: ID = Field(..., description="The ID of the timer this message refers to") + actuator_id: ID = Field(..., description="The ID of the actuator the timer belongs to") finished_at: AwareDatetime = Field( ..., - description='Indicates when the Timer will be finished. If the DateTimeStamp is in the future, the timer is not yet finished. If the DateTimeStamp is in the past, the timer is finished. If the timer was never started, the value can be an arbitrary DateTimeStamp in the past.', + description="Indicates when the Timer will be finished. If the DateTimeStamp is in the future, the timer is not yet finished. If the DateTimeStamp is in the past, the timer is finished. If the timer was never started, the value can be an arbitrary DateTimeStamp in the past.", ) class SelectControlType(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['SelectControlType'] = 'SelectControlType' + message_type: Literal["SelectControlType"] = "SelectControlType" message_id: ID control_type: ControlType = Field( ..., - description='The ControlType to activate. Must be one of the available ControlTypes as defined in the ResourceManagerDetails', + description="The ControlType to activate. Must be one of the available ControlTypes as defined in the ResourceManagerDetails", ) class SessionRequest(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['SessionRequest'] = 'SessionRequest' + message_type: Literal["SessionRequest"] = "SessionRequest" message_id: ID - request: SessionRequestType = Field(..., description='The type of request') + request: SessionRequestType = Field(..., description="The type of request") diagnostic_label: Optional[str] = Field( None, - description='Optional field for a human readible descirption for debugging purposes', + description="Optional field for a human readible descirption for debugging purposes", ) class RevokeObject(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['RevokeObject'] = 'RevokeObject' + message_type: Literal["RevokeObject"] = "RevokeObject" message_id: ID object_type: RevokableObjects = Field( - ..., description='The type of object that needs to be revoked' + ..., description="The type of object that needs to be revoked" ) - object_id: ID = Field(..., description='The ID of object that needs to be revoked') + object_id: ID = Field(..., description="The ID of object that needs to be revoked") class Handshake(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['Handshake'] = 'Handshake' + message_type: Literal["Handshake"] = "Handshake" message_id: ID - role: EnergyManagementRole = Field( - ..., description='The role of the sender of this message' - ) + role: EnergyManagementRole = Field(..., description="The role of the sender of this message") supported_protocol_versions: Optional[List[str]] = Field( None, - description='Protocol versions supported by the sender of this message. This field is mandatory for the RM, but optional for the CEM.', + description="Protocol versions supported by the sender of this message. This field is mandatory for the RM, but optional for the CEM.", min_length=1, ) class HandshakeResponse(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['HandshakeResponse'] = 'HandshakeResponse' + message_type: Literal["HandshakeResponse"] = "HandshakeResponse" message_id: ID selected_protocol_version: str = Field( - ..., description='The protocol version the CEM selected for this session' + ..., description="The protocol version the CEM selected for this session" ) class ReceptionStatus(BaseModel): model_config = ConfigDict( - extra='forbid', - ) - message_type: Literal['ReceptionStatus'] = 'ReceptionStatus' - subject_message_id: ID = Field( - ..., description='The message this ReceptionStatus refers to' - ) - status: ReceptionStatusValues = Field( - ..., description='Enumeration of status values' + extra="forbid", ) + message_type: Literal["ReceptionStatus"] = "ReceptionStatus" + subject_message_id: ID = Field(..., description="The message this ReceptionStatus refers to") + status: ReceptionStatusValues = Field(..., description="Enumeration of status values") diagnostic_label: Optional[str] = Field( None, - description='Diagnostic label that can be used to provide additional information for debugging. However, not for HMI purposes.', + description="Diagnostic label that can be used to provide additional information for debugging. However, not for HMI purposes.", ) class InstructionStatusUpdate(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['InstructionStatusUpdate'] = 'InstructionStatusUpdate' + message_type: Literal["InstructionStatusUpdate"] = "InstructionStatusUpdate" message_id: ID - instruction_id: ID = Field( - ..., description='ID of this instruction (as provided by the CEM) ' - ) - status_type: InstructionStatus = Field( - ..., description='Present status of this instruction.' - ) + instruction_id: ID = Field(..., description="ID of this instruction (as provided by the CEM) ") + status_type: InstructionStatus = Field(..., description="Present status of this instruction.") timestamp: AwareDatetime = Field( - ..., description='Timestamp when status_type has changed the last time.' + ..., description="Timestamp when status_type has changed the last time." ) class PEBCEnergyConstraint(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['PEBC.EnergyConstraint'] = 'PEBC.EnergyConstraint' + message_type: Literal["PEBC.EnergyConstraint"] = "PEBC.EnergyConstraint" message_id: ID id: ID = Field( ..., - description='Identifier of this PEBC.EnergyConstraints. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="Identifier of this PEBC.EnergyConstraints. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) valid_from: AwareDatetime = Field( ..., - description='Moment this PEBC.EnergyConstraints information starts to be valid', + description="Moment this PEBC.EnergyConstraints information starts to be valid", ) valid_until: AwareDatetime = Field( ..., - description='Moment until this PEBC.EnergyConstraints information is valid.', + description="Moment until this PEBC.EnergyConstraints information is valid.", ) upper_average_power: float = Field( ..., - description='Upper average power within the time period given by valid_from and valid_until. If the duration is multiplied with this power value, then the associated upper energy content can be derived. This is the highest amount of energy the resource will consume during that period of time. The Power Envelope created by the CEM must allow at least this much energy consumption (in case the number is positive). Must be greater than or equal to lower_average_power, and can be negative in case of energy production.', + description="Upper average power within the time period given by valid_from and valid_until. If the duration is multiplied with this power value, then the associated upper energy content can be derived. This is the highest amount of energy the resource will consume during that period of time. The Power Envelope created by the CEM must allow at least this much energy consumption (in case the number is positive). Must be greater than or equal to lower_average_power, and can be negative in case of energy production.", ) lower_average_power: float = Field( ..., - description='Lower average power within the time period given by valid_from and valid_until. If the duration is multiplied with this power value, then the associated lower energy content can be derived. This is the lowest amount of energy the resource will consume during that period of time. The Power Envelope created by the CEM must allow at least this much energy production (in case the number is negative). Must be greater than or equal to lower_average_power, and can be negative in case of energy production.', + description="Lower average power within the time period given by valid_from and valid_until. If the duration is multiplied with this power value, then the associated lower energy content can be derived. This is the lowest amount of energy the resource will consume during that period of time. The Power Envelope created by the CEM must allow at least this much energy production (in case the number is negative). Must be greater than or equal to lower_average_power, and can be negative in case of energy production.", ) commodity_quantity: CommodityQuantity = Field( ..., - description='Type of power quantity which applies to upper_average_power and lower_average_power', + description="Type of power quantity which applies to upper_average_power and lower_average_power", ) class PPBCScheduleInstruction(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['PPBC.ScheduleInstruction'] = 'PPBC.ScheduleInstruction' + message_type: Literal["PPBC.ScheduleInstruction"] = "PPBC.ScheduleInstruction" message_id: ID id: ID = Field( ..., - description='ID of the Instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="ID of the Instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) power_profile_id: ID = Field( ..., - description='ID of the PPBC.PowerProfileDefinition of which the PPBC.PowerSequence is being selected and scheduled by the CEM.', + description="ID of the PPBC.PowerProfileDefinition of which the PPBC.PowerSequence is being selected and scheduled by the CEM.", ) sequence_container_id: ID = Field( ..., - description='ID of the PPBC.PowerSequnceContainer of which the PPBC.PowerSequence is being selected and scheduled by the CEM.', + description="ID of the PPBC.PowerSequnceContainer of which the PPBC.PowerSequence is being selected and scheduled by the CEM.", ) power_sequence_id: ID = Field( ..., - description='ID of the PPBC.PowerSequence that is being selected and scheduled by the CEM.', + description="ID of the PPBC.PowerSequence that is being selected and scheduled by the CEM.", ) execution_time: AwareDatetime = Field( ..., - description='Indicates the moment the PPBC.PowerSequence shall start. When the specified execution time is in the past, execution must start as soon as possible.', + description="Indicates the moment the PPBC.PowerSequence shall start. When the specified execution time is in the past, execution must start as soon as possible.", ) abnormal_condition: bool = Field( ..., - description='Indicates if this is an instruction during an abnormal condition', + description="Indicates if this is an instruction during an abnormal condition", ) class PPBCStartInterruptionInstruction(BaseModel): model_config = ConfigDict( - extra='forbid', - ) - message_type: Literal['PPBC.StartInterruptionInstruction'] = ( - 'PPBC.StartInterruptionInstruction' + extra="forbid", ) + message_type: Literal["PPBC.StartInterruptionInstruction"] = "PPBC.StartInterruptionInstruction" message_id: ID id: ID = Field( ..., - description='ID of the Instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="ID of the Instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) power_profile_id: ID = Field( ..., - description='ID of the PPBC.PowerProfileDefinition of which the PPBC.PowerSequence is being interrupted by the CEM.', + description="ID of the PPBC.PowerProfileDefinition of which the PPBC.PowerSequence is being interrupted by the CEM.", ) sequence_container_id: ID = Field( ..., - description='ID of the PPBC.PowerSequnceContainer of which the PPBC.PowerSequence is being interrupted by the CEM.', + description="ID of the PPBC.PowerSequnceContainer of which the PPBC.PowerSequence is being interrupted by the CEM.", ) power_sequence_id: ID = Field( - ..., description='ID of the PPBC.PowerSequence that the CEM wants to interrupt.' + ..., description="ID of the PPBC.PowerSequence that the CEM wants to interrupt." ) execution_time: AwareDatetime = Field( ..., - description='Indicates the moment the PPBC.PowerSequence shall be interrupted. When the specified execution time is in the past, execution must start as soon as possible.', + description="Indicates the moment the PPBC.PowerSequence shall be interrupted. When the specified execution time is in the past, execution must start as soon as possible.", ) abnormal_condition: bool = Field( ..., - description='Indicates if this is an instruction during an abnormal condition', + description="Indicates if this is an instruction during an abnormal condition", ) class PPBCEndInterruptionInstruction(BaseModel): model_config = ConfigDict( - extra='forbid', - ) - message_type: Literal['PPBC.EndInterruptionInstruction'] = ( - 'PPBC.EndInterruptionInstruction' + extra="forbid", ) + message_type: Literal["PPBC.EndInterruptionInstruction"] = "PPBC.EndInterruptionInstruction" message_id: ID id: ID = Field( ..., - description='ID of the Instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="ID of the Instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) power_profile_id: ID = Field( ..., - description='ID of the PPBC.PowerProfileDefinition of which the PPBC.PowerSequence interruption is being ended by the CEM.', + description="ID of the PPBC.PowerProfileDefinition of which the PPBC.PowerSequence interruption is being ended by the CEM.", ) sequence_container_id: ID = Field( ..., - description='ID of the PPBC.PowerSequnceContainer of which the PPBC.PowerSequence interruption is being ended by the CEM.', + description="ID of the PPBC.PowerSequnceContainer of which the PPBC.PowerSequence interruption is being ended by the CEM.", ) power_sequence_id: ID = Field( ..., - description='ID of the PPBC.PowerSequence for which the CEM wants to end the interruption.', + description="ID of the PPBC.PowerSequence for which the CEM wants to end the interruption.", ) execution_time: AwareDatetime = Field( ..., - description='Indicates the moment PPBC.PowerSequence interruption shall end. When the specified execution time is in the past, execution must start as soon as possible.', + description="Indicates the moment PPBC.PowerSequence interruption shall end. When the specified execution time is in the past, execution must start as soon as possible.", ) abnormal_condition: bool = Field( ..., - description='Indicates if this is an instruction during an abnormal condition', + description="Indicates if this is an instruction during an abnormal condition", ) class OMBCStatus(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['OMBC.Status'] = 'OMBC.Status' + message_type: Literal["OMBC.Status"] = "OMBC.Status" message_id: ID - active_operation_mode_id: ID = Field( - ..., description='ID of the active OMBC.OperationMode.' - ) + active_operation_mode_id: ID = Field(..., description="ID of the active OMBC.OperationMode.") operation_mode_factor: float = Field( ..., - description='The number indicates the factor with which the OMBC.OperationMode should be configured. The factor should be greater than or equal than 0 and less or equal to 1.', + description="The number indicates the factor with which the OMBC.OperationMode should be configured. The factor should be greater than or equal than 0 and less or equal to 1.", ) previous_operation_mode_id: Optional[ID] = Field( None, - description='ID of the OMBC.OperationMode that was previously active. This value shall always be provided, unless the active OMBC.OperationMode is the first OMBC.OperationMode the Resource Manager is aware of.', + description="ID of the OMBC.OperationMode that was previously active. This value shall always be provided, unless the active OMBC.OperationMode is the first OMBC.OperationMode the Resource Manager is aware of.", ) transition_timestamp: Optional[AwareDatetime] = Field( None, - description='Time at which the transition from the previous OMBC.OperationMode to the active OMBC.OperationMode was initiated. This value shall always be provided, unless the active OMBC.OperationMode is the first OMBC.OperationMode the Resource Manager is aware of.', + description="Time at which the transition from the previous OMBC.OperationMode to the active OMBC.OperationMode was initiated. This value shall always be provided, unless the active OMBC.OperationMode is the first OMBC.OperationMode the Resource Manager is aware of.", ) class OMBCInstruction(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['OMBC.Instruction'] = 'OMBC.Instruction' + message_type: Literal["OMBC.Instruction"] = "OMBC.Instruction" message_id: ID id: ID = Field( ..., - description='ID of the instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="ID of the instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) execution_time: AwareDatetime = Field( ..., - description='Indicates the moment the execution of the instruction shall start. When the specified execution time is in the past, execution must start as soon as possible.', + description="Indicates the moment the execution of the instruction shall start. When the specified execution time is in the past, execution must start as soon as possible.", ) operation_mode_id: ID = Field( - ..., description='ID of the OMBC.OperationMode that should be activated' + ..., description="ID of the OMBC.OperationMode that should be activated" ) operation_mode_factor: float = Field( ..., - description='The number indicates the factor with which the OMBC.OperationMode should be configured. The factor should be greater than or equal than 0 and less or equal to 1.', + description="The number indicates the factor with which the OMBC.OperationMode should be configured. The factor should be greater than or equal than 0 and less or equal to 1.", ) abnormal_condition: bool = Field( ..., - description='Indicates if this is an instruction during an abnormal condition', + description="Indicates if this is an instruction during an abnormal condition", ) class FRBCActuatorStatus(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['FRBC.ActuatorStatus'] = 'FRBC.ActuatorStatus' + message_type: Literal["FRBC.ActuatorStatus"] = "FRBC.ActuatorStatus" message_id: ID - actuator_id: ID = Field( - ..., description='ID of the actuator this messages refers to' - ) + actuator_id: ID = Field(..., description="ID of the actuator this messages refers to") active_operation_mode_id: ID = Field( - ..., description='ID of the FRBC.OperationMode that is presently active.' + ..., description="ID of the FRBC.OperationMode that is presently active." ) operation_mode_factor: float = Field( ..., - description='The number indicates the factor with which the FRBC.OperationMode is configured. The factor should be greater than or equal than 0 and less or equal to 1.', + description="The number indicates the factor with which the FRBC.OperationMode is configured. The factor should be greater than or equal than 0 and less or equal to 1.", ) previous_operation_mode_id: Optional[ID] = Field( None, - description='ID of the FRBC.OperationMode that was active before the present one. This value shall always be provided, unless the active FRBC.OperationMode is the first FRBC.OperationMode the Resource Manager is aware of.', + description="ID of the FRBC.OperationMode that was active before the present one. This value shall always be provided, unless the active FRBC.OperationMode is the first FRBC.OperationMode the Resource Manager is aware of.", ) transition_timestamp: Optional[AwareDatetime] = Field( None, - description='Time at which the transition from the previous FRBC.OperationMode to the active FRBC.OperationMode was initiated. This value shall always be provided, unless the active FRBC.OperationMode is the first FRBC.OperationMode the Resource Manager is aware of.', + description="Time at which the transition from the previous FRBC.OperationMode to the active FRBC.OperationMode was initiated. This value shall always be provided, unless the active FRBC.OperationMode is the first FRBC.OperationMode the Resource Manager is aware of.", ) class FRBCStorageStatus(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['FRBC.StorageStatus'] = 'FRBC.StorageStatus' + message_type: Literal["FRBC.StorageStatus"] = "FRBC.StorageStatus" message_id: ID - present_fill_level: float = Field( - ..., description='Present fill level of the Storage' - ) + present_fill_level: float = Field(..., description="Present fill level of the Storage") class FRBCLeakageBehaviour(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['FRBC.LeakageBehaviour'] = 'FRBC.LeakageBehaviour' + message_type: Literal["FRBC.LeakageBehaviour"] = "FRBC.LeakageBehaviour" message_id: ID valid_from: AwareDatetime = Field( ..., - description='Moment this FRBC.LeakageBehaviour starts to be valid. If the FRBC.LeakageBehaviour is immediately valid, the DateTimeStamp should be now or in the past.', + description="Moment this FRBC.LeakageBehaviour starts to be valid. If the FRBC.LeakageBehaviour is immediately valid, the DateTimeStamp should be now or in the past.", ) elements: List[FRBCLeakageBehaviourElement] = Field( ..., - description='List of elements that model the leakage behaviour of the buffer. The fill_level_ranges of the elements must be contiguous.', + description="List of elements that model the leakage behaviour of the buffer. The fill_level_ranges of the elements must be contiguous.", max_length=288, min_length=1, ) @@ -826,46 +802,44 @@ class FRBCLeakageBehaviour(BaseModel): class FRBCInstruction(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['FRBC.Instruction'] = 'FRBC.Instruction' + message_type: Literal["FRBC.Instruction"] = "FRBC.Instruction" message_id: ID id: ID = Field( ..., - description='ID of the instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', - ) - actuator_id: ID = Field( - ..., description='ID of the actuator this instruction belongs to.' + description="ID of the instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) + actuator_id: ID = Field(..., description="ID of the actuator this instruction belongs to.") operation_mode: ID = Field( - ..., description='ID of the FRBC.OperationMode that should be activated.' + ..., description="ID of the FRBC.OperationMode that should be activated." ) operation_mode_factor: float = Field( ..., - description='The number indicates the factor with which the FRBC.OperationMode should be configured. The factor should be greater than or equal to 0 and less or equal to 1.', + description="The number indicates the factor with which the FRBC.OperationMode should be configured. The factor should be greater than or equal to 0 and less or equal to 1.", ) execution_time: AwareDatetime = Field( ..., - description='Indicates the moment the execution of the instruction shall start. When the specified execution time is in the past, execution must start as soon as possible.', + description="Indicates the moment the execution of the instruction shall start. When the specified execution time is in the past, execution must start as soon as possible.", ) abnormal_condition: bool = Field( ..., - description='Indicates if this is an instruction during an abnormal condition.', + description="Indicates if this is an instruction during an abnormal condition.", ) class FRBCUsageForecast(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['FRBC.UsageForecast'] = 'FRBC.UsageForecast' + message_type: Literal["FRBC.UsageForecast"] = "FRBC.UsageForecast" message_id: ID start_time: AwareDatetime = Field( - ..., description='Time at which the FRBC.UsageForecast starts.' + ..., description="Time at which the FRBC.UsageForecast starts." ) elements: List[FRBCUsageForecastElement] = Field( ..., - description='Further elements that model the profile. There shall be at least one element. Elements must be placed in chronological order.', + description="Further elements that model the profile. There shall be at least one element. Elements must be placed in chronological order.", max_length=288, min_length=1, ) @@ -873,16 +847,16 @@ class FRBCUsageForecast(BaseModel): class FRBCFillLevelTargetProfile(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['FRBC.FillLevelTargetProfile'] = 'FRBC.FillLevelTargetProfile' + message_type: Literal["FRBC.FillLevelTargetProfile"] = "FRBC.FillLevelTargetProfile" message_id: ID start_time: AwareDatetime = Field( - ..., description='Time at which the FRBC.FillLevelTargetProfile starts.' + ..., description="Time at which the FRBC.FillLevelTargetProfile starts." ) elements: List[FRBCFillLevelTargetProfileElement] = Field( ..., - description='List of different fill levels that have to be targeted within a given duration. There shall be at least one element. Elements must be placed in chronological order.', + description="List of different fill levels that have to be targeted within a given duration. There shall be at least one element. Elements must be placed in chronological order.", max_length=288, min_length=1, ) @@ -890,71 +864,65 @@ class FRBCFillLevelTargetProfile(BaseModel): class DDBCActuatorStatus(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['DDBC.ActuatorStatus'] = 'DDBC.ActuatorStatus' + message_type: Literal["DDBC.ActuatorStatus"] = "DDBC.ActuatorStatus" message_id: ID - actuator_id: ID = Field( - ..., description='ID of the actuator this messages refers to' - ) + actuator_id: ID = Field(..., description="ID of the actuator this messages refers to") active_operation_mode_id: ID = Field( ..., - description='The operation mode that is presently active for this actuator.', + description="The operation mode that is presently active for this actuator.", ) operation_mode_factor: float = Field( ..., - description='The number indicates the factor with which the DDBC.OperationMode is configured. The factor should be greater than or equal to 0 and less or equal to 1.', + description="The number indicates the factor with which the DDBC.OperationMode is configured. The factor should be greater than or equal to 0 and less or equal to 1.", ) previous_operation_mode_id: Optional[ID] = Field( None, - description='ID of the DDBC,OperationMode that was active before the present one. This value shall always be provided, unless the active DDBC.OperationMode is the first DDBC.OperationMode the Resource Manager is aware of.', + description="ID of the DDBC,OperationMode that was active before the present one. This value shall always be provided, unless the active DDBC.OperationMode is the first DDBC.OperationMode the Resource Manager is aware of.", ) transition_timestamp: Optional[AwareDatetime] = Field( None, - description='Time at which the transition from the previous DDBC.OperationMode to the active DDBC.OperationMode was initiated. This value shall always be provided, unless the active DDBC.OperationMode is the first DDBC.OperationMode the Resource Manager is aware of.', + description="Time at which the transition from the previous DDBC.OperationMode to the active DDBC.OperationMode was initiated. This value shall always be provided, unless the active DDBC.OperationMode is the first DDBC.OperationMode the Resource Manager is aware of.", ) class DDBCInstruction(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['DDBC.Instruction'] = 'DDBC.Instruction' + message_type: Literal["DDBC.Instruction"] = "DDBC.Instruction" message_id: ID id: ID = Field( ..., - description='Identifier of this DDBC.Instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="Identifier of this DDBC.Instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) execution_time: AwareDatetime = Field( ..., - description='Indicates the moment the execution of the instruction shall start. When the specified execution time is in the past, execution must start as soon as possible.', + description="Indicates the moment the execution of the instruction shall start. When the specified execution time is in the past, execution must start as soon as possible.", ) abnormal_condition: bool = Field( ..., - description='Indicates if this is an instruction during an abnormal condition', - ) - actuator_id: ID = Field( - ..., description='ID of the actuator this Instruction belongs to.' + description="Indicates if this is an instruction during an abnormal condition", ) - operation_mode_id: ID = Field(..., description='ID of the DDBC.OperationMode') + actuator_id: ID = Field(..., description="ID of the actuator this Instruction belongs to.") + operation_mode_id: ID = Field(..., description="ID of the DDBC.OperationMode") operation_mode_factor: float = Field( ..., - description='The number indicates the factor with which the OMBC.OperationMode should be configured. The factor should be greater than or equal to 0 and less or equal to 1.', + description="The number indicates the factor with which the OMBC.OperationMode should be configured. The factor should be greater than or equal to 0 and less or equal to 1.", ) class DDBCAverageDemandRateForecast(BaseModel): model_config = ConfigDict( - extra='forbid', - ) - message_type: Literal['DDBC.AverageDemandRateForecast'] = ( - 'DDBC.AverageDemandRateForecast' + extra="forbid", ) + message_type: Literal["DDBC.AverageDemandRateForecast"] = "DDBC.AverageDemandRateForecast" message_id: ID - start_time: AwareDatetime = Field(..., description='Start time of the profile.') + start_time: AwareDatetime = Field(..., description="Start time of the profile.") elements: List[DDBCAverageDemandRateForecastElement] = Field( ..., - description='Elements of the profile. Elements must be placed in chronological order.', + description="Elements of the profile. Elements must be placed in chronological order.", max_length=288, min_length=1, ) @@ -962,84 +930,82 @@ class DDBCAverageDemandRateForecast(BaseModel): class PowerValue(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) commodity_quantity: CommodityQuantity = Field( - ..., description='The power quantity the value refers to' + ..., description="The power quantity the value refers to" ) value: float = Field( ..., - description='Power value expressed in the unit associated with the CommodityQuantity', + description="Power value expressed in the unit associated with the CommodityQuantity", ) class PowerForecastValue(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) value_upper_limit: Optional[float] = Field( None, - description='The upper boundary of the range with 100 % certainty the power value is in it', + description="The upper boundary of the range with 100 % certainty the power value is in it", ) value_upper_95PPR: Optional[float] = Field( None, - description='The upper boundary of the range with 95 % certainty the power value is in it', + description="The upper boundary of the range with 95 % certainty the power value is in it", ) value_upper_68PPR: Optional[float] = Field( None, - description='The upper boundary of the range with 68 % certainty the power value is in it', + description="The upper boundary of the range with 68 % certainty the power value is in it", ) - value_expected: float = Field(..., description='The expected power value.') + value_expected: float = Field(..., description="The expected power value.") value_lower_68PPR: Optional[float] = Field( None, - description='The lower boundary of the range with 68 % certainty the power value is in it', + description="The lower boundary of the range with 68 % certainty the power value is in it", ) value_lower_95PPR: Optional[float] = Field( None, - description='The lower boundary of the range with 95 % certainty the power value is in it', + description="The lower boundary of the range with 95 % certainty the power value is in it", ) value_lower_limit: Optional[float] = Field( None, - description='The lower boundary of the range with 100 % certainty the power value is in it', + description="The lower boundary of the range with 100 % certainty the power value is in it", ) commodity_quantity: CommodityQuantity = Field( - ..., description='The power quantity the value refers to' + ..., description="The power quantity the value refers to" ) class PowerRange(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) start_of_range: float = Field( - ..., description='Power value that defines the start of the range.' - ) - end_of_range: float = Field( - ..., description='Power value that defines the end of the range.' + ..., description="Power value that defines the start of the range." ) + end_of_range: float = Field(..., description="Power value that defines the end of the range.") commodity_quantity: CommodityQuantity = Field( - ..., description='The power quantity the values refer to' + ..., description="The power quantity the values refer to" ) class Role(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) role: RoleType = Field( - ..., description='Role type of the Resource Manager for the given commodity' + ..., description="Role type of the Resource Manager for the given commodity" ) - commodity: Commodity = Field(..., description='Commodity the role refers to.') + commodity: Commodity = Field(..., description="Commodity the role refers to.") class PowerForecastElement(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - duration: Duration = Field(..., description='Duration of the PowerForecastElement') + duration: Duration = Field(..., description="Duration of the PowerForecastElement") power_values: List[PowerForecastValue] = Field( ..., - description='The values of power that are expected for the given period of time. There shall be at least one PowerForecastValue, and at most one PowerForecastValue per CommodityQuantity.', + description="The values of power that are expected for the given period of time. There shall be at least one PowerForecastValue, and at most one PowerForecastValue per CommodityQuantity.", max_length=10, min_length=1, ) @@ -1047,39 +1013,39 @@ class PowerForecastElement(BaseModel): class PEBCAllowedLimitRange(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) commodity_quantity: CommodityQuantity = Field( - ..., description='Type of power quantity this PEBC.AllowedLimitRange applies to' + ..., description="Type of power quantity this PEBC.AllowedLimitRange applies to" ) limit_type: PEBCPowerEnvelopeLimitType = Field( ..., - description='Indicates if this ranges applies to the upper limit or the lower limit', + description="Indicates if this ranges applies to the upper limit or the lower limit", ) range_boundary: NumberRange = Field( ..., - description='Boundaries of the power range of this PEBC.AllowedLimitRange. The CEM is allowed to choose values within this range for the power envelope for the limit as described in limit_type. The start of the range shall be smaller or equal than the end of the range. ', + description="Boundaries of the power range of this PEBC.AllowedLimitRange. The CEM is allowed to choose values within this range for the power envelope for the limit as described in limit_type. The start of the range shall be smaller or equal than the end of the range. ", ) abnormal_condition_only: bool = Field( ..., - description='Indicates if this PEBC.AllowedLimitRange may only be used during an abnormal condition', + description="Indicates if this PEBC.AllowedLimitRange may only be used during an abnormal condition", ) class PEBCPowerEnvelope(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) id: ID = Field( ..., - description='Identifier of this PEBC.PowerEnvelope. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="Identifier of this PEBC.PowerEnvelope. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) commodity_quantity: CommodityQuantity = Field( - ..., description='Type of power quantity this PEBC.PowerEnvelope applies to' + ..., description="Type of power quantity this PEBC.PowerEnvelope applies to" ) power_envelope_elements: List[PEBCPowerEnvelopeElement] = Field( ..., - description='The elements of this PEBC.PowerEnvelope. Shall contain at least one element. Elements must be placed in chronological order.', + description="The elements of this PEBC.PowerEnvelope. Shall contain at least one element. Elements must be placed in chronological order.", max_length=288, min_length=1, ) @@ -1087,14 +1053,12 @@ class PEBCPowerEnvelope(BaseModel): class PPBCPowerSequenceElement(BaseModel): model_config = ConfigDict( - extra='forbid', - ) - duration: Duration = Field( - ..., description='Duration of the PPBC.PowerSequenceElement.' + extra="forbid", ) + duration: Duration = Field(..., description="Duration of the PPBC.PowerSequenceElement.") power_values: List[PowerForecastValue] = Field( ..., - description='The value of power and deviations for the given duration. The array should contain at least one PowerForecastValue and at most one PowerForecastValue per CommodityQuantity.', + description="The value of power and deviations for the given duration. The array should contain at least one PowerForecastValue and at most one PowerForecastValue per CommodityQuantity.", max_length=10, min_length=1, ) @@ -1102,163 +1066,163 @@ class PPBCPowerSequenceElement(BaseModel): class PPBCPowerSequenceContainerStatus(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) power_profile_id: ID = Field( ..., - description='ID of the PPBC.PowerProfileDefinition of which the data element ‘sequence_container_id’ refers to. ', + description="ID of the PPBC.PowerProfileDefinition of which the data element ‘sequence_container_id’ refers to. ", ) sequence_container_id: ID = Field( ..., - description='ID of the PPBC.PowerSequenceContainer this PPBC.PowerSequenceContainerStatus provides information about.', + description="ID of the PPBC.PowerSequenceContainer this PPBC.PowerSequenceContainerStatus provides information about.", ) selected_sequence_id: Optional[ID] = Field( None, - description='ID of selected PPBC.PowerSequence. When no ID is given, no sequence was selected yet.', + description="ID of selected PPBC.PowerSequence. When no ID is given, no sequence was selected yet.", ) progress: Optional[Duration] = Field( None, - description='Time that has passed since the selected sequence has started. A value must be provided, unless no sequence has been selected or the selected sequence hasn’t started yet.', + description="Time that has passed since the selected sequence has started. A value must be provided, unless no sequence has been selected or the selected sequence hasn’t started yet.", ) status: PPBCPowerSequenceStatus = Field( - ..., description='Status of the selected PPBC.PowerSequence' + ..., description="Status of the selected PPBC.PowerSequence" ) class OMBCOperationMode(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) id: ID = Field( ..., - description='ID of the OBMC.OperationMode. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="ID of the OBMC.OperationMode. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) diagnostic_label: Optional[str] = Field( None, - description='Human readable name/description of the OMBC.OperationMode. This element is only intended for diagnostic purposes and not for HMI applications.', + description="Human readable name/description of the OMBC.OperationMode. This element is only intended for diagnostic purposes and not for HMI applications.", ) power_ranges: List[PowerRange] = Field( ..., - description='The power produced or consumed by this operation mode. The start of each PowerRange is associated with an operation_mode_factor of 0, the end is associated with an operation_mode_factor of 1. In the array there must be at least one PowerRange, and at most one PowerRange per CommodityQuantity.', + description="The power produced or consumed by this operation mode. The start of each PowerRange is associated with an operation_mode_factor of 0, the end is associated with an operation_mode_factor of 1. In the array there must be at least one PowerRange, and at most one PowerRange per CommodityQuantity.", max_length=10, min_length=1, ) running_costs: Optional[NumberRange] = Field( None, - description='Additional costs per second (e.g. wear, services) associated with this operation mode in the currency defined by the ResourceManagerDetails , excluding the commodity cost. The range is expressing uncertainty and is not linked to the operation_mode_factor.', + description="Additional costs per second (e.g. wear, services) associated with this operation mode in the currency defined by the ResourceManagerDetails , excluding the commodity cost. The range is expressing uncertainty and is not linked to the operation_mode_factor.", ) abnormal_condition_only: bool = Field( ..., - description='Indicates if this OMBC.OperationMode may only be used during an abnormal condition.', + description="Indicates if this OMBC.OperationMode may only be used during an abnormal condition.", ) class FRBCOperationModeElement(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) fill_level_range: NumberRange = Field( ..., - description='The range of the fill level for which this FRBC.OperationModeElement applies. The start of the NumberRange shall be smaller than the end of the NumberRange.', + description="The range of the fill level for which this FRBC.OperationModeElement applies. The start of the NumberRange shall be smaller than the end of the NumberRange.", ) fill_rate: NumberRange = Field( ..., - description='Indicates the change in fill_level per second. The lower_boundary of the NumberRange is associated with an operation_mode_factor of 0, the upper_boundary is associated with an operation_mode_factor of 1. ', + description="Indicates the change in fill_level per second. The lower_boundary of the NumberRange is associated with an operation_mode_factor of 0, the upper_boundary is associated with an operation_mode_factor of 1. ", ) power_ranges: List[PowerRange] = Field( ..., - description='The power produced or consumed by this operation mode. The start of each PowerRange is associated with an operation_mode_factor of 0, the end is associated with an operation_mode_factor of 1. In the array there must be at least one PowerRange, and at most one PowerRange per CommodityQuantity.', + description="The power produced or consumed by this operation mode. The start of each PowerRange is associated with an operation_mode_factor of 0, the end is associated with an operation_mode_factor of 1. In the array there must be at least one PowerRange, and at most one PowerRange per CommodityQuantity.", max_length=10, min_length=1, ) running_costs: Optional[NumberRange] = Field( None, - description='Additional costs per second (e.g. wear, services) associated with this operation mode in the currency defined by the ResourceManagerDetails, excluding the commodity cost. The range is expressing uncertainty and is not linked to the operation_mode_factor.', + description="Additional costs per second (e.g. wear, services) associated with this operation mode in the currency defined by the ResourceManagerDetails, excluding the commodity cost. The range is expressing uncertainty and is not linked to the operation_mode_factor.", ) class DDBCOperationMode(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) Id: ID = Field( ..., - description='ID of this operation mode. Must be unique in the scope of the DDBC.ActuatorDescription in which it is used.', + description="ID of this operation mode. Must be unique in the scope of the DDBC.ActuatorDescription in which it is used.", ) diagnostic_label: Optional[str] = Field( None, - description='Human readable name/description of the DDBC.OperationMode. This element is only intended for diagnostic purposes and not for HMI applications.', + description="Human readable name/description of the DDBC.OperationMode. This element is only intended for diagnostic purposes and not for HMI applications.", ) power_ranges: List[PowerRange] = Field( ..., - description='The power produced or consumed by this operation mode. The start of each PowerRange is associated with an operation_mode_factor of 0, the end is associated with an operation_mode_factor of 1. In the array there must be at least one PowerRange, and at most one PowerRange per CommodityQuantity.', + description="The power produced or consumed by this operation mode. The start of each PowerRange is associated with an operation_mode_factor of 0, the end is associated with an operation_mode_factor of 1. In the array there must be at least one PowerRange, and at most one PowerRange per CommodityQuantity.", max_length=10, min_length=1, ) supply_range: NumberRange = Field( ..., - description='The supply rate this DDBC.OperationMode can deliver for the CEM to match the demand rate. The start of the NumberRange is associated with an operation_mode_factor of 0, the end is associated with an operation_mode_factor of 1.', + description="The supply rate this DDBC.OperationMode can deliver for the CEM to match the demand rate. The start of the NumberRange is associated with an operation_mode_factor of 0, the end is associated with an operation_mode_factor of 1.", ) running_costs: Optional[NumberRange] = Field( None, - description='Additional costs per second (e.g. wear, services) associated with this operation mode in the currency defined by the ResourceManagerDetails, excluding the commodity cost. The range is expressing uncertainty and is not linked to the operation_mode_factor.', + description="Additional costs per second (e.g. wear, services) associated with this operation mode in the currency defined by the ResourceManagerDetails, excluding the commodity cost. The range is expressing uncertainty and is not linked to the operation_mode_factor.", ) abnormal_condition_only: bool = Field( ..., - description='Indicates if this DDBC.OperationMode may only be used during an abnormal condition.', + description="Indicates if this DDBC.OperationMode may only be used during an abnormal condition.", ) class ResourceManagerDetails(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['ResourceManagerDetails'] = 'ResourceManagerDetails' + message_type: Literal["ResourceManagerDetails"] = "ResourceManagerDetails" message_id: ID resource_id: ID = Field( ..., - description='Identifier of the Resource Manager. Must be unique within the scope of the CEM.', + description="Identifier of the Resource Manager. Must be unique within the scope of the CEM.", ) - name: Optional[str] = Field(None, description='Human readable name given by user') + name: Optional[str] = Field(None, description="Human readable name given by user") roles: List[Role] = Field( ..., - description='Each Resource Manager provides one or more energy Roles', + description="Each Resource Manager provides one or more energy Roles", max_length=3, min_length=1, ) - manufacturer: Optional[str] = Field(None, description='Name of Manufacturer') + manufacturer: Optional[str] = Field(None, description="Name of Manufacturer") model: Optional[str] = Field( None, - description='Name of the model of the device (provided by the manufacturer)', + description="Name of the model of the device (provided by the manufacturer)", ) serial_number: Optional[str] = Field( - None, description='Serial number of the device (provided by the manufacturer)' + None, description="Serial number of the device (provided by the manufacturer)" ) firmware_version: Optional[str] = Field( None, - description='Version identifier of the firmware used in the device (provided by the manufacturer)', + description="Version identifier of the firmware used in the device (provided by the manufacturer)", ) instruction_processing_delay: Duration = Field( ..., - description='The average time the combination of Resource Manager and HBES/BACS/SASS or (Smart) device needs to process and execute an instruction', + description="The average time the combination of Resource Manager and HBES/BACS/SASS or (Smart) device needs to process and execute an instruction", ) available_control_types: List[ControlType] = Field( ..., - description='The control types supported by this Resource Manager.', + description="The control types supported by this Resource Manager.", max_length=5, min_length=1, ) currency: Optional[Currency] = Field( None, - description='Currency to be used for all information regarding costs. Mandatory if cost information is published.', + description="Currency to be used for all information regarding costs. Mandatory if cost information is published.", ) provides_forecast: bool = Field( ..., - description='Indicates whether the ResourceManager is able to provide PowerForecasts', + description="Indicates whether the ResourceManager is able to provide PowerForecasts", ) provides_power_measurement_types: List[CommodityQuantity] = Field( ..., - description='Array of all CommodityQuantities that this Resource Manager can provide measurements for. ', + description="Array of all CommodityQuantities that this Resource Manager can provide measurements for. ", max_length=10, min_length=1, ) @@ -1266,16 +1230,16 @@ class ResourceManagerDetails(BaseModel): class PowerMeasurement(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['PowerMeasurement'] = 'PowerMeasurement' + message_type: Literal["PowerMeasurement"] = "PowerMeasurement" message_id: ID measurement_timestamp: AwareDatetime = Field( - ..., description='Timestamp when PowerValues were measured.' + ..., description="Timestamp when PowerValues were measured." ) values: List[PowerValue] = Field( ..., - description='Array of measured PowerValues. Must contain at least one item and at most one item per ‘commodity_quantity’ (defined inside the PowerValue).', + description="Array of measured PowerValues. Must contain at least one item and at most one item per ‘commodity_quantity’ (defined inside the PowerValue).", max_length=10, min_length=1, ) @@ -1283,16 +1247,16 @@ class PowerMeasurement(BaseModel): class PowerForecast(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['PowerForecast'] = 'PowerForecast' + message_type: Literal["PowerForecast"] = "PowerForecast" message_id: ID start_time: AwareDatetime = Field( - ..., description='Start time of time period that is covered by the profile.' + ..., description="Start time of time period that is covered by the profile." ) elements: List[PowerForecastElement] = Field( ..., - description='Elements of which this forecast consists. Contains at least one element. Elements must be placed in chronological order.', + description="Elements of which this forecast consists. Contains at least one element. Elements must be placed in chronological order.", max_length=288, min_length=1, ) @@ -1300,27 +1264,27 @@ class PowerForecast(BaseModel): class PEBCPowerConstraints(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['PEBC.PowerConstraints'] = 'PEBC.PowerConstraints' + message_type: Literal["PEBC.PowerConstraints"] = "PEBC.PowerConstraints" message_id: ID id: ID = Field( ..., - description='Identifier of this PEBC.PowerConstraints. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="Identifier of this PEBC.PowerConstraints. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) valid_from: AwareDatetime = Field( - ..., description='Moment this PEBC.PowerConstraints start to be valid' + ..., description="Moment this PEBC.PowerConstraints start to be valid" ) valid_until: Optional[AwareDatetime] = Field( None, - description='Moment until this PEBC.PowerConstraints is valid. If valid_until is not present, there is no determined end time of this PEBC.PowerConstraints.', + description="Moment until this PEBC.PowerConstraints is valid. If valid_until is not present, there is no determined end time of this PEBC.PowerConstraints.", ) consequence_type: PEBCPowerEnvelopeConsequenceType = Field( - ..., description='Type of consequence of limiting power' + ..., description="Type of consequence of limiting power" ) allowed_limit_ranges: List[PEBCAllowedLimitRange] = Field( ..., - description='The actual constraints. There shall be at least one PEBC.AllowedLimitRange for the UPPER_LIMIT and at least one AllowedLimitRange for the LOWER_LIMIT. It is allowed to have multiple PEBC.AllowedLimitRange objects with identical CommodityQuantities and LimitTypes.', + description="The actual constraints. There shall be at least one PEBC.AllowedLimitRange for the UPPER_LIMIT and at least one AllowedLimitRange for the LOWER_LIMIT. It is allowed to have multiple PEBC.AllowedLimitRange objects with identical CommodityQuantities and LimitTypes.", max_length=100, min_length=2, ) @@ -1328,29 +1292,29 @@ class PEBCPowerConstraints(BaseModel): class PEBCInstruction(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['PEBC.Instruction'] = 'PEBC.Instruction' + message_type: Literal["PEBC.Instruction"] = "PEBC.Instruction" message_id: ID id: ID = Field( ..., - description='Identifier of this PEBC.Instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="Identifier of this PEBC.Instruction. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) execution_time: AwareDatetime = Field( ..., - description='Indicates the moment the execution of the instruction shall start. When the specified execution time is in the past, execution must start as soon as possible.', + description="Indicates the moment the execution of the instruction shall start. When the specified execution time is in the past, execution must start as soon as possible.", ) abnormal_condition: bool = Field( ..., - description='Indicates if this is an instruction during an abnormal condition.', + description="Indicates if this is an instruction during an abnormal condition.", ) power_constraints_id: ID = Field( ..., - description='Identifier of the PEBC.PowerConstraints this PEBC.Instruction was based on.', + description="Identifier of the PEBC.PowerConstraints this PEBC.Instruction was based on.", ) power_envelopes: List[PEBCPowerEnvelope] = Field( ..., - description='The PEBC.PowerEnvelope(s) that should be followed by the Resource Manager. There shall be at least one PEBC.PowerEnvelope, but at most one PEBC.PowerEnvelope for each CommodityQuantity.', + description="The PEBC.PowerEnvelope(s) that should be followed by the Resource Manager. There shall be at least one PEBC.PowerEnvelope, but at most one PEBC.PowerEnvelope for each CommodityQuantity.", max_length=10, min_length=1, ) @@ -1358,13 +1322,13 @@ class PEBCInstruction(BaseModel): class PPBCPowerProfileStatus(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['PPBC.PowerProfileStatus'] = 'PPBC.PowerProfileStatus' + message_type: Literal["PPBC.PowerProfileStatus"] = "PPBC.PowerProfileStatus" message_id: ID sequence_container_status: List[PPBCPowerSequenceContainerStatus] = Field( ..., - description='Array with status information for all PPBC.PowerSequenceContainers in the PPBC.PowerProfileDefinition.', + description="Array with status information for all PPBC.PowerSequenceContainers in the PPBC.PowerProfileDefinition.", max_length=1000, min_length=1, ) @@ -1372,29 +1336,29 @@ class PPBCPowerProfileStatus(BaseModel): class OMBCSystemDescription(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['OMBC.SystemDescription'] = 'OMBC.SystemDescription' + message_type: Literal["OMBC.SystemDescription"] = "OMBC.SystemDescription" message_id: ID valid_from: AwareDatetime = Field( ..., - description='Moment this OMBC.SystemDescription starts to be valid. If the system description is immediately valid, the DateTimeStamp should be now or in the past.', + description="Moment this OMBC.SystemDescription starts to be valid. If the system description is immediately valid, the DateTimeStamp should be now or in the past.", ) operation_modes: List[OMBCOperationMode] = Field( ..., - description='OMBC.OperationModes available for the CEM in order to coordinate the device behaviour.', + description="OMBC.OperationModes available for the CEM in order to coordinate the device behaviour.", max_length=100, min_length=1, ) transitions: List[Transition] = Field( ..., - description='Possible transitions to switch from one OMBC.OperationMode to another.', + description="Possible transitions to switch from one OMBC.OperationMode to another.", max_length=1000, min_length=0, ) timers: List[Timer] = Field( ..., - description='Timers that control when certain transitions can be made.', + description="Timers that control when certain transitions can be made.", max_length=1000, min_length=0, ) @@ -1402,89 +1366,89 @@ class OMBCSystemDescription(BaseModel): class PPBCPowerSequence(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) id: ID = Field( ..., - description='ID of the PPBC.PowerSequence. Must be unique in the scope of the PPBC.PowerSequnceContainer in which it is used.', + description="ID of the PPBC.PowerSequence. Must be unique in the scope of the PPBC.PowerSequnceContainer in which it is used.", ) elements: List[PPBCPowerSequenceElement] = Field( ..., - description='List of PPBC.PowerSequenceElements. Shall contain at least one element. Elements must be placed in chronological order.', + description="List of PPBC.PowerSequenceElements. Shall contain at least one element. Elements must be placed in chronological order.", max_length=288, min_length=1, ) is_interruptible: bool = Field( ..., - description='Indicates whether the option of pausing a sequence is available.', + description="Indicates whether the option of pausing a sequence is available.", ) max_pause_before: Optional[Duration] = Field( None, - description='The maximum duration for which a device can be paused between the end of the previous running sequence and the start of this one', + description="The maximum duration for which a device can be paused between the end of the previous running sequence and the start of this one", ) abnormal_condition_only: bool = Field( ..., - description='Indicates if this PPBC.PowerSequence may only be used during an abnormal condition', + description="Indicates if this PPBC.PowerSequence may only be used during an abnormal condition", ) class FRBCOperationMode(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) id: ID = Field( ..., - description='ID of the FRBC.OperationMode. Must be unique in the scope of the FRBC.ActuatorDescription in which it is used.', + description="ID of the FRBC.OperationMode. Must be unique in the scope of the FRBC.ActuatorDescription in which it is used.", ) diagnostic_label: Optional[str] = Field( None, - description='Human readable name/description of the FRBC.OperationMode. This element is only intended for diagnostic purposes and not for HMI applications.', + description="Human readable name/description of the FRBC.OperationMode. This element is only intended for diagnostic purposes and not for HMI applications.", ) elements: List[FRBCOperationModeElement] = Field( ..., - description='List of FRBC.OperationModeElements, which describe the properties of this FRBC.OperationMode depending on the fill_level. The fill_level_ranges of the items in the Array must be contiguous.', + description="List of FRBC.OperationModeElements, which describe the properties of this FRBC.OperationMode depending on the fill_level. The fill_level_ranges of the items in the Array must be contiguous.", max_length=100, min_length=1, ) abnormal_condition_only: bool = Field( ..., - description='Indicates if this FRBC.OperationMode may only be used during an abnormal condition', + description="Indicates if this FRBC.OperationMode may only be used during an abnormal condition", ) class DDBCActuatorDescription(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) id: ID = Field( ..., - description='ID of this DDBC.ActuatorDescription. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="ID of this DDBC.ActuatorDescription. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) diagnostic_label: Optional[str] = Field( None, - description='Human readable name/description of the actuator. This element is only intended for diagnostic purposes and not for HMI applications.', + description="Human readable name/description of the actuator. This element is only intended for diagnostic purposes and not for HMI applications.", ) supported_commodites: List[Commodity] = Field( ..., - description='Commodities supported by the operation modes of this actuator. There shall be at least one commodity', + description="Commodities supported by the operation modes of this actuator. There shall be at least one commodity", max_length=4, min_length=1, ) operation_modes: List[DDBCOperationMode] = Field( ..., - description='List of all Operation Modes that are available for this actuator. There shall be at least one DDBC.OperationMode.', + description="List of all Operation Modes that are available for this actuator. There shall be at least one DDBC.OperationMode.", max_length=100, min_length=1, ) transitions: List[Transition] = Field( ..., - description='List of Transitions between Operation Modes. Shall contain at least one Transition.', + description="List of Transitions between Operation Modes. Shall contain at least one Transition.", max_length=1000, min_length=0, ) timers: List[Timer] = Field( ..., - description='List of Timers associated with Transitions for this Actuator. Can be empty.', + description="List of Timers associated with Transitions for this Actuator. Can be empty.", max_length=1000, min_length=0, ) @@ -1492,40 +1456,40 @@ class DDBCActuatorDescription(BaseModel): class DDBCSystemDescription(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['DDBC.SystemDescription'] = 'DDBC.SystemDescription' + message_type: Literal["DDBC.SystemDescription"] = "DDBC.SystemDescription" message_id: ID valid_from: AwareDatetime = Field( ..., - description='Moment this DDBC.SystemDescription starts to be valid. If the system description is immediately valid, the DateTimeStamp should be now or in the past.', + description="Moment this DDBC.SystemDescription starts to be valid. If the system description is immediately valid, the DateTimeStamp should be now or in the past.", ) actuators: List[DDBCActuatorDescription] = Field( ..., - description='List of all available actuators in the system. Must contain at least one DDBC.ActuatorAggregated.', + description="List of all available actuators in the system. Must contain at least one DDBC.ActuatorAggregated.", max_length=10, min_length=1, ) present_demand_rate: NumberRange = Field( - ..., description='Present demand rate that needs to be satisfied by the system' + ..., description="Present demand rate that needs to be satisfied by the system" ) provides_average_demand_rate_forecast: bool = Field( ..., - description='Indicates whether the Resource Manager could provide a demand rate forecast through the DDBC.AverageDemandRateForecast.', + description="Indicates whether the Resource Manager could provide a demand rate forecast through the DDBC.AverageDemandRateForecast.", ) class PPBCPowerSequenceContainer(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) id: ID = Field( ..., - description='ID of the PPBC.PowerSequenceContainer. Must be unique in the scope of the PPBC.PowerProfileDefinition in which it is used.', + description="ID of the PPBC.PowerSequenceContainer. Must be unique in the scope of the PPBC.PowerProfileDefinition in which it is used.", ) power_sequences: List[PPBCPowerSequence] = Field( ..., - description='List of alternative Sequences where one could be chosen by the CEM', + description="List of alternative Sequences where one could be chosen by the CEM", max_length=288, min_length=1, ) @@ -1533,37 +1497,37 @@ class PPBCPowerSequenceContainer(BaseModel): class FRBCActuatorDescription(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) id: ID = Field( ..., - description='ID of the Actuator. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="ID of the Actuator. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) diagnostic_label: Optional[str] = Field( None, - description='Human readable name/description for the actuator. This element is only intended for diagnostic purposes and not for HMI applications.', + description="Human readable name/description for the actuator. This element is only intended for diagnostic purposes and not for HMI applications.", ) supported_commodities: List[Commodity] = Field( ..., - description='List of all supported Commodities.', + description="List of all supported Commodities.", max_length=4, min_length=1, ) operation_modes: List[FRBCOperationMode] = Field( ..., - description='Provided FRBC.OperationModes associated with this actuator', + description="Provided FRBC.OperationModes associated with this actuator", max_length=100, min_length=1, ) transitions: List[Transition] = Field( ..., - description='Possible transitions between FRBC.OperationModes associated with this actuator.', + description="Possible transitions between FRBC.OperationModes associated with this actuator.", max_length=1000, min_length=0, ) timers: List[Timer] = Field( ..., - description='List of Timers associated with this actuator', + description="List of Timers associated with this actuator", max_length=1000, min_length=0, ) @@ -1571,25 +1535,25 @@ class FRBCActuatorDescription(BaseModel): class PPBCPowerProfileDefinition(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['PPBC.PowerProfileDefinition'] = 'PPBC.PowerProfileDefinition' + message_type: Literal["PPBC.PowerProfileDefinition"] = "PPBC.PowerProfileDefinition" message_id: ID id: ID = Field( ..., - description='ID of the PPBC.PowerProfileDefinition. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.', + description="ID of the PPBC.PowerProfileDefinition. Must be unique in the scope of the Resource Manager, for at least the duration of the session between Resource Manager and CEM.", ) start_time: AwareDatetime = Field( ..., - description='Indicates the first possible time the first PPBC.PowerSequence could start', + description="Indicates the first possible time the first PPBC.PowerSequence could start", ) end_time: AwareDatetime = Field( ..., - description='Indicates when the last PPBC.PowerSequence shall be finished at the latest', + description="Indicates when the last PPBC.PowerSequence shall be finished at the latest", ) power_sequences_containers: List[PPBCPowerSequenceContainer] = Field( ..., - description='The PPBC.PowerSequenceContainers that make up this PPBC.PowerProfileDefinition. There shall be at least one PPBC.PowerSequenceContainer that includes at least one PPBC.PowerSequence. PPBC.PowerSequenceContainers must be placed in chronological order.', + description="The PPBC.PowerSequenceContainers that make up this PPBC.PowerProfileDefinition. There shall be at least one PPBC.PowerSequenceContainer that includes at least one PPBC.PowerSequence. PPBC.PowerSequenceContainers must be placed in chronological order.", max_length=1000, min_length=1, ) @@ -1597,15 +1561,15 @@ class PPBCPowerProfileDefinition(BaseModel): class FRBCSystemDescription(BaseModel): model_config = ConfigDict( - extra='forbid', + extra="forbid", ) - message_type: Literal['FRBC.SystemDescription'] = 'FRBC.SystemDescription' + message_type: Literal["FRBC.SystemDescription"] = "FRBC.SystemDescription" message_id: ID valid_from: AwareDatetime = Field( ..., - description='Moment this FRBC.SystemDescription starts to be valid. If the system description is immediately valid, the DateTimeStamp should be now or in the past.', + description="Moment this FRBC.SystemDescription starts to be valid. If the system description is immediately valid, the DateTimeStamp should be now or in the past.", ) actuators: List[FRBCActuatorDescription] = Field( - ..., description='Details of all Actuators.', max_length=10, min_length=1 + ..., description="Details of all Actuators.", max_length=10, min_length=1 ) - storage: FRBCStorageDescription = Field(..., description='Details of the storage.') + storage: FRBCStorageDescription = Field(..., description="Details of the storage.") diff --git a/src/s2python/pebc/__init__.py b/src/s2python/pebc/__init__.py index 489c85c..27f8801 100644 --- a/src/s2python/pebc/__init__.py +++ b/src/s2python/pebc/__init__.py @@ -8,3 +8,14 @@ PEBCPowerEnvelopeLimitType, ) from s2python.pebc.pebc_instruction import PEBCInstruction + +__all__ = [ + "PEBCAllowedLimitRange", + "PEBCPowerConstraints", + "PEBCPowerEnvelope", + "PEBCPowerEnvelopeElement", + "PEBCEnergyConstraint", + "PEBCPowerEnvelopeConsequenceType", + "PEBCPowerEnvelopeLimitType", + "PEBCInstruction", +] diff --git a/src/s2python/pebc/pebc_allowed_limit_range.py b/src/s2python/pebc/pebc_allowed_limit_range.py index 244cbec..1df2c32 100644 --- a/src/s2python/pebc/pebc_allowed_limit_range.py +++ b/src/s2python/pebc/pebc_allowed_limit_range.py @@ -10,17 +10,17 @@ @catch_and_convert_exceptions -class PEBCAllowedLimitRange(GenPEBCAllowedLimitRange, S2MessageComponent["PEBCAllowedLimitRange"]): +class PEBCAllowedLimitRange(GenPEBCAllowedLimitRange, S2MessageComponent): model_config = GenPEBCAllowedLimitRange.model_config model_config["validate_assignment"] = True commodity_quantity: CommodityQuantity = GenPEBCAllowedLimitRange.model_fields[ "commodity_quantity" - ] # type: ignore[assignment] + ] # type: ignore[assignment,reportIncompatibleVariableOverride] limit_type: GenPEBCPowerEnvelopeLimitType = GenPEBCAllowedLimitRange.model_fields[ "limit_type" - ] # type: ignore[assignment] - range_boundary: NumberRange = GenPEBCAllowedLimitRange.model_fields["range_boundary"] # type: ignore[assignment] + ] # type: ignore[assignment,reportIncompatibleVariableOverride] + range_boundary: NumberRange = GenPEBCAllowedLimitRange.model_fields["range_boundary"] # type: ignore[assignment,reportIncompatibleVariableOverride] abnormal_condition_only: bool = [ - GenPEBCAllowedLimitRange.model_fields["abnormal_condition_only"] # type: ignore[assignment] + GenPEBCAllowedLimitRange.model_fields["abnormal_condition_only"] # type: ignore[assignment,reportIncompatibleVariableOverride] ] diff --git a/src/s2python/pebc/pebc_energy_constraint.py b/src/s2python/pebc/pebc_energy_constraint.py index db09213..eaf76fe 100644 --- a/src/s2python/pebc/pebc_energy_constraint.py +++ b/src/s2python/pebc/pebc_energy_constraint.py @@ -11,15 +11,15 @@ @catch_and_convert_exceptions -class PEBCEnergyConstraint(GenPEBCEnergyConstraint, S2MessageComponent["PEBCEnergyConstraint"]): +class PEBCEnergyConstraint(GenPEBCEnergyConstraint, S2MessageComponent): model_config = GenPEBCEnergyConstraint.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenPEBCEnergyConstraint.model_fields["message_id"] # type: ignore[assignment] - id: uuid.UUID = GenPEBCEnergyConstraint.model_fields["id"] # type: ignore[assignment] + message_id: uuid.UUID = GenPEBCEnergyConstraint.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + id: uuid.UUID = GenPEBCEnergyConstraint.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] - upper_average_power: float = GenPEBCEnergyConstraint.model_fields["upper_average_power"] # type: ignore[assignment] - lower_average_power: float = GenPEBCEnergyConstraint.model_fields["lower_average_power"] # type: ignore[assignment] + upper_average_power: float = GenPEBCEnergyConstraint.model_fields["upper_average_power"] # type: ignore[assignment,reportIncompatibleVariableOverride] + lower_average_power: float = GenPEBCEnergyConstraint.model_fields["lower_average_power"] # type: ignore[assignment,reportIncompatibleVariableOverride] commodity_quantity: CommodityQuantity = [ - GenPEBCEnergyConstraint.model_fields["commodity_quantity"] # type: ignore[assignment] + GenPEBCEnergyConstraint.model_fields["commodity_quantity"] # type: ignore[assignment,reportIncompatibleVariableOverride] ] diff --git a/src/s2python/pebc/pebc_instruction.py b/src/s2python/pebc/pebc_instruction.py index 1e0403a..320f931 100644 --- a/src/s2python/pebc/pebc_instruction.py +++ b/src/s2python/pebc/pebc_instruction.py @@ -12,16 +12,16 @@ @catch_and_convert_exceptions -class PEBCInstruction(GenPEBCInstruction, S2MessageComponent["PEBCInstruction"]): +class PEBCInstruction(GenPEBCInstruction, S2MessageComponent): model_config = GenPEBCInstruction.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenPEBCInstruction.model_fields["message_id"] # type: ignore[assignment] - id: uuid.UUID = GenPEBCInstruction.model_fields["id"] # type: ignore[assignment] - power_constraints_id: uuid.UUID = [ + message_id: uuid.UUID = GenPEBCInstruction.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + id: uuid.UUID = GenPEBCInstruction.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + power_constraints_id: uuid.UUID = [ # type: ignore[reportIncompatibleVariableOverride] GenPEBCInstruction.model_fields["power_constraints_id"] # type: ignore[assignment] ] - power_envelopes: List[PEBCPowerEnvelope] = [ + power_envelopes: List[PEBCPowerEnvelope] = [ # type: ignore[reportIncompatibleVariableOverride] GenPEBCInstruction.model_fields["power_envelopes"] # type: ignore[assignment] ] - abnormal_condition: bool = GenPEBCInstruction.model_fields["abnormal_condition"] # type: ignore[assignment] + abnormal_condition: bool = GenPEBCInstruction.model_fields["abnormal_condition"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/pebc/pebc_power_constraints.py b/src/s2python/pebc/pebc_power_constraints.py index 16264ff..59c721d 100644 --- a/src/s2python/pebc/pebc_power_constraints.py +++ b/src/s2python/pebc/pebc_power_constraints.py @@ -13,15 +13,15 @@ @catch_and_convert_exceptions -class PEBCPowerConstraints(GenPEBCPowerConstraints, S2MessageComponent["PEBCPowerConstraints"]): +class PEBCPowerConstraints(GenPEBCPowerConstraints, S2MessageComponent): model_config = GenPEBCPowerConstraints.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenPEBCPowerConstraints.model_fields["message_id"] # type: ignore[assignment] - id: uuid.UUID = GenPEBCPowerConstraints.model_fields["id"] # type: ignore[assignment] - consequence_type: GenPEBCPowerEnvelopeConsequenceType = GenPEBCPowerConstraints.model_fields[ + message_id: uuid.UUID = GenPEBCPowerConstraints.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + id: uuid.UUID = GenPEBCPowerConstraints.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + consequence_type: GenPEBCPowerEnvelopeConsequenceType = GenPEBCPowerConstraints.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "consequence_type" ] # type: ignore[assignment] - allowed_limit_ranges: List[PEBCAllowedLimitRange] = GenPEBCPowerConstraints.model_fields[ + allowed_limit_ranges: List[PEBCAllowedLimitRange] = GenPEBCPowerConstraints.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "allowed_limit_ranges" ] # type: ignore[assignment] diff --git a/src/s2python/pebc/pebc_power_envelope.py b/src/s2python/pebc/pebc_power_envelope.py index 4033e8b..8ac20e6 100644 --- a/src/s2python/pebc/pebc_power_envelope.py +++ b/src/s2python/pebc/pebc_power_envelope.py @@ -11,13 +11,13 @@ @catch_and_convert_exceptions -class PEBCPowerEnvelope(GenPEBCPowerEnvelope, S2MessageComponent["PEBCPowerEnvelope"]): +class PEBCPowerEnvelope(GenPEBCPowerEnvelope, S2MessageComponent): model_config = GenPEBCPowerEnvelope.model_config model_config["validate_assignment"] = True - commodity_quantity: CommodityQuantity = GenPEBCPowerEnvelope.model_fields[ + commodity_quantity: CommodityQuantity = GenPEBCPowerEnvelope.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "commodity_quantity" ] # type: ignore[assignment] - power_envelope_elements: List[PEBCPowerEnvelopeElement] = GenPEBCPowerEnvelope.model_fields[ + power_envelope_elements: List[PEBCPowerEnvelopeElement] = GenPEBCPowerEnvelope.model_fields[ # type: ignore[assignment,reportIncompatibleVariableOverride] "power_envelope_elements" ] # type: ignore[assignment] diff --git a/src/s2python/pebc/pebc_power_envelope_element.py b/src/s2python/pebc/pebc_power_envelope_element.py index 8e75440..0e9f53b 100644 --- a/src/s2python/pebc/pebc_power_envelope_element.py +++ b/src/s2python/pebc/pebc_power_envelope_element.py @@ -8,9 +8,9 @@ @catch_and_convert_exceptions -class PEBCPowerEnvelopeElement(GenPEBCPowerEnvelopeElement, S2MessageComponent["PEBCPowerEnvelopeElement"]): +class PEBCPowerEnvelopeElement(GenPEBCPowerEnvelopeElement, S2MessageComponent): model_config = GenPEBCPowerEnvelopeElement.model_config model_config["validate_assignment"] = True - lower_limit: float = GenPEBCPowerEnvelopeElement.model_fields["lower_limit"] # type: ignore[assignment] - upper_limit: float = GenPEBCPowerEnvelopeElement.model_fields["upper_limit"] # type: ignore[assignment] + lower_limit: float = GenPEBCPowerEnvelopeElement.model_fields["lower_limit"] # type: ignore[assignment,reportIncompatibleVariableOverride] + upper_limit: float = GenPEBCPowerEnvelopeElement.model_fields["upper_limit"] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/ppbc/__init__.py b/src/s2python/ppbc/__init__.py index f38ad46..e28a750 100644 --- a/src/s2python/ppbc/__init__.py +++ b/src/s2python/ppbc/__init__.py @@ -1,13 +1,21 @@ from s2python.ppbc.ppbc_schedule_instruction import PPBCScheduleInstruction -from s2python.ppbc.ppbc_end_interruption_instruction import ( - PPBCEndInterruptionInstruction, -) +from s2python.ppbc.ppbc_end_interruption_instruction import PPBCEndInterruptionInstruction from s2python.ppbc.ppbc_power_profile_definition import PPBCPowerProfileDefinition from s2python.ppbc.ppbc_power_sequence_container import PPBCPowerSequenceContainer from s2python.ppbc.ppbc_power_sequence import PPBCPowerSequence from s2python.ppbc.ppbc_power_profile_status import PPBCPowerProfileStatus -from s2python.ppbc.ppbc_power_sequence_container_status import ( - PPBCPowerSequenceContainerStatus, -) +from s2python.ppbc.ppbc_power_sequence_container_status import PPBCPowerSequenceContainerStatus from s2python.ppbc.ppbc_power_sequence_element import PPBCPowerSequenceElement from s2python.ppbc.ppbc_start_interruption_instruction import PPBCStartInterruptionInstruction + +__all__ = [ + "PPBCScheduleInstruction", + "PPBCEndInterruptionInstruction", + "PPBCPowerProfileDefinition", + "PPBCPowerSequenceContainer", + "PPBCPowerSequence", + "PPBCPowerProfileStatus", + "PPBCPowerSequenceContainerStatus", + "PPBCPowerSequenceElement", + "PPBCStartInterruptionInstruction", +] diff --git a/src/s2python/ppbc/ppbc_end_interruption_instruction.py b/src/s2python/ppbc/ppbc_end_interruption_instruction.py index 2b098f1..d38a454 100644 --- a/src/s2python/ppbc/ppbc_end_interruption_instruction.py +++ b/src/s2python/ppbc/ppbc_end_interruption_instruction.py @@ -11,22 +11,20 @@ @catch_and_convert_exceptions -class PPBCEndInterruptionInstruction( - GenPPBCEndInterruptionInstruction, S2MessageComponent["PPBCEndInterruptionInstruction"] -): +class PPBCEndInterruptionInstruction(GenPPBCEndInterruptionInstruction, S2MessageComponent): model_config = GenPPBCEndInterruptionInstruction.model_config model_config["validate_assignment"] = True - id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields["id"] # type: ignore[assignment] - power_profile_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[ + id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + power_profile_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "power_profile_id" ] # type: ignore[assignment] - sequence_container_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[ + sequence_container_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "sequence_container_id" ] # type: ignore[assignment] - power_sequence_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[ + power_sequence_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "power_sequence_id" ] # type: ignore[assignment] - abnormal_condition: bool = GenPPBCEndInterruptionInstruction.model_fields[ + abnormal_condition: bool = GenPPBCEndInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "abnormal_condition" ] # type: ignore[assignment] diff --git a/src/s2python/ppbc/ppbc_power_profile_definition.py b/src/s2python/ppbc/ppbc_power_profile_definition.py index d3926c7..53c22c8 100644 --- a/src/s2python/ppbc/ppbc_power_profile_definition.py +++ b/src/s2python/ppbc/ppbc_power_profile_definition.py @@ -14,14 +14,12 @@ @catch_and_convert_exceptions -class PPBCPowerProfileDefinition( - GenPPBCPowerProfileDefinition, S2MessageComponent["PPBCPowerProfileDefinition"] -): +class PPBCPowerProfileDefinition(GenPPBCPowerProfileDefinition, S2MessageComponent): model_config = GenPPBCPowerProfileDefinition.model_config model_config["validate_assignment"] = True - message_id: uuid.UUID = GenPPBCPowerProfileDefinition.model_fields["message_id"] # type: ignore[assignment] - id: uuid.UUID = GenPPBCPowerProfileDefinition.model_fields["id"] # type: ignore[assignment] - power_sequences_containers: List[PPBCPowerSequenceContainer] = ( + message_id: uuid.UUID = GenPPBCPowerProfileDefinition.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + id: uuid.UUID = GenPPBCPowerProfileDefinition.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + power_sequences_containers: List[PPBCPowerSequenceContainer] = ( # type: ignore[reportIncompatibleVariableOverride] GenPPBCPowerProfileDefinition.model_fields["power_sequences_containers"] # type: ignore[assignment] ) diff --git a/src/s2python/ppbc/ppbc_power_profile_status.py b/src/s2python/ppbc/ppbc_power_profile_status.py index bec09cd..a43661f 100644 --- a/src/s2python/ppbc/ppbc_power_profile_status.py +++ b/src/s2python/ppbc/ppbc_power_profile_status.py @@ -15,12 +15,10 @@ @catch_and_convert_exceptions -class PPBCPowerProfileStatus( - GenPPBCPowerProfileStatus, S2MessageComponent["PPBCPowerProfileStatus"] -): +class PPBCPowerProfileStatus(GenPPBCPowerProfileStatus, S2MessageComponent): model_config = GenPPBCPowerProfileStatus.model_config model_config["validate_assignment"] = True - sequence_container_status: List[PPBCPowerSequenceContainerStatus] = ( + sequence_container_status: List[PPBCPowerSequenceContainerStatus] = ( # type: ignore[reportIncompatibleVariableOverride] GenPPBCPowerProfileStatus.model_fields["sequence_container_status"] # type: ignore[assignment] ) diff --git a/src/s2python/ppbc/ppbc_power_sequence.py b/src/s2python/ppbc/ppbc_power_sequence.py index 6f7af3d..9fc545a 100644 --- a/src/s2python/ppbc/ppbc_power_sequence.py +++ b/src/s2python/ppbc/ppbc_power_sequence.py @@ -15,16 +15,16 @@ @catch_and_convert_exceptions -class PPBCPowerSequence(GenPPBCPowerSequence, S2MessageComponent["PPBCPowerSequence"]): +class PPBCPowerSequence(GenPPBCPowerSequence, S2MessageComponent): model_config = GenPPBCPowerSequence.model_config model_config["validate_assignment"] = True - id: uuid.UUID = GenPPBCPowerSequence.model_fields["id"] # type: ignore[assignment] - elements: List[PPBCPowerSequenceElement] = GenPPBCPowerSequence.model_fields[ + id: uuid.UUID = GenPPBCPowerSequence.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + elements: List[PPBCPowerSequenceElement] = GenPPBCPowerSequence.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "elements" ] # type: ignore[assignment] - is_interruptible: bool = GenPPBCPowerSequence.model_fields["is_interruptible"] # type: ignore[assignment] - max_pause_before: Duration = GenPPBCPowerSequence.model_fields["max_pause_before"] # type: ignore[assignment] + is_interruptible: bool = GenPPBCPowerSequence.model_fields["is_interruptible"] # type: ignore[assignment,reportIncompatibleVariableOverride] + max_pause_before: Duration = GenPPBCPowerSequence.model_fields["max_pause_before"] # type: ignore[assignment,reportIncompatibleVariableOverride] abnormal_condition_only: bool = GenPPBCPowerSequence.model_fields[ "abnormal_condition_only" - ] # type: ignore[assignment] + ] # type: ignore[assignment,reportIncompatibleVariableOverride] diff --git a/src/s2python/ppbc/ppbc_power_sequence_container.py b/src/s2python/ppbc/ppbc_power_sequence_container.py index 08f30ff..c5edcf1 100644 --- a/src/s2python/ppbc/ppbc_power_sequence_container.py +++ b/src/s2python/ppbc/ppbc_power_sequence_container.py @@ -15,13 +15,11 @@ @catch_and_convert_exceptions -class PPBCPowerSequenceContainer( - GenPPBCPowerSequenceContainer, S2MessageComponent["PPBCPowerSequenceContainer"] -): +class PPBCPowerSequenceContainer(GenPPBCPowerSequenceContainer, S2MessageComponent): model_config = GenPPBCPowerSequenceContainer.model_config model_config["validate_assignment"] = True - id: uuid.UUID = GenPPBCPowerSequenceContainer.model_fields["id"] # type: ignore[assignment] - power_sequences: List[PPBCPowerSequence] = ( - GenPPBCPowerSequenceContainer.model_fields["power_sequences"] # type: ignore[assignment] - ) + id: uuid.UUID = GenPPBCPowerSequenceContainer.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + power_sequences: List[PPBCPowerSequence] = GenPPBCPowerSequenceContainer.model_fields[ # type: ignore[reportIncompatibleVariableOverride] + "power_sequences" + ] # type: ignore[assignment] diff --git a/src/s2python/ppbc/ppbc_power_sequence_container_status.py b/src/s2python/ppbc/ppbc_power_sequence_container_status.py index 19e897d..81fb48a 100644 --- a/src/s2python/ppbc/ppbc_power_sequence_container_status.py +++ b/src/s2python/ppbc/ppbc_power_sequence_container_status.py @@ -12,21 +12,19 @@ @catch_and_convert_exceptions -class PPBCPowerSequenceContainerStatus( - GenPPBCPowerSequenceContainerStatus, S2MessageComponent["PPBCPowerSequenceContainerStatus"] -): +class PPBCPowerSequenceContainerStatus(GenPPBCPowerSequenceContainerStatus, S2MessageComponent): model_config = GenPPBCPowerSequenceContainerStatus.model_config model_config["validate_assignment"] = True - power_profile_id: uuid.UUID = GenPPBCPowerSequenceContainerStatus.model_fields[ + power_profile_id: uuid.UUID = GenPPBCPowerSequenceContainerStatus.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "power_profile_id" # type: ignore[assignment] ] - sequence_container_id: uuid.UUID = GenPPBCPowerSequenceContainerStatus.model_fields[ + sequence_container_id: uuid.UUID = GenPPBCPowerSequenceContainerStatus.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "sequence_container_id" # type: ignore[assignment] ] - selected_sequence_id: Union[uuid.UUID, None] = ( - GenPPBCPowerSequenceContainerStatus.model_fields["selected_sequence_id"] # type: ignore[assignment] - ) - progress: Union[uuid.UUID, None] = GenPPBCPowerSequenceContainerStatus.model_fields[ + selected_sequence_id: Union[uuid.UUID, None] = GenPPBCPowerSequenceContainerStatus.model_fields[ # type: ignore[reportIncompatibleVariableOverride] + "selected_sequence_id" + ] # type: ignore[assignment] + progress: Union[uuid.UUID, None] = GenPPBCPowerSequenceContainerStatus.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "progress" # type: ignore[assignment] ] diff --git a/src/s2python/ppbc/ppbc_power_sequence_element.py b/src/s2python/ppbc/ppbc_power_sequence_element.py index 206f5ec..444bd08 100644 --- a/src/s2python/ppbc/ppbc_power_sequence_element.py +++ b/src/s2python/ppbc/ppbc_power_sequence_element.py @@ -13,13 +13,11 @@ @catch_and_convert_exceptions -class PPBCPowerSequenceElement( - GenPPBCPowerSequenceElement, S2MessageComponent["PPBCPowerSequenceElement"] -): +class PPBCPowerSequenceElement(GenPPBCPowerSequenceElement, S2MessageComponent): model_config = GenPPBCPowerSequenceElement.model_config model_config["validate_assignment"] = True - duration: Duration = GenPPBCPowerSequenceElement.model_fields["duration"] # type: ignore[assignment] - power_values: List[PowerForecastValue] = GenPPBCPowerSequenceElement.model_fields[ + duration: Duration = GenPPBCPowerSequenceElement.model_fields["duration"] # type: ignore[assignment,reportIncompatibleVariableOverride] + power_values: List[PowerForecastValue] = GenPPBCPowerSequenceElement.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "power_values" ] # type: ignore[assignment] diff --git a/src/s2python/ppbc/ppbc_schedule_instruction.py b/src/s2python/ppbc/ppbc_schedule_instruction.py index 2e7802d..2434e93 100644 --- a/src/s2python/ppbc/ppbc_schedule_instruction.py +++ b/src/s2python/ppbc/ppbc_schedule_instruction.py @@ -10,24 +10,22 @@ @catch_and_convert_exceptions -class PPBCScheduleInstruction( - GenPPBCScheduleInstruction, S2MessageComponent["PPBCScheduleInstruction"] -): +class PPBCScheduleInstruction(GenPPBCScheduleInstruction, S2MessageComponent): model_config = GenPPBCScheduleInstruction.model_config model_config["validate_assignment"] = True - id: uuid.UUID = GenPPBCScheduleInstruction.model_fields["id"] # type: ignore[assignment] + id: uuid.UUID = GenPPBCScheduleInstruction.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] - power_profile_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields[ + power_profile_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "power_profile_id" ] # type: ignore[assignment] - message_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields["message_id"] # type: ignore[assignment] + message_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride] - sequence_container_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields[ + sequence_container_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "sequence_container_id" ] # type: ignore[assignment] - power_sequence_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields[ + power_sequence_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "power_sequence_id" ] # type: ignore[assignment] diff --git a/src/s2python/ppbc/ppbc_start_interruption_instruction.py b/src/s2python/ppbc/ppbc_start_interruption_instruction.py index 0924021..a9fdea6 100644 --- a/src/s2python/ppbc/ppbc_start_interruption_instruction.py +++ b/src/s2python/ppbc/ppbc_start_interruption_instruction.py @@ -11,22 +11,20 @@ @catch_and_convert_exceptions -class PPBCStartInterruptionInstruction( - GenPPBCStartInterruptionInstruction, S2MessageComponent["PPBCStartInterruptionInstruction"] -): +class PPBCStartInterruptionInstruction(GenPPBCStartInterruptionInstruction, S2MessageComponent): model_config = GenPPBCStartInterruptionInstruction.model_config model_config["validate_assignment"] = True - id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields["id"] # type: ignore[assignment] - power_profile_id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields[ + id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride] + power_profile_id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "power_profile_id" ] # type: ignore[assignment] - sequence_container_id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields[ + sequence_container_id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "sequence_container_id" ] # type: ignore[assignment] - power_sequence_id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields[ + power_sequence_id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "power_sequence_id" ] # type: ignore[assignment] - abnormal_condition: bool = GenPPBCStartInterruptionInstruction.model_fields[ + abnormal_condition: bool = GenPPBCStartInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride] "abnormal_condition" ] # type: ignore[assignment] diff --git a/src/s2python/s2_connection.py b/src/s2python/s2_connection.py index cfc915e..897344c 100644 --- a/src/s2python/s2_connection.py +++ b/src/s2python/s2_connection.py @@ -36,7 +36,7 @@ @dataclass class AssetDetails: # pylint: disable=too-many-instance-attributes - resource_id: str + resource_id: uuid.UUID provides_forecast: bool provides_power_measurements: List[CommodityQuantity] @@ -51,9 +51,13 @@ class AssetDetails: # pylint: disable=too-many-instance-attributes firmware_version: Optional[str] = None serial_number: Optional[str] = None - def to_resource_manager_details(self, control_types: List[S2ControlType]) -> ResourceManagerDetails: + def to_resource_manager_details( + self, control_types: List[S2ControlType] + ) -> ResourceManagerDetails: return ResourceManagerDetails( - available_control_types=[control_type.get_protocol_control_type() for control_type in control_types], + available_control_types=[ + control_type.get_protocol_control_type() for control_type in control_types + ], currency=self.currency, firmware_version=self.firmware_version, instruction_processing_delay=self.instruction_processing_delay, @@ -89,7 +93,7 @@ async def run_async(self) -> None: self.status_is_send.set() await self.connection.respond_with_reception_status( - subject_message_id=str(self.subject_message_id), + subject_message_id=self.subject_message_id, status=ReceptionStatusValues.OK, diagnostic_label="Processed okay.", ) @@ -98,7 +102,7 @@ def run_sync(self) -> None: self.status_is_send.set() self.connection.respond_with_reception_status_sync( - subject_message_id=str(self.subject_message_id), + subject_message_id=self.subject_message_id, status=ReceptionStatusValues.OK, diagnostic_label="Processed okay.", ) @@ -155,7 +159,7 @@ def do_message() -> None: except Exception: if not send_okay.status_is_send.is_set(): await connection.respond_with_reception_status( - subject_message_id=str(msg.message_id), # type: ignore[attr-defined, union-attr] + subject_message_id=msg.message_id, # type: ignore[attr-defined, union-attr] status=ReceptionStatusValues.PERMANENT_ERROR, diagnostic_label=f"While processing message {msg.message_id} " # type: ignore[attr-defined, union-attr] # pylint: disable=line-too-long f"an unrecoverable error occurred.", @@ -294,7 +298,9 @@ async def wait_till_connection_restart() -> None: self._eventloop.create_task(wait_till_connection_restart()), ] - (done, pending) = await asyncio.wait(background_tasks, return_when=asyncio.FIRST_COMPLETED) + (done, pending) = await asyncio.wait( + background_tasks, return_when=asyncio.FIRST_COMPLETED + ) if self._current_control_type: self._current_control_type.deactivate(self) self._current_control_type = None @@ -327,7 +333,9 @@ async def _connect_ws(self) -> None: connection_kwargs["ssl"].verify_mode = ssl.CERT_NONE if self._bearer_token: - connection_kwargs["additional_headers"] = {"Authorization": f"Bearer {self._bearer_token}"} + connection_kwargs["additional_headers"] = { + "Authorization": f"Bearer {self._bearer_token}" + } self.ws = await ws_connect(uri=self.url, **connection_kwargs) except (EOFError, OSError) as e: @@ -335,15 +343,21 @@ async def _connect_ws(self) -> None: async def _connect_as_rm(self) -> None: await self.send_msg_and_await_reception_status_async( - Handshake(message_id=uuid.uuid4(), role=self.role, supported_protocol_versions=[S2_VERSION]) + Handshake( + message_id=uuid.uuid4(), role=self.role, supported_protocol_versions=[S2_VERSION] + ) ) logger.debug("Send handshake to CEM. Expecting Handshake and HandshakeResponse from CEM.") await self._handle_received_messages() - async def handle_handshake(self, _: "S2Connection", message: S2Message, send_okay: Awaitable[None]) -> None: + async def handle_handshake( + self, _: "S2Connection", message: S2Message, send_okay: Awaitable[None] + ) -> None: if not isinstance(message, Handshake): - logger.error("Handler for Handshake received a message of the wrong type: %s", type(message)) + logger.error( + "Handler for Handshake received a message of the wrong type: %s", type(message) + ) return logger.debug( @@ -387,8 +401,12 @@ async def handle_select_control_type_as_rm( logger.debug("CEM selected control type %s. Activating control type.", message.control_type) - control_types_by_protocol_name = {c.get_protocol_control_type(): c for c in self.control_types} - selected_control_type: Optional[S2ControlType] = control_types_by_protocol_name.get(message.control_type) + control_types_by_protocol_name = { + c.get_protocol_control_type(): c for c in self.control_types + } + selected_control_type: Optional[S2ControlType] = control_types_by_protocol_name.get( + message.control_type + ) if self._current_control_type is not None: await self._eventloop.run_in_executor(None, self._current_control_type.deactivate, self) @@ -406,7 +424,9 @@ async def _receive_messages(self) -> None: to any calls of `send_msg_and_await_reception_status`. """ if self.ws is None: - raise RuntimeError("Cannot receive messages if websocket connection is not yet established.") + raise RuntimeError( + "Cannot receive messages if websocket connection is not yet established." + ) logger.info("S2 connection has started to receive messages.") @@ -416,7 +436,7 @@ async def _receive_messages(self) -> None: except json.JSONDecodeError: await self._send_and_forget( ReceptionStatus( - subject_message_id="00000000-0000-0000-0000-000000000000", + subject_message_id=uuid.UUID("00000000-0000-0000-0000-000000000000"), status=ReceptionStatusValues.INVALID_DATA, diagnostic_label="Not valid json.", ) @@ -432,7 +452,7 @@ async def _receive_messages(self) -> None: ) else: await self.respond_with_reception_status( - subject_message_id="00000000-0000-0000-0000-000000000000", + subject_message_id=uuid.UUID("00000000-0000-0000-0000-000000000000"), status=ReceptionStatusValues.INVALID_DATA, diagnostic_label="Message appears valid json but could not find a message_id field.", ) @@ -450,7 +470,9 @@ async def _receive_messages(self) -> None: async def _send_and_forget(self, s2_msg: S2Message) -> None: if self.ws is None: - raise RuntimeError("Cannot send messages if websocket connection is not yet established.") + raise RuntimeError( + "Cannot send messages if websocket connection is not yet established." + ) json_msg = s2_msg.to_json() logger.debug("Sending message %s", json_msg) @@ -461,7 +483,7 @@ async def _send_and_forget(self, s2_msg: S2Message) -> None: self._restart_connection_event.set() async def respond_with_reception_status( - self, subject_message_id: str, status: ReceptionStatusValues, diagnostic_label: str + self, subject_message_id: uuid.UUID, status: ReceptionStatusValues, diagnostic_label: str ) -> None: logger.debug("Responding to message %s with status %s", subject_message_id, status) await self._send_and_forget( @@ -473,7 +495,7 @@ async def respond_with_reception_status( ) def respond_with_reception_status_sync( - self, subject_message_id: str, status: ReceptionStatusValues, diagnostic_label: str + self, subject_message_id: uuid.UUID, status: ReceptionStatusValues, diagnostic_label: str ) -> None: asyncio.run_coroutine_threadsafe( self.respond_with_reception_status(subject_message_id, status, diagnostic_label), @@ -510,7 +532,9 @@ def send_msg_and_await_reception_status_sync( self, s2_msg: S2Message, timeout_reception_status: float = 5.0, raise_on_error: bool = True ) -> ReceptionStatus: return asyncio.run_coroutine_threadsafe( - self.send_msg_and_await_reception_status_async(s2_msg, timeout_reception_status, raise_on_error), + self.send_msg_and_await_reception_status_async( + s2_msg, timeout_reception_status, raise_on_error + ), self._eventloop, ).result() diff --git a/src/s2python/validate_values_mixin.py b/src/s2python/validate_values_mixin.py index fa4a8d7..6026b0d 100644 --- a/src/s2python/validate_values_mixin.py +++ b/src/s2python/validate_values_mixin.py @@ -1,22 +1,34 @@ -from typing import TypeVar, Generic, Type, Callable, Any, Union, AbstractSet, Mapping, List, Dict +from typing import ( + TypeVar, + Type, + Callable, + Any, + Union, + AbstractSet, + Mapping, + List, + Dict, +) + +from typing_extensions import Self -from pydantic import BaseModel, ValidationError # pylint: disable=no-name-in-module from pydantic.v1.error_wrappers import display_errors # pylint: disable=no-name-in-module +from pydantic import ( # pylint: disable=no-name-in-module + BaseModel, + ValidationError, +) + from s2python.s2_validation_error import S2ValidationError -B_co = TypeVar("B_co", bound=BaseModel, covariant=True) IntStr = Union[int, str] AbstractSetIntStr = AbstractSet[IntStr] MappingIntStrAny = Mapping[IntStr, Any] -C = TypeVar("C", bound="BaseModel") - - -class S2MessageComponent(BaseModel, Generic[C]): - def to_json(self: C) -> str: +class S2MessageComponent(BaseModel): + def to_json(self) -> str: try: return self.model_dump_json(by_alias=True, exclude_none=True) except (ValidationError, TypeError) as e: @@ -24,17 +36,17 @@ def to_json(self: C) -> str: type(self), self, "Pydantic raised a format validation error.", e ) from e - def to_dict(self: C) -> Dict: + def to_dict(self) -> Dict[str, Any]: return self.model_dump() @classmethod - def from_json(cls: Type[C], json_str: str) -> C: - gen_model: C = cls.model_validate_json(json_str) + def from_json(cls, json_str: str) -> Self: + gen_model = cls.model_validate_json(json_str) return gen_model @classmethod - def from_dict(cls: Type[C], json_dict: dict) -> C: - gen_model: C = cls.model_validate(json_dict) + def from_dict(cls, json_dict: Dict[str, Any]) -> Self: + gen_model = cls.model_validate(json_dict) return gen_model diff --git a/tests/unit/common/power_forecast_element_test.py b/tests/unit/common/power_forecast_element_test.py index 116c3b9..4f68f45 100644 --- a/tests/unit/common/power_forecast_element_test.py +++ b/tests/unit/common/power_forecast_element_test.py @@ -29,7 +29,7 @@ def test__from_json__happy_path(self): self.assertEqual( power_forecast_element.power_values, [ - PowerForecastValue( + PowerForecastValue( # pyright: ignore[reportCallIssue] commodity_quantity=CommodityQuantity.NATURAL_GAS_FLOW_RATE, value_expected=500.2, ) @@ -40,7 +40,7 @@ def test__to_json__happy_path(self): # Arrange power_forecast_element = PowerForecastElement( power_values=[ - PowerForecastValue( + PowerForecastValue( # pyright: ignore[reportCallIssue] commodity_quantity=CommodityQuantity.NATURAL_GAS_FLOW_RATE, value_expected=500.2, ) @@ -54,6 +54,8 @@ def test__to_json__happy_path(self): # Assert expected_json = { "duration": 4000, - "power_values": [{"commodity_quantity": "NATURAL_GAS.FLOW_RATE", "value_expected": 500.2}], + "power_values": [ + {"commodity_quantity": "NATURAL_GAS.FLOW_RATE", "value_expected": 500.2} + ], } self.assertEqual(json.loads(json_str), expected_json) diff --git a/tests/unit/common/power_forecast_test.py b/tests/unit/common/power_forecast_test.py index b3ecb47..044365e 100644 --- a/tests/unit/common/power_forecast_test.py +++ b/tests/unit/common/power_forecast_test.py @@ -28,7 +28,7 @@ def test__from_json__happy_path(self): # Assert power_forecast_element = PowerForecastElement( power_values=[ - PowerForecastValue( + PowerForecastValue( # pyright: ignore[reportCallIssue] commodity_quantity=CommodityQuantity.NATURAL_GAS_FLOW_RATE, value_expected=500.2, ) @@ -48,7 +48,7 @@ def test__to_json__happy_path(self): # Arrange power_forecast_element = PowerForecastElement( power_values=[ - PowerForecastValue( + PowerForecastValue( # pyright: ignore[reportCallIssue] commodity_quantity=CommodityQuantity.NATURAL_GAS_FLOW_RATE, value_expected=500.2, ) @@ -58,9 +58,7 @@ def test__to_json__happy_path(self): power_forecast = PowerForecast( elements=[power_forecast_element], message_id=uuid.UUID("2bdec96b-be3b-4ba9-afa0-c4a0632cced9"), - start_time=datetime( - 2023, 8, 2, 12, 48, 42, tzinfo=offset(timedelta(hours=2)) - ), + start_time=datetime(2023, 8, 2, 12, 48, 42, tzinfo=offset(timedelta(hours=2))), ) # Act diff --git a/tests/unit/common/power_forecast_value_test.py b/tests/unit/common/power_forecast_value_test.py index d7c37e4..f5949fb 100644 --- a/tests/unit/common/power_forecast_value_test.py +++ b/tests/unit/common/power_forecast_value_test.py @@ -31,7 +31,7 @@ def test__from_json__happy_path(self): def test__to_json__happy_path(self): # Arrange - power_forecast_value = PowerForecastValue( + power_forecast_value = PowerForecastValue( # pyright: ignore[reportCallIssue] commodity_quantity=CommodityQuantity.HEAT_TEMPERATURE, value_lower_limit=450.3, value_lower_95PPR=470.4, @@ -60,7 +60,7 @@ def test__to_json__happy_path(self): def test__to_json__only_value_expected(self): # Arrange - power_forecast_value = PowerForecastValue( + power_forecast_value = PowerForecastValue( # pyright: ignore[reportCallIssue] commodity_quantity=CommodityQuantity.HEAT_TEMPERATURE, value_expected=500.2 ) diff --git a/tests/unit/common/select_control_type_test.py b/tests/unit/common/select_control_type_test.py index af19bb2..8f8fae2 100644 --- a/tests/unit/common/select_control_type_test.py +++ b/tests/unit/common/select_control_type_test.py @@ -22,14 +22,12 @@ def test__from_json__happy_path(self): select_control_type.message_id, uuid.UUID("3bdec96b-be3b-4ba9-afa0-c4a0632cced5"), ) - self.assertEqual( - select_control_type.control_type, ControlType.OPERATION_MODE_BASED_CONTROL - ) + self.assertEqual(select_control_type.control_type, ControlType.OPERATION_MODE_BASED_CONTROL) def test__to_json__happy_path(self): # Arrange select_control_type = SelectControlType( - message_id="3bdec96b-be3b-4ba9-afa1-c4a0632cced5", + message_id=uuid.UUID("3bdec96b-be3b-4ba9-afa1-c4a0632cced5"), control_type=ControlType.DEMAND_DRIVEN_BASED_CONTROL, ) diff --git a/tests/unit/common/session_request_test.py b/tests/unit/common/session_request_test.py index 9f8b087..4813bcf 100644 --- a/tests/unit/common/session_request_test.py +++ b/tests/unit/common/session_request_test.py @@ -26,7 +26,7 @@ def test__from_json__happy_path(self): def test__to_json__happy_path(self): # Arrange - session_request = SessionRequest( + session_request = SessionRequest( # pyright: ignore[reportCallIssue] message_id=uuid.UUID("3bdec96e-be3b-4ba9-afa0-c4a0632cced5"), request=SessionRequestType.RECONNECT, ) diff --git a/tests/unit/common/timer_test.py b/tests/unit/common/timer_test.py index 0a952c1..e319b8c 100644 --- a/tests/unit/common/timer_test.py +++ b/tests/unit/common/timer_test.py @@ -26,7 +26,7 @@ def test__from_json__happy_path(self): def test_optional_parameters(self): # Arrange / Act - timer = Timer( + timer = Timer( # pyright: ignore[reportCallIssue] id=uuid.UUID("2bdec96b-be3b-4ba9-afa0-c4a0632ccedf"), duration=Duration.from_timedelta(timedelta(seconds=5)), ) @@ -41,7 +41,9 @@ def test_optional_parameters(self): def test__from_json__format_validation_error(self): # Arrange - json_str = '{"id": "2bdec96b-be3b-4ba9-afa0-c4a0632ccedf", "diagnostic_label": "some_label"}' + json_str = ( + '{"id": "2bdec96b-be3b-4ba9-afa0-c4a0632ccedf", "diagnostic_label": "some_label"}' + ) # Act / Assert with self.assertRaises(S2ValidationError): diff --git a/tests/unit/common/transition_test.py b/tests/unit/common/transition_test.py index 0c9dc9e..ed91ad5 100644 --- a/tests/unit/common/transition_test.py +++ b/tests/unit/common/transition_test.py @@ -129,7 +129,7 @@ def test__to_json__happy_path(self): def test__to_json__value_validation_error_neg_duration(self): # Arrange/ Act / Assert with self.assertRaises(S2ValidationError): - Transition( + Transition( # pyright: ignore[reportCallIssue] id=uuid.UUID("2bdec96b-be3b-4ba9-afa0-c4a0632cced3"), from_=uuid.UUID("2bdec96b-be3b-4ba9-afa0-c4a0632cced2"), to=uuid.UUID("2bdec96b-be3b-4ba9-afa0-c4a0632cced1"), diff --git a/tests/unit/reception_status_awaiter_test.py b/tests/unit/reception_status_awaiter_test.py index 167966d..a2f6261 100644 --- a/tests/unit/reception_status_awaiter_test.py +++ b/tests/unit/reception_status_awaiter_test.py @@ -24,7 +24,7 @@ async def test__wait_for_reception_status__receive_while_waiting(self): # Arrange awaiter = ReceptionStatusAwaiter() message_id = uuid.uuid4() - s2_reception_status = ReceptionStatus( + s2_reception_status = ReceptionStatus( # pyright: ignore[reportCallIssue] subject_message_id=message_id, status=ReceptionStatusValues.OK ) @@ -36,7 +36,7 @@ async def test__wait_for_reception_status__receive_while_waiting(self): received_s2_reception_status = wait_task.result() # Assert - expected_s2_reception_status = ReceptionStatus( + expected_s2_reception_status = ReceptionStatus( # pyright: ignore[reportCallIssue] subject_message_id=message_id, status=ReceptionStatusValues.OK ) @@ -47,7 +47,7 @@ async def test__wait_for_reception_status__already_received(self): # Arrange awaiter = ReceptionStatusAwaiter() message_id = uuid.uuid4() - s2_reception_status = ReceptionStatus( + s2_reception_status = ReceptionStatus( # pyright: ignore[reportCallIssue] subject_message_id=message_id, status=ReceptionStatusValues.OK ) @@ -56,7 +56,7 @@ async def test__wait_for_reception_status__already_received(self): received_s2_reception_status = await awaiter.wait_for_reception_status(message_id, 1.0) # Assert - expected_s2_reception_status = ReceptionStatus( + expected_s2_reception_status = ReceptionStatus( # pyright: ignore[reportCallIssue] subject_message_id=message_id, status=ReceptionStatusValues.OK ) self.assertEqual(expected_s2_reception_status, received_s2_reception_status) @@ -65,7 +65,7 @@ async def test__wait_for_reception_status__multiple_receive_while_waiting(self): # Arrange awaiter = ReceptionStatusAwaiter() message_id = uuid.uuid4() - s2_reception_status = ReceptionStatus( + s2_reception_status = ReceptionStatus( # pyright: ignore[reportCallIssue] subject_message_id=message_id, status=ReceptionStatusValues.OK ) @@ -81,7 +81,7 @@ async def test__wait_for_reception_status__multiple_receive_while_waiting(self): received_s2_reception_status_2 = wait_task_2.result() # Assert - expected_s2_reception_status = ReceptionStatus( + expected_s2_reception_status = ReceptionStatus( # pyright: ignore[reportCallIssue] subject_message_id=message_id, status=ReceptionStatusValues.OK ) @@ -107,7 +107,7 @@ async def test__receive_reception_status__wrong_message(self): async def test__receive_reception_status__received_duplicate(self): # Arrange awaiter = ReceptionStatusAwaiter() - s2_reception_status = ReceptionStatus( + s2_reception_status = ReceptionStatus( # pyright: ignore[reportCallIssue] subject_message_id=uuid.uuid4(), status=ReceptionStatusValues.OK ) @@ -120,7 +120,7 @@ async def test__receive_reception_status__receive_no_awaiting(self): # Arrange awaiter = ReceptionStatusAwaiter() message_id = uuid.uuid4() - s2_reception_status = ReceptionStatus( + s2_reception_status = ReceptionStatus( # pyright: ignore[reportCallIssue] subject_message_id=message_id, status=ReceptionStatusValues.OK ) @@ -129,7 +129,7 @@ async def test__receive_reception_status__receive_no_awaiting(self): # Assert expected_received = { - message_id: ReceptionStatus( + message_id: ReceptionStatus( # pyright: ignore[reportCallIssue] subject_message_id=message_id, status=ReceptionStatusValues.OK ) } @@ -142,7 +142,7 @@ async def test__receive_reception_status__receive_with_awaiting(self): awaiting_event = asyncio.Event() message_id = uuid.uuid4() awaiter.awaiting = {message_id: awaiting_event} - s2_reception_status = ReceptionStatus( + s2_reception_status = ReceptionStatus( # pyright: ignore[reportCallIssue] subject_message_id=message_id, status=ReceptionStatusValues.OK ) @@ -153,7 +153,7 @@ async def test__receive_reception_status__receive_with_awaiting(self): # Assert expected_received = { - message_id: ReceptionStatus( + message_id: ReceptionStatus( # pyright: ignore[reportCallIssue] subject_message_id=message_id, status=ReceptionStatusValues.OK ) }