s2-python 0.0.1__tar.gz → 0.2.0__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.
Files changed (92) hide show
  1. {s2-python-0.0.1 → s2_python-0.2.0}/PKG-INFO +22 -4
  2. {s2-python-0.0.1 → s2_python-0.2.0}/README.rst +17 -2
  3. {s2-python-0.0.1 → s2_python-0.2.0}/setup.cfg +6 -3
  4. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2_python.egg-info/PKG-INFO +22 -4
  5. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2_python.egg-info/SOURCES.txt +5 -0
  6. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2_python.egg-info/requires.txt +3 -1
  7. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/__init__.py +1 -1
  8. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/common/duration.py +5 -5
  9. s2_python-0.2.0/src/s2python/common/handshake.py +15 -0
  10. s2_python-0.2.0/src/s2python/common/handshake_response.py +15 -0
  11. s2_python-0.2.0/src/s2python/common/instruction_status_update.py +18 -0
  12. s2_python-0.2.0/src/s2python/common/number_range.py +32 -0
  13. s2_python-0.2.0/src/s2python/common/power_forecast.py +18 -0
  14. s2_python-0.2.0/src/s2python/common/power_forecast_element.py +20 -0
  15. s2_python-0.2.0/src/s2python/common/power_forecast_value.py +11 -0
  16. s2_python-0.2.0/src/s2python/common/power_measurement.py +18 -0
  17. s2_python-0.2.0/src/s2python/common/power_range.py +22 -0
  18. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/common/power_value.py +4 -4
  19. s2_python-0.2.0/src/s2python/common/reception_status.py +15 -0
  20. s2_python-0.2.0/src/s2python/common/resource_manager_details.py +25 -0
  21. s2_python-0.2.0/src/s2python/common/revoke_object.py +16 -0
  22. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/common/role.py +4 -4
  23. s2_python-0.2.0/src/s2python/common/select_control_type.py +15 -0
  24. s2_python-0.2.0/src/s2python/common/session_request.py +15 -0
  25. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/common/support.py +6 -4
  26. s2_python-0.2.0/src/s2python/common/timer.py +17 -0
  27. s2_python-0.2.0/src/s2python/common/transition.py +24 -0
  28. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/frbc/frbc_actuator_description.py +53 -74
  29. s2_python-0.2.0/src/s2python/frbc/frbc_actuator_status.py +23 -0
  30. s2_python-0.2.0/src/s2python/frbc/frbc_fill_level_target_profile.py +24 -0
  31. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/frbc/frbc_fill_level_target_profile_element.py +7 -9
  32. s2_python-0.2.0/src/s2python/frbc/frbc_instruction.py +18 -0
  33. s2_python-0.2.0/src/s2python/frbc/frbc_leakage_behaviour.py +20 -0
  34. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/frbc/frbc_leakage_behaviour_element.py +6 -8
  35. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/frbc/frbc_operation_mode.py +19 -29
  36. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/frbc/frbc_operation_mode_element.py +11 -13
  37. s2_python-0.2.0/src/s2python/frbc/frbc_storage_description.py +18 -0
  38. s2_python-0.2.0/src/s2python/frbc/frbc_storage_status.py +15 -0
  39. s2_python-0.2.0/src/s2python/frbc/frbc_system_description.py +22 -0
  40. s2_python-0.2.0/src/s2python/frbc/frbc_timer_status.py +17 -0
  41. s2_python-0.2.0/src/s2python/frbc/frbc_usage_forecast.py +18 -0
  42. s2_python-0.2.0/src/s2python/frbc/frbc_usage_forecast_element.py +17 -0
  43. s2_python-0.2.0/src/s2python/generated/__init__.py +0 -0
  44. s2_python-0.2.0/src/s2python/generated/gen_s2.py +1611 -0
  45. s2_python-0.2.0/src/s2python/reception_status_awaiter.py +60 -0
  46. s2_python-0.2.0/src/s2python/s2_connection.py +470 -0
  47. s2_python-0.2.0/src/s2python/s2_control_type.py +56 -0
  48. s2_python-0.2.0/src/s2python/s2_parser.py +113 -0
  49. s2_python-0.2.0/src/s2python/s2_validation_error.py +13 -0
  50. s2_python-0.2.0/src/s2python/utils.py +8 -0
  51. s2_python-0.2.0/src/s2python/validate_values_mixin.py +70 -0
  52. s2_python-0.2.0/src/s2python/version.py +3 -0
  53. s2-python-0.0.1/src/s2python/common/handshake.py +0 -15
  54. s2-python-0.0.1/src/s2python/common/handshake_response.py +0 -15
  55. s2-python-0.0.1/src/s2python/common/instruction_status_update.py +0 -22
  56. s2-python-0.0.1/src/s2python/common/number_range.py +0 -36
  57. s2-python-0.0.1/src/s2python/common/power_forecast.py +0 -20
  58. s2-python-0.0.1/src/s2python/common/power_forecast_element.py +0 -21
  59. s2-python-0.0.1/src/s2python/common/power_forecast_value.py +0 -13
  60. s2-python-0.0.1/src/s2python/common/power_measurement.py +0 -18
  61. s2-python-0.0.1/src/s2python/common/power_range.py +0 -24
  62. s2-python-0.0.1/src/s2python/common/reception_status.py +0 -17
  63. s2-python-0.0.1/src/s2python/common/resource_manager_details.py +0 -26
  64. s2-python-0.0.1/src/s2python/common/revoke_object.py +0 -16
  65. s2-python-0.0.1/src/s2python/common/select_control_type.py +0 -15
  66. s2-python-0.0.1/src/s2python/common/session_request.py +0 -15
  67. s2-python-0.0.1/src/s2python/common/timer.py +0 -17
  68. s2-python-0.0.1/src/s2python/common/transition.py +0 -26
  69. s2-python-0.0.1/src/s2python/frbc/frbc_actuator_status.py +0 -25
  70. s2-python-0.0.1/src/s2python/frbc/frbc_fill_level_target_profile.py +0 -28
  71. s2-python-0.0.1/src/s2python/frbc/frbc_instruction.py +0 -18
  72. s2-python-0.0.1/src/s2python/frbc/frbc_leakage_behaviour.py +0 -22
  73. s2-python-0.0.1/src/s2python/frbc/frbc_storage_description.py +0 -20
  74. s2-python-0.0.1/src/s2python/frbc/frbc_storage_status.py +0 -15
  75. s2-python-0.0.1/src/s2python/frbc/frbc_system_description.py +0 -25
  76. s2-python-0.0.1/src/s2python/frbc/frbc_timer_status.py +0 -17
  77. s2-python-0.0.1/src/s2python/frbc/frbc_usage_forecast.py +0 -20
  78. s2-python-0.0.1/src/s2python/frbc/frbc_usage_forecast_element.py +0 -19
  79. s2-python-0.0.1/src/s2python/generated/gen_s2.py +0 -1591
  80. s2-python-0.0.1/src/s2python/s2_validation_error.py +0 -11
  81. s2-python-0.0.1/src/s2python/utils.py +0 -3
  82. s2-python-0.0.1/src/s2python/validate_values_mixin.py +0 -127
  83. s2-python-0.0.1/src/s2python/version.py +0 -1
  84. {s2-python-0.0.1 → s2_python-0.2.0}/pyproject.toml +0 -0
  85. {s2-python-0.0.1 → s2_python-0.2.0}/setup.py +0 -0
  86. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2_python.egg-info/dependency_links.txt +0 -0
  87. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2_python.egg-info/entry_points.txt +0 -0
  88. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2_python.egg-info/not-zip-safe +0 -0
  89. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2_python.egg-info/top_level.txt +0 -0
  90. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/common/__init__.py +1 -1
  91. {s2-python-0.0.1 → s2_python-0.2.0}/src/s2python/frbc/__init__.py +0 -0
  92. /s2-python-0.0.1/src/s2python/generated/__init__.py → /s2_python-0.2.0/src/s2python/frbc/rm.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: s2-python
