s2-python 0.2.0__tar.gz → 0.2.0.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/PKG-INFO +2 -3
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/setup.cfg +2 -3
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2_python.egg-info/PKG-INFO +2 -3
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2_python.egg-info/SOURCES.txt +0 -4
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2_python.egg-info/requires.txt +1 -2
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/duration.py +3 -3
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/handshake.py +3 -3
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/handshake_response.py +3 -3
- s2_python-0.2.0.dev2/src/s2python/common/instruction_status_update.py +22 -0
- s2_python-0.2.0.dev2/src/s2python/common/number_range.py +39 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/power_forecast.py +6 -4
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/power_forecast_element.py +5 -5
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/power_forecast_value.py +2 -2
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/power_measurement.py +4 -4
- s2_python-0.2.0.dev2/src/s2python/common/power_range.py +27 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/power_value.py +2 -2
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/reception_status.py +5 -3
- s2_python-0.2.0.dev2/src/s2python/common/resource_manager_details.py +27 -0
- s2_python-0.2.0.dev2/src/s2python/common/revoke_object.py +16 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/role.py +2 -2
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/select_control_type.py +3 -3
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/session_request.py +3 -3
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/timer.py +4 -4
- s2_python-0.2.0.dev2/src/s2python/common/transition.py +26 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/frbc/frbc_actuator_description.py +79 -52
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/frbc/frbc_actuator_status.py +8 -8
- s2_python-0.2.0.dev2/src/s2python/frbc/frbc_fill_level_target_profile.py +30 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/frbc/frbc_fill_level_target_profile_element.py +7 -5
- s2_python-0.2.0.dev2/src/s2python/frbc/frbc_instruction.py +18 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/frbc/frbc_leakage_behaviour.py +5 -5
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/frbc/frbc_leakage_behaviour_element.py +7 -5
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/frbc/frbc_operation_mode.py +27 -16
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/frbc/frbc_operation_mode_element.py +12 -10
- s2_python-0.2.0.dev2/src/s2python/frbc/frbc_storage_description.py +20 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/frbc/frbc_storage_status.py +3 -3
- s2_python-0.2.0.dev2/src/s2python/frbc/frbc_system_description.py +26 -0
- s2_python-0.2.0.dev2/src/s2python/frbc/frbc_timer_status.py +17 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/frbc/frbc_usage_forecast.py +6 -4
- s2_python-0.2.0.dev2/src/s2python/frbc/frbc_usage_forecast_element.py +19 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/generated/gen_s2.py +327 -344
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/s2_parser.py +8 -8
- s2_python-0.2.0.dev2/src/s2python/s2_validation_error.py +13 -0
- s2_python-0.2.0.dev2/src/s2python/validate_values_mixin.py +148 -0
- s2_python-0.2.0.dev2/src/s2python/version.py +1 -0
- s2_python-0.2.0/src/s2python/common/instruction_status_update.py +0 -18
- s2_python-0.2.0/src/s2python/common/number_range.py +0 -32
- s2_python-0.2.0/src/s2python/common/power_range.py +0 -22
- s2_python-0.2.0/src/s2python/common/resource_manager_details.py +0 -25
- s2_python-0.2.0/src/s2python/common/revoke_object.py +0 -16
- s2_python-0.2.0/src/s2python/common/transition.py +0 -24
- s2_python-0.2.0/src/s2python/frbc/frbc_fill_level_target_profile.py +0 -24
- s2_python-0.2.0/src/s2python/frbc/frbc_instruction.py +0 -18
- s2_python-0.2.0/src/s2python/frbc/frbc_storage_description.py +0 -18
- s2_python-0.2.0/src/s2python/frbc/frbc_system_description.py +0 -22
- s2_python-0.2.0/src/s2python/frbc/frbc_timer_status.py +0 -17
- s2_python-0.2.0/src/s2python/frbc/frbc_usage_forecast_element.py +0 -17
- s2_python-0.2.0/src/s2python/frbc/rm.py +0 -0
- s2_python-0.2.0/src/s2python/reception_status_awaiter.py +0 -60
- s2_python-0.2.0/src/s2python/s2_connection.py +0 -470
- s2_python-0.2.0/src/s2python/s2_control_type.py +0 -56
- s2_python-0.2.0/src/s2python/s2_validation_error.py +0 -13
- s2_python-0.2.0/src/s2python/validate_values_mixin.py +0 -70
- s2_python-0.2.0/src/s2python/version.py +0 -3
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/README.rst +0 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/pyproject.toml +0 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/setup.py +0 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2_python.egg-info/dependency_links.txt +0 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2_python.egg-info/entry_points.txt +0 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2_python.egg-info/not-zip-safe +0 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2_python.egg-info/top_level.txt +0 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/__init__.py +0 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/__init__.py +1 -1
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/common/support.py +0 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/frbc/__init__.py +0 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/generated/__init__.py +0 -0
- {s2_python-0.2.0 → s2_python-0.2.0.dev2}/src/s2python/utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: s2-python
|
3
|
-
Version: 0.2.0
|
3
|
+
Version: 0.2.0.dev2
|
4
4
|
Summary: S2 Protocol Python Wrapper
|
5
5
|
Home-page: https://github.com/flexiblepower/s2-ws-json-python
|
6
6
|
Author: Flexiblepower
|
@@ -14,10 +14,9 @@ Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
16
16
|
Description-Content-Type: text/x-rst; charset=UTF-8
|
17
|
-
Requires-Dist: pydantic~=
|
17
|
+
Requires-Dist: pydantic~=1.10.7
|
18
18
|
Requires-Dist: pytz
|
19
19
|
Requires-Dist: click
|
20
|
-
Requires-Dist: websockets~=13.0.1
|
21
20
|
Provides-Extra: testing
|
22
21
|
Requires-Dist: pytest; extra == "testing"
|
23
22
|
Requires-Dist: pytest-coverage; extra == "testing"
|
@@ -8,7 +8,7 @@ license_files = LICENSE.txt
|
|
8
8
|
long_description = file: README.rst
|
9
9
|
long_description_content_type = text/x-rst; charset=UTF-8
|
10
10
|
url = https://github.com/flexiblepower/s2-ws-json-python
|
11
|
-
version = 0.2.0
|
11
|
+
version = 0.2.0.dev2
|
12
12
|
platforms = Linux
|
13
13
|
classifiers =
|
14
14
|
Development Status :: 4 - Beta
|
@@ -26,10 +26,9 @@ package_dir =
|
|
26
26
|
=src
|
27
27
|
python_requires > = 3.8, <= 3.12
|
28
28
|
install_requires =
|
29
|
-
pydantic~=
|
29
|
+
pydantic~=1.10.7
|
30
30
|
pytz
|
31
31
|
click
|
32
|
-
websockets~=13.0.1
|
33
32
|
|
34
33
|
[options.packages.find]
|
35
34
|
where = src
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: s2-python
|
3
|
-
Version: 0.2.0
|
3
|
+
Version: 0.2.0.dev2
|
4
4
|
Summary: S2 Protocol Python Wrapper
|
5
5
|
Home-page: https://github.com/flexiblepower/s2-ws-json-python
|
6
6
|
Author: Flexiblepower
|
@@ -14,10 +14,9 @@ Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
16
16
|
Description-Content-Type: text/x-rst; charset=UTF-8
|
17
|
-
Requires-Dist: pydantic~=
|
17
|
+
Requires-Dist: pydantic~=1.10.7
|
18
18
|
Requires-Dist: pytz
|
19
19
|
Requires-Dist: click
|
20
|
-
Requires-Dist: websockets~=13.0.1
|
21
20
|
Provides-Extra: testing
|
22
21
|
Requires-Dist: pytest; extra == "testing"
|
23
22
|
Requires-Dist: pytest-coverage; extra == "testing"
|
@@ -10,9 +10,6 @@ src/s2_python.egg-info/not-zip-safe
|
|
10
10
|
src/s2_python.egg-info/requires.txt
|
11
11
|
src/s2_python.egg-info/top_level.txt
|
12
12
|
src/s2python/__init__.py
|
13
|
-
src/s2python/reception_status_awaiter.py
|
14
|
-
src/s2python/s2_connection.py
|
15
|
-
src/s2python/s2_control_type.py
|
16
13
|
src/s2python/s2_parser.py
|
17
14
|
src/s2python/s2_validation_error.py
|
18
15
|
src/s2python/utils.py
|
@@ -55,6 +52,5 @@ src/s2python/frbc/frbc_system_description.py
|
|
55
52
|
src/s2python/frbc/frbc_timer_status.py
|
56
53
|
src/s2python/frbc/frbc_usage_forecast.py
|
57
54
|
src/s2python/frbc/frbc_usage_forecast_element.py
|
58
|
-
src/s2python/frbc/rm.py
|
59
55
|
src/s2python/generated/__init__.py
|
60
56
|
src/s2python/generated/gen_s2.py
|
@@ -11,12 +11,12 @@ from s2python.validate_values_mixin import (
|
|
11
11
|
@catch_and_convert_exceptions
|
12
12
|
class Duration(GenDuration, S2Message["Duration"]):
|
13
13
|
def to_timedelta(self) -> timedelta:
|
14
|
-
return timedelta(milliseconds=self.
|
14
|
+
return timedelta(milliseconds=self.__root__)
|
15
15
|
|
16
16
|
@staticmethod
|
17
17
|
def from_timedelta(duration: timedelta) -> "Duration":
|
18
|
-
return Duration(
|
18
|
+
return Duration(__root__=math.ceil(duration.total_seconds() * 1000))
|
19
19
|
|
20
20
|
@staticmethod
|
21
21
|
def from_milliseconds(milliseconds: int) -> "Duration":
|
22
|
-
return Duration(
|
22
|
+
return Duration(__root__=milliseconds)
|
@@ -9,7 +9,7 @@ from s2python.validate_values_mixin import (
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
11
|
class Handshake(GenHandshake, S2Message["Handshake"]):
|
12
|
-
|
13
|
-
|
12
|
+
class Config(GenHandshake.Config):
|
13
|
+
validate_assignment = True
|
14
14
|
|
15
|
-
message_id: uuid.UUID = GenHandshake.
|
15
|
+
message_id: uuid.UUID = GenHandshake.__fields__["message_id"].field_info # type: ignore[assignment]
|
@@ -9,7 +9,7 @@ from s2python.validate_values_mixin import (
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
11
|
class HandshakeResponse(GenHandshakeResponse, S2Message["HandshakeResponse"]):
|
12
|
-
|
13
|
-
|
12
|
+
class Config(GenHandshakeResponse.Config):
|
13
|
+
validate_assignment = True
|
14
14
|
|
15
|
-
message_id: uuid.UUID = GenHandshakeResponse.
|
15
|
+
message_id: uuid.UUID = GenHandshakeResponse.__fields__["message_id"].field_info # type: ignore[assignment]
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import uuid
|
2
|
+
|
3
|
+
from s2python.generated.gen_s2 import (
|
4
|
+
InstructionStatusUpdate as GenInstructionStatusUpdate,
|
5
|
+
)
|
6
|
+
from s2python.validate_values_mixin import (
|
7
|
+
catch_and_convert_exceptions,
|
8
|
+
S2Message,
|
9
|
+
)
|
10
|
+
|
11
|
+
|
12
|
+
@catch_and_convert_exceptions
|
13
|
+
class InstructionStatusUpdate(
|
14
|
+
GenInstructionStatusUpdate, S2Message["InstructionStatusUpdate"]
|
15
|
+
):
|
16
|
+
class Config(GenInstructionStatusUpdate.Config):
|
17
|
+
validate_assignment = True
|
18
|
+
|
19
|
+
message_id: uuid.UUID = GenInstructionStatusUpdate.__fields__["message_id"].field_info # type: ignore[assignment]
|
20
|
+
instruction_id: uuid.UUID = GenInstructionStatusUpdate.__fields__[
|
21
|
+
"instruction_id"
|
22
|
+
].field_info # type: ignore[assignment]
|
@@ -0,0 +1,39 @@
|
|
1
|
+
from typing import Any, Dict
|
2
|
+
|
3
|
+
from pydantic import root_validator
|
4
|
+
|
5
|
+
from s2python.validate_values_mixin import (
|
6
|
+
S2Message,
|
7
|
+
catch_and_convert_exceptions,
|
8
|
+
)
|
9
|
+
from s2python.generated.gen_s2 import NumberRange as GenNumberRange
|
10
|
+
|
11
|
+
|
12
|
+
@catch_and_convert_exceptions
|
13
|
+
class NumberRange(GenNumberRange, S2Message["NumberRange"]):
|
14
|
+
class Config(GenNumberRange.Config):
|
15
|
+
validate_assignment = True
|
16
|
+
|
17
|
+
@root_validator(pre=False)
|
18
|
+
@classmethod
|
19
|
+
def validate_start_end_order( # pylint: disable=duplicate-code
|
20
|
+
cls, values: Dict[str, Any]
|
21
|
+
) -> Dict[str, Any]:
|
22
|
+
if values.get("start_of_range", 0.0) > values.get("end_of_range", 0.0):
|
23
|
+
raise ValueError(
|
24
|
+
cls, "start_of_range should not be higher than end_of_range"
|
25
|
+
)
|
26
|
+
|
27
|
+
return values
|
28
|
+
|
29
|
+
def __hash__(self) -> int:
|
30
|
+
return hash(f"{self.start_of_range}|{self.end_of_range}")
|
31
|
+
|
32
|
+
def __eq__(self, other: Any) -> bool:
|
33
|
+
if isinstance(other, NumberRange):
|
34
|
+
return (
|
35
|
+
self.start_of_range == other.start_of_range
|
36
|
+
and self.end_of_range == other.end_of_range
|
37
|
+
)
|
38
|
+
|
39
|
+
return False
|
@@ -11,8 +11,10 @@ from s2python.validate_values_mixin import (
|
|
11
11
|
|
12
12
|
@catch_and_convert_exceptions
|
13
13
|
class PowerForecast(GenPowerForecast, S2Message["PowerForecast"]):
|
14
|
-
|
15
|
-
|
14
|
+
class Config(GenPowerForecast.Config):
|
15
|
+
validate_assignment = True
|
16
16
|
|
17
|
-
message_id: uuid.UUID = GenPowerForecast.
|
18
|
-
elements: List[PowerForecastElement] = GenPowerForecast.
|
17
|
+
message_id: uuid.UUID = GenPowerForecast.__fields__["message_id"].field_info # type: ignore[assignment]
|
18
|
+
elements: List[PowerForecastElement] = GenPowerForecast.__fields__[
|
19
|
+
"elements"
|
20
|
+
].field_info # type: ignore[assignment]
|
@@ -11,10 +11,10 @@ from s2python.common.power_forecast_value import PowerForecastValue
|
|
11
11
|
|
12
12
|
@catch_and_convert_exceptions
|
13
13
|
class PowerForecastElement(GenPowerForecastElement, S2Message["PowerForecastElement"]):
|
14
|
-
|
15
|
-
|
14
|
+
class Config(GenPowerForecastElement.Config):
|
15
|
+
validate_assignment = True
|
16
16
|
|
17
|
-
duration: Duration = GenPowerForecastElement.
|
18
|
-
power_values: List[PowerForecastValue] = GenPowerForecastElement.
|
17
|
+
duration: Duration = GenPowerForecastElement.__fields__["duration"].field_info # type: ignore[assignment]
|
18
|
+
power_values: List[PowerForecastValue] = GenPowerForecastElement.__fields__[
|
19
19
|
"power_values"
|
20
|
-
] # type: ignore[assignment]
|
20
|
+
].field_info # type: ignore[assignment]
|
@@ -7,5 +7,5 @@ from s2python.validate_values_mixin import (
|
|
7
7
|
|
8
8
|
@catch_and_convert_exceptions
|
9
9
|
class PowerForecastValue(GenPowerForecastValue, S2Message["PowerForecastValue"]):
|
10
|
-
|
11
|
-
|
10
|
+
class Config(GenPowerForecastValue.Config):
|
11
|
+
validate_assignment = True
|
@@ -11,8 +11,8 @@ from s2python.validate_values_mixin import (
|
|
11
11
|
|
12
12
|
@catch_and_convert_exceptions
|
13
13
|
class PowerMeasurement(GenPowerMeasurement, S2Message["PowerMeasurement"]):
|
14
|
-
|
15
|
-
|
14
|
+
class Config(GenPowerMeasurement.Config):
|
15
|
+
validate_assignment = True
|
16
16
|
|
17
|
-
message_id: uuid.UUID = GenPowerMeasurement.
|
18
|
-
values: List[PowerValue] = GenPowerMeasurement.
|
17
|
+
message_id: uuid.UUID = GenPowerMeasurement.__fields__["message_id"].field_info # type: ignore[assignment]
|
18
|
+
values: List[PowerValue] = GenPowerMeasurement.__fields__["values"].field_info # type: ignore[assignment]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
from typing import Any, Dict
|
2
|
+
|
3
|
+
from pydantic import root_validator
|
4
|
+
|
5
|
+
from s2python.generated.gen_s2 import PowerRange as GenPowerRange
|
6
|
+
from s2python.validate_values_mixin import (
|
7
|
+
S2Message,
|
8
|
+
catch_and_convert_exceptions,
|
9
|
+
)
|
10
|
+
|
11
|
+
|
12
|
+
@catch_and_convert_exceptions
|
13
|
+
class PowerRange(GenPowerRange, S2Message["PowerRange"]):
|
14
|
+
class Config(GenPowerRange.Config):
|
15
|
+
validate_assignment = True
|
16
|
+
|
17
|
+
@root_validator(pre=False)
|
18
|
+
@classmethod
|
19
|
+
def validate_start_end_order(
|
20
|
+
cls, values: Dict[str, Any]
|
21
|
+
) -> Dict[str, Any]: # pylint: disable=duplicate-code
|
22
|
+
if values.get("start_of_range", 0.0) > values.get("end_of_range", 0.0):
|
23
|
+
raise ValueError(
|
24
|
+
cls, "start_of_range should not be higher than end_of_range"
|
25
|
+
)
|
26
|
+
|
27
|
+
return values
|
@@ -7,5 +7,5 @@ from s2python.validate_values_mixin import (
|
|
7
7
|
|
8
8
|
@catch_and_convert_exceptions
|
9
9
|
class PowerValue(GenPowerValue, S2Message["PowerValue"]):
|
10
|
-
|
11
|
-
|
10
|
+
class Config(GenPowerValue.Config):
|
11
|
+
validate_assignment = True
|
@@ -9,7 +9,9 @@ from s2python.validate_values_mixin import (
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
11
|
class ReceptionStatus(GenReceptionStatus, S2Message["ReceptionStatus"]):
|
12
|
-
|
13
|
-
|
12
|
+
class Config(GenReceptionStatus.Config):
|
13
|
+
validate_assignment = True
|
14
14
|
|
15
|
-
subject_message_id: uuid.UUID = GenReceptionStatus.
|
15
|
+
subject_message_id: uuid.UUID = GenReceptionStatus.__fields__[
|
16
|
+
"subject_message_id"
|
17
|
+
].field_info # type: ignore[assignment]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
from typing import List
|
2
|
+
import uuid
|
3
|
+
|
4
|
+
from s2python.common.duration import Duration
|
5
|
+
from s2python.common.role import Role
|
6
|
+
from s2python.generated.gen_s2 import (
|
7
|
+
ResourceManagerDetails as GenResourceManagerDetails,
|
8
|
+
)
|
9
|
+
from s2python.validate_values_mixin import (
|
10
|
+
catch_and_convert_exceptions,
|
11
|
+
S2Message,
|
12
|
+
)
|
13
|
+
|
14
|
+
|
15
|
+
@catch_and_convert_exceptions
|
16
|
+
class ResourceManagerDetails(
|
17
|
+
GenResourceManagerDetails, S2Message["ResourceManagerDetails"]
|
18
|
+
):
|
19
|
+
class Config(GenResourceManagerDetails.Config):
|
20
|
+
validate_assignment = True
|
21
|
+
|
22
|
+
instruction_processing_delay: Duration = GenResourceManagerDetails.__fields__[
|
23
|
+
"instruction_processing_delay"
|
24
|
+
].field_info # type: ignore[assignment]
|
25
|
+
message_id: uuid.UUID = GenResourceManagerDetails.__fields__["message_id"].field_info # type: ignore[assignment]
|
26
|
+
resource_id: uuid.UUID = GenResourceManagerDetails.__fields__["resource_id"].field_info # type: ignore[assignment]
|
27
|
+
roles: List[Role] = GenResourceManagerDetails.__fields__["roles"].field_info # type: ignore[assignment]
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import uuid
|
2
|
+
|
3
|
+
from s2python.generated.gen_s2 import RevokeObject as GenRevokeObject
|
4
|
+
from s2python.validate_values_mixin import (
|
5
|
+
catch_and_convert_exceptions,
|
6
|
+
S2Message,
|
7
|
+
)
|
8
|
+
|
9
|
+
|
10
|
+
@catch_and_convert_exceptions
|
11
|
+
class RevokeObject(GenRevokeObject, S2Message["RevokeObject"]):
|
12
|
+
class Config(GenRevokeObject.Config):
|
13
|
+
validate_assignment = True
|
14
|
+
|
15
|
+
message_id: uuid.UUID = GenRevokeObject.__fields__["message_id"].field_info # type: ignore[assignment]
|
16
|
+
object_id: uuid.UUID = GenRevokeObject.__fields__["object_id"].field_info # type: ignore[assignment]
|
@@ -9,7 +9,7 @@ from s2python.validate_values_mixin import (
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
11
|
class SelectControlType(GenSelectControlType, S2Message["SelectControlType"]):
|
12
|
-
|
13
|
-
|
12
|
+
class Config(GenSelectControlType.Config):
|
13
|
+
validate_assignment = True
|
14
14
|
|
15
|
-
message_id: uuid.UUID = GenSelectControlType.
|
15
|
+
message_id: uuid.UUID = GenSelectControlType.__fields__["message_id"].field_info # type: ignore[assignment]
|
@@ -9,7 +9,7 @@ from s2python.validate_values_mixin import (
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
11
|
class SessionRequest(GenSessionRequest, S2Message["SessionRequest"]):
|
12
|
-
|
13
|
-
|
12
|
+
class Config(GenSessionRequest.Config):
|
13
|
+
validate_assignment = True
|
14
14
|
|
15
|
-
message_id: uuid.UUID = GenSessionRequest.
|
15
|
+
message_id: uuid.UUID = GenSessionRequest.__fields__["message_id"].field_info # type: ignore[assignment]
|
@@ -10,8 +10,8 @@ from s2python.validate_values_mixin import (
|
|
10
10
|
|
11
11
|
@catch_and_convert_exceptions
|
12
12
|
class Timer(GenTimer, S2Message["Timer"]):
|
13
|
-
|
14
|
-
|
13
|
+
class Config(GenTimer.Config):
|
14
|
+
validate_assignment = True
|
15
15
|
|
16
|
-
id: uuid.UUID = GenTimer.
|
17
|
-
duration: Duration = GenTimer.
|
16
|
+
id: uuid.UUID = GenTimer.__fields__["id"].field_info # type: ignore[assignment]
|
17
|
+
duration: Duration = GenTimer.__fields__["duration"].field_info # type: ignore[assignment]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import uuid
|
2
|
+
from typing import Optional, List
|
3
|
+
|
4
|
+
from s2python.common.duration import Duration
|
5
|
+
from s2python.generated.gen_s2 import Transition as GenTransition
|
6
|
+
from s2python.validate_values_mixin import (
|
7
|
+
S2Message,
|
8
|
+
catch_and_convert_exceptions,
|
9
|
+
)
|
10
|
+
|
11
|
+
|
12
|
+
@catch_and_convert_exceptions
|
13
|
+
class Transition(GenTransition, S2Message["Transition"]):
|
14
|
+
class Config(GenTransition.Config):
|
15
|
+
validate_assignment = True
|
16
|
+
|
17
|
+
id: uuid.UUID = GenTransition.__fields__["id"].field_info # type: ignore[assignment]
|
18
|
+
from_: uuid.UUID = GenTransition.__fields__["from_"].field_info # type: ignore[assignment]
|
19
|
+
to: uuid.UUID = GenTransition.__fields__["to"].field_info # type: ignore[assignment]
|
20
|
+
start_timers: List[uuid.UUID] = GenTransition.__fields__["start_timers"].field_info # type: ignore[assignment]
|
21
|
+
blocking_timers: List[uuid.UUID] = GenTransition.__fields__[
|
22
|
+
"blocking_timers"
|
23
|
+
].field_info # type: ignore[assignment]
|
24
|
+
transition_duration: Optional[Duration] = GenTransition.__fields__[
|
25
|
+
"transition_duration"
|
26
|
+
].field_info # type: ignore[assignment]
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import uuid
|
2
2
|
|
3
|
-
from typing import List
|
4
|
-
from typing_extensions import Self
|
3
|
+
from typing import List, Any, Dict
|
5
4
|
|
6
|
-
from pydantic import
|
5
|
+
from pydantic import root_validator
|
7
6
|
|
8
7
|
from s2python.common import Transition, Timer, Commodity
|
9
8
|
from s2python.common.support import commodity_has_quantity
|
10
9
|
from s2python.frbc.frbc_operation_mode import FRBCOperationMode
|
11
10
|
from s2python.generated.gen_s2 import (
|
12
11
|
FRBCActuatorDescription as GenFRBCActuatorDescription,
|
12
|
+
CommodityQuantity,
|
13
13
|
)
|
14
14
|
from s2python.validate_values_mixin import (
|
15
15
|
S2Message,
|
@@ -18,29 +18,34 @@ from s2python.validate_values_mixin import (
|
|
18
18
|
|
19
19
|
|
20
20
|
@catch_and_convert_exceptions
|
21
|
-
class FRBCActuatorDescription(
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
class FRBCActuatorDescription(
|
22
|
+
GenFRBCActuatorDescription, S2Message["FRBCActuatorDescription"]
|
23
|
+
):
|
24
|
+
class Config(GenFRBCActuatorDescription.Config):
|
25
|
+
validate_assignment = True
|
26
|
+
|
27
|
+
id: uuid.UUID = GenFRBCActuatorDescription.__fields__["id"].field_info # type: ignore[assignment]
|
28
|
+
operation_modes: List[FRBCOperationMode] = GenFRBCActuatorDescription.__fields__[
|
27
29
|
"operation_modes"
|
28
|
-
] # type: ignore[assignment]
|
29
|
-
transitions: List[Transition] = GenFRBCActuatorDescription.
|
30
|
-
|
31
|
-
|
30
|
+
].field_info # type: ignore[assignment]
|
31
|
+
transitions: List[Transition] = GenFRBCActuatorDescription.__fields__[
|
32
|
+
"transitions"
|
33
|
+
].field_info # type: ignore[assignment]
|
34
|
+
timers: List[Timer] = GenFRBCActuatorDescription.__fields__["timers"].field_info # type: ignore[assignment]
|
35
|
+
supported_commodities: List[Commodity] = GenFRBCActuatorDescription.__fields__[
|
32
36
|
"supported_commodities"
|
33
|
-
] # type: ignore[assignment]
|
37
|
+
].field_info # type: ignore[assignment]
|
34
38
|
|
35
|
-
@
|
36
|
-
|
37
|
-
|
39
|
+
@root_validator(pre=False)
|
40
|
+
@classmethod
|
41
|
+
def validate_timers_in_transitions(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
42
|
+
timers_by_id = {timer.id: timer for timer in values.get("timers", {})}
|
38
43
|
transition: Transition
|
39
|
-
for transition in
|
44
|
+
for transition in values.get("transitions", []):
|
40
45
|
for start_timer_id in transition.start_timers:
|
41
46
|
if start_timer_id not in timers_by_id:
|
42
47
|
raise ValueError(
|
43
|
-
|
48
|
+
cls,
|
44
49
|
f"{start_timer_id} was referenced as start timer in transition "
|
45
50
|
f"{transition.id} but was not defined in 'timers'.",
|
46
51
|
)
|
@@ -48,96 +53,118 @@ class FRBCActuatorDescription(GenFRBCActuatorDescription, S2Message["FRBCActuato
|
|
48
53
|
for blocking_timer_id in transition.blocking_timers:
|
49
54
|
if blocking_timer_id not in timers_by_id:
|
50
55
|
raise ValueError(
|
51
|
-
|
56
|
+
cls,
|
52
57
|
f"{blocking_timer_id} was referenced as blocking timer in transition "
|
53
58
|
f"{transition.id} but was not defined in 'timers'.",
|
54
59
|
)
|
55
60
|
|
56
|
-
return
|
61
|
+
return values
|
57
62
|
|
58
|
-
@
|
59
|
-
|
63
|
+
@root_validator(pre=False)
|
64
|
+
@classmethod
|
65
|
+
def validate_timers_unique_ids(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
60
66
|
ids = []
|
61
67
|
timer: Timer
|
62
|
-
for timer in
|
68
|
+
for timer in values.get("timers", []):
|
63
69
|
if timer.id in ids:
|
64
|
-
raise ValueError(
|
70
|
+
raise ValueError(
|
71
|
+
cls, f"Id {timer.id} was found multiple times in 'timers'."
|
72
|
+
)
|
65
73
|
ids.append(timer.id)
|
66
74
|
|
67
|
-
return
|
68
|
-
|
69
|
-
@
|
70
|
-
|
71
|
-
|
75
|
+
return values
|
76
|
+
|
77
|
+
@root_validator(pre=False)
|
78
|
+
@classmethod
|
79
|
+
def validate_operation_modes_in_transitions(
|
80
|
+
cls, values: Dict[str, Any]
|
81
|
+
) -> Dict[str, Any]:
|
82
|
+
operation_mode_by_id = {
|
83
|
+
operation_mode.id: operation_mode
|
84
|
+
for operation_mode in values.get("operation_modes", [])
|
85
|
+
}
|
72
86
|
transition: Transition
|
73
|
-
for transition in
|
87
|
+
for transition in values.get("transitions", []):
|
74
88
|
if transition.from_ not in operation_mode_by_id:
|
75
89
|
raise ValueError(
|
76
|
-
|
90
|
+
cls,
|
77
91
|
f"Operation mode {transition.from_} was referenced as 'from' in transition "
|
78
92
|
f"{transition.id} but was not defined in 'operation_modes'.",
|
79
93
|
)
|
80
94
|
|
81
95
|
if transition.to not in operation_mode_by_id:
|
82
96
|
raise ValueError(
|
83
|
-
|
97
|
+
cls,
|
84
98
|
f"Operation mode {transition.to} was referenced as 'to' in transition "
|
85
99
|
f"{transition.id} but was not defined in 'operation_modes'.",
|
86
100
|
)
|
87
101
|
|
88
|
-
return
|
102
|
+
return values
|
89
103
|
|
90
|
-
@
|
91
|
-
|
104
|
+
@root_validator(pre=False)
|
105
|
+
@classmethod
|
106
|
+
def validate_operation_modes_unique_ids(
|
107
|
+
cls, values: Dict[str, Any]
|
108
|
+
) -> Dict[str, Any]:
|
92
109
|
ids = []
|
93
110
|
operation_mode: FRBCOperationMode
|
94
|
-
for operation_mode in
|
111
|
+
for operation_mode in values.get("operation_modes", []):
|
95
112
|
if operation_mode.id in ids:
|
96
113
|
raise ValueError(
|
97
|
-
|
114
|
+
cls,
|
98
115
|
f"Id {operation_mode.id} was found multiple times in 'operation_modes'.",
|
99
116
|
)
|
100
117
|
ids.append(operation_mode.id)
|
101
118
|
|
102
|
-
return
|
119
|
+
return values
|
103
120
|
|
104
|
-
@
|
105
|
-
|
106
|
-
|
121
|
+
@root_validator(pre=False)
|
122
|
+
@classmethod
|
123
|
+
def validate_operation_mode_elements_have_all_supported_commodities(
|
124
|
+
cls, values: Dict[str, Any]
|
125
|
+
) -> Dict[str, Any]:
|
126
|
+
supported_commodities = values.get("supported_commodities", [])
|
107
127
|
operation_mode: FRBCOperationMode
|
108
|
-
for operation_mode in
|
128
|
+
for operation_mode in values.get("operation_modes", []):
|
109
129
|
for operation_mode_element in operation_mode.elements:
|
110
130
|
for commodity in supported_commodities:
|
111
131
|
power_ranges_for_commodity = [
|
112
132
|
power_range
|
113
133
|
for power_range in operation_mode_element.power_ranges
|
114
|
-
if commodity_has_quantity(
|
134
|
+
if commodity_has_quantity(
|
135
|
+
commodity, power_range.commodity_quantity
|
136
|
+
)
|
115
137
|
]
|
116
138
|
|
117
139
|
if len(power_ranges_for_commodity) > 1:
|
118
140
|
raise ValueError(
|
119
|
-
|
141
|
+
cls,
|
120
142
|
f"Multiple power ranges defined for commodity {commodity} in operation "
|
121
143
|
f"mode {operation_mode.id} and element with fill_level_range "
|
122
144
|
f"{operation_mode_element.fill_level_range}",
|
123
145
|
)
|
124
146
|
if not power_ranges_for_commodity:
|
125
147
|
raise ValueError(
|
126
|
-
|
148
|
+
cls,
|
127
149
|
f"No power ranges defined for commodity {commodity} in operation "
|
128
150
|
f"mode {operation_mode.id} and element with fill_level_range "
|
129
151
|
f"{operation_mode_element.fill_level_range}",
|
130
152
|
)
|
131
|
-
return
|
153
|
+
return values
|
132
154
|
|
133
|
-
@
|
134
|
-
|
135
|
-
|
155
|
+
@root_validator(pre=False)
|
156
|
+
@classmethod
|
157
|
+
def validate_unique_supported_commodities(
|
158
|
+
cls, values: Dict[str, Any]
|
159
|
+
) -> Dict[str, Any]:
|
160
|
+
supported_commodities: List[CommodityQuantity] = values.get(
|
161
|
+
"supported_commodities", []
|
162
|
+
)
|
136
163
|
|
137
164
|
for supported_commodity in supported_commodities:
|
138
165
|
if supported_commodities.count(supported_commodity) > 1:
|
139
166
|
raise ValueError(
|
140
|
-
|
167
|
+
cls,
|
141
168
|
f"Found duplicate {supported_commodity} commodity in 'supported_commodities'",
|
142
169
|
)
|
143
|
-
return
|
170
|
+
return values
|