3
- Version: 0.0.1
3
+ Version: 0.2.0
4
4
  Summary: S2 Protocol Python Wrapper
5
5
  Home-page: https://github.com/flexiblepower/s2-ws-json-python
6
6
  Author: Flexiblepower
@@ -12,15 +12,18 @@ Classifier: Programming Language :: Python :: 3.8
12
12
  Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
15
16
  Description-Content-Type: text/x-rst; charset=UTF-8
16
- Requires-Dist: pydantic<=1.10.7
17
+ Requires-Dist: pydantic~=2.8.2
17
18
  Requires-Dist: pytz
18
19
  Requires-Dist: click
20
+ Requires-Dist: websockets~=13.0.1
19
21
  Provides-Extra: testing
20
22
  Requires-Dist: pytest; extra == "testing"
21
23
  Requires-Dist: pytest-coverage; extra == "testing"
22
24
  Requires-Dist: pytest-timer; extra == "testing"
23
25
  Requires-Dist: mypy; extra == "testing"
26
+ Requires-Dist: types-pytz; extra == "testing"
24
27
  Requires-Dist: pylint; extra == "testing"
25
28
  Provides-Extra: development
26
29
  Requires-Dist: pip-tools; extra == "development"
@@ -39,7 +42,7 @@ Python Wrapper for S2 Flexibility Protocol
39
42
  ===========================================
40
43
  .. image:: https://img.shields.io/pypi/v/s2-python
41
44
  :alt: PyPI - Version
42
- .. image:: https://img.shields.io/pypi/pyversions/v/s2-python
45
+ .. image:: https://img.shields.io/pypi/pyversions/s2-python
43
46
  :alt: PyPI - Python Version
44
47
  .. image:: https://img.shields.io/pypi/l/s2-python
45
48
  :alt: PyPI - License
@@ -49,14 +52,29 @@ is based on the asyncapi description of the protocol provided in the `s2-ws-json
49
52
 
50
53
  Currently, the package supports the *common* and *FILL RATE BASED CONTROL* types and messages.
51
54
 
55
+ To Install
56
+ -----------
57
+ You can install this package using pip or any Python dependency manager that collects the packages from Pypi:
58
+
59
+ .. code-block:: bash
60
+
61
+ pip install s2-python
62
+
63
+ The packages on Pypi may be found `here <https://pypi.org/project/s2-python/>`_
52
64
 
53
65
  Example
54
66
  ---------
55
67
 
56
68
  .. code-block:: python
57
69
 
70
+ from s2python.common import PowerRange, CommodityQuantity
71
+
58
72
  # create s2 messages as Python objects
59
- number_range = PowerRange(start_of_range=4.0, end_of_range=5.0, commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1)
73
+ number_range = PowerRange(
74
+ start_of_range=4.0,
75
+ end_of_range=5.0,
76
+ commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1,
77
+ )
60
78
  # serialize s2 messages
61
79
  number_range.to_json()
62
80
  # deserialize s2 messages
@@ -2,7 +2,7 @@ Python Wrapper for S2 Flexibility Protocol
2
2
  ===========================================
3
3
  .. image:: https://img.shields.io/pypi/v/s2-python
4
4
  :alt: PyPI - Version
5
- .. image:: https://img.shields.io/pypi/pyversions/v/s2-python
5
+ .. image:: https://img.shields.io/pypi/pyversions/s2-python
6
6
  :alt: PyPI - Python Version
7
7
  .. image:: https://img.shields.io/pypi/l/s2-python
8
8
  :alt: PyPI - License
@@ -12,14 +12,29 @@ is based on the asyncapi description of the protocol provided in the `s2-ws-json
12
12
 
13
13
  Currently, the package supports the *common* and *FILL RATE BASED CONTROL* types and messages.
14
14
 
15
+ To Install
16
+ -----------
17
+ You can install this package using pip or any Python dependency manager that collects the packages from Pypi:
18
+
19
+ .. code-block:: bash
20
+
21
+ pip install s2-python
22
+
23
+ The packages on Pypi may be found `here <https://pypi.org/project/s2-python/>`_
15
24
 
16
25
  Example
17
26
  ---------
18
27
 
19
28
  .. code-block:: python
20
29
 
30
+ from s2python.common import PowerRange, CommodityQuantity
31
+
21
32
  # create s2 messages as Python objects
22
- number_range = PowerRange(start_of_range=4.0, end_of_range=5.0, commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1)
33
+ number_range = PowerRange(
34
+ start_of_range=4.0,
35
+ end_of_range=5.0,
36
+ commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1,
37
+ )
23
38
  # serialize s2 messages
24
39
  number_range.to_json()
25
40
  # deserialize s2 messages
@@ -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.0.1
11
+ version = 0.2.0
12
12
  platforms = Linux
13
13
  classifiers =
14
14
  Development Status :: 4 - Beta
@@ -16,6 +16,7 @@ classifiers =
16
16
  Programming Language :: Python :: 3.9
17
17
  Programming Language :: Python :: 3.10
18
18
  Programming Language :: Python :: 3.11
19
+ Programming Language :: Python :: 3.12
19
20
 
20
21
  [options]
21
22
  zip_safe = False
@@ -23,11 +24,12 @@ packages = find_namespace:
23
24
  include_package_data = True
24
25
  package_dir =
25
26
  =src
26
- python_requires > = 3.9, <= 3.11
27
+ python_requires > = 3.8, <= 3.12
27
28
  install_requires =
28
- pydantic<=1.10.7
29
+ pydantic~=2.8.2
29
30
  pytz
30
31
  click
32
+ websockets~=13.0.1
31
33
 
32
34
  [options.packages.find]
33
35
  where = src
@@ -40,6 +42,7 @@ testing =
40
42
  pytest-coverage
41
43
  pytest-timer
42
44
  mypy
45
+ types-pytz
43
46
  pylint
44
47
  development =
45
48
  pip-tools
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: s2-python
3
- Version: 0.0.1
3
+ Version: 0.2.0
4
4
  Summary: S2 Protocol Python Wrapper
5
5
  Home-page: https://github.com/flexiblepower/s2-ws-json-python
6
6
  Author: Flexiblepower
@@ -12,15 +12,18 @@ Classifier: Programming Language :: Python :: 3.8
12
12
  Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
15
16
  Description-Content-Type: text/x-rst; charset=UTF-8
16
- Requires-Dist: pydantic<=1.10.7
17
+ Requires-Dist: pydantic~=2.8.2
17
18
  Requires-Dist: pytz
18
19
  Requires-Dist: click
20
+ Requires-Dist: websockets~=13.0.1
19
21
  Provides-Extra: testing
20
22
  Requires-Dist: pytest; extra == "testing"
21
23
  Requires-Dist: pytest-coverage; extra == "testing"
22
24
  Requires-Dist: pytest-timer; extra == "testing"
23
25
  Requires-Dist: mypy; extra == "testing"
26
+ Requires-Dist: types-pytz; extra == "testing"
24
27
  Requires-Dist: pylint; extra == "testing"
25
28
  Provides-Extra: development
26
29
  Requires-Dist: pip-tools; extra == "development"
@@ -39,7 +42,7 @@ Python Wrapper for S2 Flexibility Protocol
39
42
  ===========================================
40
43
  .. image:: https://img.shields.io/pypi/v/s2-python
41
44
  :alt: PyPI - Version
42
- .. image:: https://img.shields.io/pypi/pyversions/v/s2-python
45
+ .. image:: https://img.shields.io/pypi/pyversions/s2-python
43
46
  :alt: PyPI - Python Version
44
47
  .. image:: https://img.shields.io/pypi/l/s2-python
45
48
  :alt: PyPI - License
@@ -49,14 +52,29 @@ is based on the asyncapi description of the protocol provided in the `s2-ws-json
49
52
 
50
53
  Currently, the package supports the *common* and *FILL RATE BASED CONTROL* types and messages.
51
54
 
55
+ To Install
56
+ -----------
57
+ You can install this package using pip or any Python dependency manager that collects the packages from Pypi:
58
+
59
+ .. code-block:: bash
60
+
61
+ pip install s2-python
62
+
63
+ The packages on Pypi may be found `here <https://pypi.org/project/s2-python/>`_
52
64
 
53
65
  Example
54
66
  ---------
55
67
 
56
68
  .. code-block:: python
57
69
 
70
+ from s2python.common import PowerRange, CommodityQuantity
71
+
58
72
  # create s2 messages as Python objects
59
- number_range = PowerRange(start_of_range=4.0, end_of_range=5.0, commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1)
73
+ number_range = PowerRange(
74
+ start_of_range=4.0,
75
+ end_of_range=5.0,
76
+ commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1,
77
+ )
60
78
  # serialize s2 messages
61
79
  number_range.to_json()
62
80
  # deserialize s2 messages
@@ -10,6 +10,10 @@ 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
+ src/s2python/s2_parser.py
13
17
  src/s2python/s2_validation_error.py
14
18
  src/s2python/utils.py
15
19
  src/s2python/validate_values_mixin.py
@@ -51,5 +55,6 @@ src/s2python/frbc/frbc_system_description.py
51
55
  src/s2python/frbc/frbc_timer_status.py
52
56
  src/s2python/frbc/frbc_usage_forecast.py
53
57
  src/s2python/frbc/frbc_usage_forecast_element.py
58
+ src/s2python/frbc/rm.py
54
59
  src/s2python/generated/__init__.py
55
60
  src/s2python/generated/gen_s2.py
@@ -1,6 +1,7 @@
1
- pydantic<=1.10.7
1
+ pydantic~=2.8.2
2
2
  pytz
3
3
  click
4
+ websockets~=13.0.1
4
5
 
5
6
  [development]
6
7
  pip-tools
@@ -21,4 +22,5 @@ pytest
21
22
  pytest-coverage
22
23
  pytest-timer
23
24
  mypy
25
+ types-pytz
24
26
  pylint
@@ -2,7 +2,7 @@ from importlib.metadata import PackageNotFoundError, version # pragma: no cover
2
2
 
3
3
  try:
4
4
  # Change here if project is renamed and does not equal the package name
5
- dist_name = "s2-python"
5
+ dist_name = "s2-python" # pylint: disable=invalid-name
6
6
  __version__ = version(dist_name)
7
7
  except PackageNotFoundError: # pragma: no cover
8
8
  __version__ = "unknown"
@@ -4,19 +4,19 @@ import math
4
4
  from s2python.generated.gen_s2 import Duration as GenDuration
5
5
  from s2python.validate_values_mixin import (
6
6
  catch_and_convert_exceptions,
7
- ValidateValuesMixin,
7
+ S2Message,
8
8
  )
9
9
 
10
10
 
11
11
  @catch_and_convert_exceptions
12
- class Duration(GenDuration, ValidateValuesMixin["Duration"]):
12
+ class Duration(GenDuration, S2Message["Duration"]):
13
13
  def to_timedelta(self) -> timedelta:
14
- return timedelta(milliseconds=self.__root__)
14
+ return timedelta(milliseconds=self.root)
15
15
 
16
16
  @staticmethod
17
17
  def from_timedelta(duration: timedelta) -> "Duration":
18
- return Duration(__root__=math.ceil(duration.total_seconds() * 1000))
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(__root__=milliseconds)
22
+ return Duration(root=milliseconds)
@@ -0,0 +1,15 @@
1
+ import uuid
2
+
3
+ from s2python.generated.gen_s2 import Handshake as GenHandshake
4
+ from s2python.validate_values_mixin import (
5
+ catch_and_convert_exceptions,
6
+ S2Message,
7
+ )
8
+
9
+
10
+ @catch_and_convert_exceptions
11
+ class Handshake(GenHandshake, S2Message["Handshake"]):
12
+ model_config = GenHandshake.model_config
13
+ model_config["validate_assignment"] = True
14
+
15
+ message_id: uuid.UUID = GenHandshake.model_fields["message_id"] # type: ignore[assignment]
@@ -0,0 +1,15 @@
1
+ import uuid
2
+
3
+ from s2python.generated.gen_s2 import HandshakeResponse as GenHandshakeResponse
4
+ from s2python.validate_values_mixin import (
5
+ catch_and_convert_exceptions,
6
+ S2Message,
7
+ )
8
+
9
+
10
+ @catch_and_convert_exceptions
11
+ class HandshakeResponse(GenHandshakeResponse, S2Message["HandshakeResponse"]):
12
+ model_config = GenHandshakeResponse.model_config
13
+ model_config["validate_assignment"] = True
14
+
15
+ message_id: uuid.UUID = GenHandshakeResponse.model_fields["message_id"] # type: ignore[assignment]
@@ -0,0 +1,18 @@
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(GenInstructionStatusUpdate, S2Message["InstructionStatusUpdate"]):
14
+ model_config = GenInstructionStatusUpdate.model_config
15
+ model_config["validate_assignment"] = True
16
+
17
+ message_id: uuid.UUID = GenInstructionStatusUpdate.model_fields["message_id"] # type: ignore[assignment]
18
+ instruction_id: uuid.UUID = GenInstructionStatusUpdate.model_fields["instruction_id"] # type: ignore[assignment]
@@ -0,0 +1,32 @@
1
+ from typing import Any
2
+ from typing_extensions import Self
3
+
4
+ from pydantic import model_validator
5
+
6
+ from s2python.validate_values_mixin import (
7
+ S2Message,
8
+ catch_and_convert_exceptions,
9
+ )
10
+ from s2python.generated.gen_s2 import NumberRange as GenNumberRange
11
+
12
+
13
+ @catch_and_convert_exceptions
14
+ class NumberRange(GenNumberRange, S2Message["NumberRange"]):
15
+ model_config = GenNumberRange.model_config
16
+ model_config["validate_assignment"] = True
17
+
18
+ @model_validator(mode="after")
19
+ def validate_start_end_order(self) -> Self: # pylint: disable=duplicate-code
20
+ if self.start_of_range > self.end_of_range:
21
+ raise ValueError(self, "start_of_range should not be higher than end_of_range")
22
+
23
+ return self
24
+
25
+ def __hash__(self) -> int:
26
+ return hash(f"{self.start_of_range}|{self.end_of_range}")
27
+
28
+ def __eq__(self, other: Any) -> bool:
29
+ if isinstance(other, NumberRange):
30
+ return self.start_of_range == other.start_of_range and self.end_of_range == other.end_of_range
31
+
32
+ return False
@@ -0,0 +1,18 @@
1
+ from typing import List
2
+ import uuid
3
+
4
+ from s2python.common.power_forecast_element import PowerForecastElement
5
+ from s2python.generated.gen_s2 import PowerForecast as GenPowerForecast
6
+ from s2python.validate_values_mixin import (
7
+ catch_and_convert_exceptions,
8
+ S2Message,
9
+ )
10
+
11
+
12
+ @catch_and_convert_exceptions
13
+ class PowerForecast(GenPowerForecast, S2Message["PowerForecast"]):
14
+ model_config = GenPowerForecast.model_config
15
+ model_config["validate_assignment"] = True
16
+
17
+ message_id: uuid.UUID = GenPowerForecast.model_fields["message_id"] # type: ignore[assignment]
18
+ elements: List[PowerForecastElement] = GenPowerForecast.model_fields["elements"] # type: ignore[assignment]
@@ -0,0 +1,20 @@
1
+ from typing import List
2
+
3
+ from s2python.generated.gen_s2 import PowerForecastElement as GenPowerForecastElement
4
+ from s2python.validate_values_mixin import (
5
+ catch_and_convert_exceptions,
6
+ S2Message,
7
+ )
8
+ from s2python.common.duration import Duration
9
+ from s2python.common.power_forecast_value import PowerForecastValue
10
+
11
+
12
+ @catch_and_convert_exceptions
13
+ class PowerForecastElement(GenPowerForecastElement, S2Message["PowerForecastElement"]):
14
+ model_config = GenPowerForecastElement.model_config
15
+ model_config["validate_assignment"] = True
16
+
17
+ duration: Duration = GenPowerForecastElement.model_fields["duration"] # type: ignore[assignment]
18
+ power_values: List[PowerForecastValue] = GenPowerForecastElement.model_fields[
19
+ "power_values"
20
+ ] # type: ignore[assignment]
@@ -0,0 +1,11 @@
1
+ from s2python.generated.gen_s2 import PowerForecastValue as GenPowerForecastValue
2
+ from s2python.validate_values_mixin import (
3
+ catch_and_convert_exceptions,
4
+ S2Message,
5
+ )
6
+
7
+
8
+ @catch_and_convert_exceptions
9
+ class PowerForecastValue(GenPowerForecastValue, S2Message["PowerForecastValue"]):
10
+ model_config = GenPowerForecastValue.model_config
11
+ model_config["validate_assignment"] = True
@@ -0,0 +1,18 @@
1
+ from typing import List
2
+ import uuid
3
+
4
+ from s2python.common.power_value import PowerValue
5
+ from s2python.generated.gen_s2 import PowerMeasurement as GenPowerMeasurement
6
+ from s2python.validate_values_mixin import (
7
+ catch_and_convert_exceptions,
8
+ S2Message,
9
+ )
10
+
11
+
12
+ @catch_and_convert_exceptions
13
+ class PowerMeasurement(GenPowerMeasurement, S2Message["PowerMeasurement"]):
14
+ model_config = GenPowerMeasurement.model_config
15
+ model_config["validate_assignment"] = True
16
+
17
+ message_id: uuid.UUID = GenPowerMeasurement.model_fields["message_id"] # type: ignore[assignment]
18
+ values: List[PowerValue] = GenPowerMeasurement.model_fields["values"] # type: ignore[assignment]
@@ -0,0 +1,22 @@
1
+ from typing_extensions import Self
2
+
3
+ from pydantic import model_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
+ model_config = GenPowerRange.model_config
15
+ model_config["validate_assignment"] = True
16
+
17
+ @model_validator(mode="after")
18
+ def validate_start_end_order(self) -> Self:
19
+ if self.start_of_range > self.end_of_range:
20
+ raise ValueError(self, "start_of_range should not be higher than end_of_range")
21
+
22
+ return self
@@ -1,11 +1,11 @@
1
1
  from s2python.generated.gen_s2 import PowerValue as GenPowerValue
2
2
  from s2python.validate_values_mixin import (
3
3
  catch_and_convert_exceptions,
4
- ValidateValuesMixin,
4
+ S2Message,
5
5
  )
6
6
 
7
7
 
8
8
  @catch_and_convert_exceptions
9
- class PowerValue(GenPowerValue, ValidateValuesMixin["PowerValue"]):
10
- class Config(GenPowerValue.Config):
11
- validate_assignment = True
9
+ class PowerValue(GenPowerValue, S2Message["PowerValue"]):
10
+ model_config = GenPowerValue.model_config
11
+ model_config["validate_assignment"] = True
@@ -0,0 +1,15 @@
1
+ import uuid
2
+
3
+ from s2python.generated.gen_s2 import ReceptionStatus as GenReceptionStatus
4
+ from s2python.validate_values_mixin import (
5
+ catch_and_convert_exceptions,
6
+ S2Message,
7
+ )
8
+
9
+
10
+ @catch_and_convert_exceptions
11
+ class ReceptionStatus(GenReceptionStatus, S2Message["ReceptionStatus"]):
12
+ model_config = GenReceptionStatus.model_config
13
+ model_config["validate_assignment"] = True
14
+
15
+ subject_message_id: uuid.UUID = GenReceptionStatus.model_fields["subject_message_id"] # type: ignore[assignment]
@@ -0,0 +1,25 @@
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(GenResourceManagerDetails, S2Message["ResourceManagerDetails"]):
17
+ model_config = GenResourceManagerDetails.model_config
18
+ model_config["validate_assignment"] = True
19
+
20
+ instruction_processing_delay: Duration = GenResourceManagerDetails.model_fields[
21
+ "instruction_processing_delay"
22
+ ] # type: ignore[assignment]
23
+ message_id: uuid.UUID = GenResourceManagerDetails.model_fields["message_id"] # type: ignore[assignment]
24
+ resource_id: uuid.UUID = GenResourceManagerDetails.model_fields["resource_id"] # type: ignore[assignment]
25
+ roles: List[Role] = GenResourceManagerDetails.model_fields["roles"] # 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
+ model_config = GenRevokeObject.model_config
13
+ model_config["validate_assignment"] = True
14
+
15
+ message_id: uuid.UUID = GenRevokeObject.model_fields["message_id"] # type: ignore[assignment]
16
+ object_id: uuid.UUID = GenRevokeObject.model_fields["object_id"] # type: ignore[assignment]
@@ -1,11 +1,11 @@
1
1
  from s2python.generated.gen_s2 import Role as GenRole
2
2
  from s2python.validate_values_mixin import (
3
- ValidateValuesMixin,
3
+ S2Message,
4
4
  catch_and_convert_exceptions,
5
5
  )
6
6
 
7
7
 
8
8
  @catch_and_convert_exceptions
9
- class Role(GenRole, ValidateValuesMixin["Role"]):
10
- class Config(GenRole.Config):
11
- validate_assignment = True
9
+ class Role(GenRole, S2Message["Role"]):
10
+ model_config = GenRole.model_config
11
+ model_config["validate_assignment"] = True
@@ -0,0 +1,15 @@
1
+ import uuid
2
+
3
+ from s2python.generated.gen_s2 import SelectControlType as GenSelectControlType
4
+ from s2python.validate_values_mixin import (
5
+ catch_and_convert_exceptions,
6
+ S2Message,
7
+ )
8
+
9
+
10
+ @catch_and_convert_exceptions
11
+ class SelectControlType(GenSelectControlType, S2Message["SelectControlType"]):
12
+ model_config = GenSelectControlType.model_config
13
+ model_config["validate_assignment"] = True
14
+
15
+ message_id: uuid.UUID = GenSelectControlType.model_fields["message_id"] # type: ignore[assignment]
@@ -0,0 +1,15 @@
1
+ import uuid
2
+
3
+ from s2python.generated.gen_s2 import SessionRequest as GenSessionRequest
4
+ from s2python.validate_values_mixin import (
5
+ catch_and_convert_exceptions,
6
+ S2Message,
7
+ )
8
+
9
+
10
+ @catch_and_convert_exceptions
11
+ class SessionRequest(GenSessionRequest, S2Message["SessionRequest"]):
12
+ model_config = GenSessionRequest.model_config
13
+ model_config["validate_assignment"] = True
14
+
15
+ message_id: uuid.UUID = GenSessionRequest.model_fields["message_id"] # type: ignore[assignment]
@@ -3,23 +3,25 @@ from s2python.common import CommodityQuantity, Commodity
3
3
 
4
4
  def commodity_has_quantity(commodity: "Commodity", quantity: CommodityQuantity) -> bool:
5
5
  if commodity == Commodity.HEAT:
6
- return quantity in [
6
+ result = quantity in [
7
7
  CommodityQuantity.HEAT_THERMAL_POWER,
8
8
  CommodityQuantity.HEAT_TEMPERATURE,
9
9
  CommodityQuantity.HEAT_FLOW_RATE,
10
10
  ]
11
11
  elif commodity == Commodity.ELECTRICITY:
12
- return quantity in [
12
+ result = quantity in [
13
13
  CommodityQuantity.ELECTRIC_POWER_3_PHASE_SYMMETRIC,
14
14
  CommodityQuantity.ELECTRIC_POWER_L1,
15
15
  CommodityQuantity.ELECTRIC_POWER_L2,
16
16
  CommodityQuantity.ELECTRIC_POWER_L3,
17
17
  ]
18
18
  elif commodity == Commodity.GAS:
19
- return quantity in [CommodityQuantity.NATURAL_GAS_FLOW_RATE]
19
+ result = quantity in [CommodityQuantity.NATURAL_GAS_FLOW_RATE]
20
20
  elif commodity == Commodity.OIL:
21
- return quantity in [CommodityQuantity.OIL_FLOW_RATE]
21
+ result = quantity in [CommodityQuantity.OIL_FLOW_RATE]
22
22
  else:
23
23
  raise RuntimeError(
24
24
  f"Unsupported commodity {commodity}. Missing implementation."
25
25
  )
26
+
27
+ return result
@@ -0,0 +1,17 @@
1
+ import uuid
2
+
3
+ from s2python.common.duration import Duration
4
+ from s2python.generated.gen_s2 import Timer as GenTimer
5
+ from s2python.validate_values_mixin import (
6
+ S2Message,
7
+ catch_and_convert_exceptions,
8
+ )
9
+
10
+
11
+ @catch_and_convert_exceptions
12
+ class Timer(GenTimer, S2Message["Timer"]):
13
+ model_config = GenTimer.model_config
14
+ model_config["validate_assignment"] = True
15
+
16
+ id: uuid.UUID = GenTimer.model_fields["id"] # type: ignore[assignment]
17
+ duration: Duration = GenTimer.model_fields["duration"] # type: ignore[assignment]