s2-python 0.0.0__tar.gz → 0.1.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 (93) hide show
  1. s2-python-0.1.0/PKG-INFO +99 -0
  2. s2-python-0.1.0/README.rst +61 -0
  3. {s2-python-0.0.0 → s2-python-0.1.0}/setup.cfg +8 -3
  4. s2-python-0.1.0/src/s2_python.egg-info/PKG-INFO +99 -0
  5. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2_python.egg-info/SOURCES.txt +1 -0
  6. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2_python.egg-info/requires.txt +2 -1
  7. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2python/__init__.py +1 -1
  8. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2python/common/__init__.py +12 -2
  9. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2python/common/duration.py +7 -4
  10. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2python/common/handshake.py +6 -3
  11. s2-python-0.1.0/src/s2python/common/handshake_response.py +15 -0
  12. s2-python-0.1.0/src/s2python/common/instruction_status_update.py +22 -0
  13. s2-python-0.1.0/src/s2python/common/number_range.py +39 -0
  14. s2-python-0.1.0/src/s2python/common/power_forecast.py +20 -0
  15. s2-python-0.1.0/src/s2python/common/power_forecast_element.py +20 -0
  16. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2python/common/power_forecast_value.py +5 -2
  17. s2-python-0.1.0/src/s2python/common/power_measurement.py +18 -0
  18. s2-python-0.1.0/src/s2python/common/power_range.py +27 -0
  19. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2python/common/power_value.py +5 -2
  20. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2python/common/reception_status.py +8 -3
  21. s2-python-0.1.0/src/s2python/common/resource_manager_details.py +27 -0
  22. s2-python-0.1.0/src/s2python/common/revoke_object.py +16 -0
  23. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2python/common/role.py +5 -2
  24. s2-python-0.1.0/src/s2python/common/select_control_type.py +15 -0
  25. s2-python-0.1.0/src/s2python/common/session_request.py +15 -0
  26. s2-python-0.1.0/src/s2python/common/support.py +27 -0
  27. s2-python-0.1.0/src/s2python/common/timer.py +17 -0
  28. s2-python-0.1.0/src/s2python/common/transition.py +26 -0
  29. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2python/frbc/__init__.py +3 -1
  30. s2-python-0.1.0/src/s2python/frbc/frbc_actuator_description.py +170 -0
  31. s2-python-0.1.0/src/s2python/frbc/frbc_actuator_status.py +23 -0
  32. s2-python-0.1.0/src/s2python/frbc/frbc_fill_level_target_profile.py +30 -0
  33. s2-python-0.1.0/src/s2python/frbc/frbc_fill_level_target_profile_element.py +25 -0
  34. s2-python-0.1.0/src/s2python/frbc/frbc_instruction.py +18 -0
  35. s2-python-0.1.0/src/s2python/frbc/frbc_leakage_behaviour.py +20 -0
  36. s2-python-0.1.0/src/s2python/frbc/frbc_leakage_behaviour_element.py +20 -0
  37. s2-python-0.1.0/src/s2python/frbc/frbc_operation_mode.py +53 -0
  38. s2-python-0.1.0/src/s2python/frbc/frbc_operation_mode_element.py +29 -0
  39. s2-python-0.1.0/src/s2python/frbc/frbc_storage_description.py +20 -0
  40. s2-python-0.1.0/src/s2python/frbc/frbc_storage_status.py +15 -0
  41. s2-python-0.1.0/src/s2python/frbc/frbc_system_description.py +26 -0
  42. s2-python-0.1.0/src/s2python/frbc/frbc_timer_status.py +17 -0
  43. s2-python-0.1.0/src/s2python/frbc/frbc_usage_forecast.py +20 -0
  44. s2-python-0.1.0/src/s2python/frbc/frbc_usage_forecast_element.py +19 -0
  45. s2-python-0.1.0/src/s2python/generated/gen_s2.py +1591 -0
  46. s2-python-0.1.0/src/s2python/s2_parser.py +113 -0
  47. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2python/s2_validation_error.py +4 -1
  48. s2-python-0.1.0/src/s2python/utils.py +8 -0
  49. s2-python-0.1.0/src/s2python/validate_values_mixin.py +148 -0
  50. s2-python-0.1.0/src/s2python/version.py +1 -0
  51. s2-python-0.0.0/PKG-INFO +0 -50
  52. s2-python-0.0.0/README.rst +0 -16
  53. s2-python-0.0.0/src/s2_python.egg-info/PKG-INFO +0 -50
  54. s2-python-0.0.0/src/s2python/common/handshake_response.py +0 -12
  55. s2-python-0.0.0/src/s2python/common/instruction_status_update.py +0 -13
  56. s2-python-0.0.0/src/s2python/common/number_range.py +0 -27
  57. s2-python-0.0.0/src/s2python/common/power_forecast.py +0 -15
  58. s2-python-0.0.0/src/s2python/common/power_forecast_element.py +0 -14
  59. s2-python-0.0.0/src/s2python/common/power_measurement.py +0 -15
  60. s2-python-0.0.0/src/s2python/common/power_range.py +0 -19
  61. s2-python-0.0.0/src/s2python/common/resource_manager_details.py +0 -17
  62. s2-python-0.0.0/src/s2python/common/revoke_object.py +0 -13
  63. s2-python-0.0.0/src/s2python/common/select_control_type.py +0 -12
  64. s2-python-0.0.0/src/s2python/common/session_request.py +0 -12
  65. s2-python-0.0.0/src/s2python/common/support.py +0 -19
  66. s2-python-0.0.0/src/s2python/common/timer.py +0 -14
  67. s2-python-0.0.0/src/s2python/common/transition.py +0 -19
  68. s2-python-0.0.0/src/s2python/frbc/frbc_actuator_description.py +0 -108
  69. s2-python-0.0.0/src/s2python/frbc/frbc_actuator_status.py +0 -16
  70. s2-python-0.0.0/src/s2python/frbc/frbc_fill_level_target_profile.py +0 -15
  71. s2-python-0.0.0/src/s2python/frbc/frbc_fill_level_target_profile_element.py +0 -13
  72. s2-python-0.0.0/src/s2python/frbc/frbc_instruction.py +0 -15
  73. s2-python-0.0.0/src/s2python/frbc/frbc_leakage_behaviour.py +0 -15
  74. s2-python-0.0.0/src/s2python/frbc/frbc_leakage_behaviour_element.py +0 -11
  75. s2-python-0.0.0/src/s2python/frbc/frbc_operation_mode.py +0 -34
  76. s2-python-0.0.0/src/s2python/frbc/frbc_operation_mode_element.py +0 -16
  77. s2-python-0.0.0/src/s2python/frbc/frbc_storage_description.py +0 -11
  78. s2-python-0.0.0/src/s2python/frbc/frbc_storage_status.py +0 -12
  79. s2-python-0.0.0/src/s2python/frbc/frbc_system_description.py +0 -16
  80. s2-python-0.0.0/src/s2python/frbc/frbc_timer_status.py +0 -14
  81. s2-python-0.0.0/src/s2python/frbc/frbc_usage_forecast.py +0 -15
  82. s2-python-0.0.0/src/s2python/frbc/frbc_usage_forecast_element.py +0 -12
  83. s2-python-0.0.0/src/s2python/generated/gen_s2.py +0 -1591
  84. s2-python-0.0.0/src/s2python/utils.py +0 -3
  85. s2-python-0.0.0/src/s2python/validate_values_mixin.py +0 -95
  86. s2-python-0.0.0/src/s2python/version.py +0 -1
  87. {s2-python-0.0.0 → s2-python-0.1.0}/pyproject.toml +0 -0
  88. {s2-python-0.0.0 → s2-python-0.1.0}/setup.py +0 -0
  89. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2_python.egg-info/dependency_links.txt +0 -0
  90. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2_python.egg-info/entry_points.txt +0 -0
  91. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2_python.egg-info/not-zip-safe +0 -0
  92. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2_python.egg-info/top_level.txt +0 -0
  93. {s2-python-0.0.0 → s2-python-0.1.0}/src/s2python/generated/__init__.py +0 -0
@@ -0,0 +1,99 @@
1
+ Metadata-Version: 2.1
2
+ Name: s2-python
3
+ Version: 0.1.0
4
+ Summary: S2 Protocol Python Wrapper
5
+ Home-page: https://github.com/flexiblepower/s2-ws-json-python
6
+ Author: Flexiblepower
7
+ Author-email: info@info.nl
8
+ License: APACHE
9
+ Platform: Linux
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Description-Content-Type: text/x-rst; charset=UTF-8
16
+ Requires-Dist: pydantic~=1.10.7
17
+ Requires-Dist: pytz
18
+ Requires-Dist: click
19
+ Provides-Extra: testing
20
+ Requires-Dist: pytest; extra == "testing"
21
+ Requires-Dist: pytest-coverage; extra == "testing"
22
+ Requires-Dist: pytest-timer; extra == "testing"
23
+ Requires-Dist: mypy; extra == "testing"
24
+ Requires-Dist: types-pytz; extra == "testing"
25
+ Requires-Dist: pylint; extra == "testing"
26
+ Provides-Extra: development
27
+ Requires-Dist: pip-tools; extra == "development"
28
+ Requires-Dist: datamodel-code-generator; extra == "development"
29
+ Requires-Dist: pre-commit; extra == "development"
30
+ Requires-Dist: tox; extra == "development"
31
+ Provides-Extra: docs
32
+ Requires-Dist: sphinx; extra == "docs"
33
+ Requires-Dist: sphinx-rtd-theme>=1.2; extra == "docs"
34
+ Requires-Dist: sphinx-tabs; extra == "docs"
35
+ Requires-Dist: sphinx_copybutton; extra == "docs"
36
+ Requires-Dist: sphinx_fontawesome; extra == "docs"
37
+ Requires-Dist: sphinxcontrib.httpdomain; extra == "docs"
38
+
39
+ Python Wrapper for S2 Flexibility Protocol
40
+ ===========================================
41
+ .. image:: https://img.shields.io/pypi/v/s2-python
42
+ :alt: PyPI - Version
43
+ .. image:: https://img.shields.io/pypi/pyversions/s2-python
44
+ :alt: PyPI - Python Version
45
+ .. image:: https://img.shields.io/pypi/l/s2-python
46
+ :alt: PyPI - License
47
+
48
+ This Python package implements the message validation for the EN50491-12-2 "S2" standard for home and building energy management. This implementation
49
+ is based on the asyncapi description of the protocol provided in the `s2-ws-json <https://github.com/flexiblepower/s2-ws-json/>`_ repository.
50
+
51
+ Currently, the package supports the *common* and *FILL RATE BASED CONTROL* types and messages.
52
+
53
+ To Install
54
+ -----------
55
+ You can install this package using pip or any Python dependency manager that collects the packages from Pypi:
56
+
57
+ .. code-block:: bash
58
+
59
+ pip install s2-python
60
+
61
+ The packages on Pypi may be found `here <https://pypi.org/project/s2-python/>`_
62
+
63
+ Example
64
+ ---------
65
+
66
+ .. code-block:: python
67
+
68
+ from s2python.common import PowerRange, CommodityQuantity
69
+
70
+ # create s2 messages as Python objects
71
+ number_range = PowerRange(
72
+ start_of_range=4.0,
73
+ end_of_range=5.0,
74
+ commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1,
75
+ )
76
+ # serialize s2 messages
77
+ number_range.to_json()
78
+ # deserialize s2 messages
79
+ json_str = '{"start_of_range": 4.0, "end_of_range": 5.0, "commodity_quantity": "ELECTRIC.POWER.L1"}'
80
+ PowerRange.from_json(json_str)
81
+
82
+ Development
83
+ -------------
84
+
85
+ For development, you can install the required dependencies using the following command:
86
+
87
+ pip install -e .[testing,development]
88
+
89
+
90
+ The tests can be run using tox:
91
+
92
+ tox
93
+
94
+ To build the package, you can use tox as well:
95
+
96
+ tox -e build,clean
97
+
98
+
99
+
@@ -0,0 +1,61 @@
1
+ Python Wrapper for S2 Flexibility Protocol
2
+ ===========================================
3
+ .. image:: https://img.shields.io/pypi/v/s2-python
4
+ :alt: PyPI - Version
5
+ .. image:: https://img.shields.io/pypi/pyversions/s2-python
6
+ :alt: PyPI - Python Version
7
+ .. image:: https://img.shields.io/pypi/l/s2-python
8
+ :alt: PyPI - License
9
+
10
+ This Python package implements the message validation for the EN50491-12-2 "S2" standard for home and building energy management. This implementation
11
+ is based on the asyncapi description of the protocol provided in the `s2-ws-json <https://github.com/flexiblepower/s2-ws-json/>`_ repository.
12
+
13
+ Currently, the package supports the *common* and *FILL RATE BASED CONTROL* types and messages.
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/>`_
24
+
25
+ Example
26
+ ---------
27
+
28
+ .. code-block:: python
29
+
30
+ from s2python.common import PowerRange, CommodityQuantity
31
+
32
+ # create s2 messages as Python objects
33
+ number_range = PowerRange(
34
+ start_of_range=4.0,
35
+ end_of_range=5.0,
36
+ commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1,
37
+ )
38
+ # serialize s2 messages
39
+ number_range.to_json()
40
+ # deserialize s2 messages
41
+ json_str = '{"start_of_range": 4.0, "end_of_range": 5.0, "commodity_quantity": "ELECTRIC.POWER.L1"}'
42
+ PowerRange.from_json(json_str)
43
+
44
+ Development
45
+ -------------
46
+
47
+ For development, you can install the required dependencies using the following command:
48
+
49
+ pip install -e .[testing,development]
50
+
51
+
52
+ The tests can be run using tox:
53
+
54
+ tox
55
+
56
+ To build the package, you can use tox as well:
57
+
58
+ tox -e build,clean
59
+
60
+
61
+
@@ -8,10 +8,14 @@ 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.1.0
11
12
  platforms = Linux
12
13
  classifiers =
13
14
  Development Status :: 4 - Beta
14
- Programming Language :: Python
15
+ Programming Language :: Python :: 3.8
16
+ Programming Language :: Python :: 3.9
17
+ Programming Language :: Python :: 3.10
18
+ Programming Language :: Python :: 3.11
15
19
 
16
20
  [options]
17
21
  zip_safe = False
@@ -19,9 +23,9 @@ packages = find_namespace:
19
23
  include_package_data = True
20
24
  package_dir =
21
25
  =src
22
- python_requires > = 3.9
26
+ python_requires > = 3.8, <= 3.11
23
27
  install_requires =
24
- pydantic<=1.10.7
28
+ pydantic~=1.10.7
25
29
  pytz
26
30
  click
27
31
 
@@ -36,6 +40,7 @@ testing =
36
40
  pytest-coverage
37
41
  pytest-timer
38
42
  mypy
43
+ types-pytz
39
44
  pylint
40
45
  development =
41
46
  pip-tools
@@ -0,0 +1,99 @@
1
+ Metadata-Version: 2.1
2
+ Name: s2-python
3
+ Version: 0.1.0
4
+ Summary: S2 Protocol Python Wrapper
5
+ Home-page: https://github.com/flexiblepower/s2-ws-json-python
6
+ Author: Flexiblepower
7
+ Author-email: info@info.nl
8
+ License: APACHE
9
+ Platform: Linux
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Description-Content-Type: text/x-rst; charset=UTF-8
16
+ Requires-Dist: pydantic~=1.10.7
17
+ Requires-Dist: pytz
18
+ Requires-Dist: click
19
+ Provides-Extra: testing
20
+ Requires-Dist: pytest; extra == "testing"
21
+ Requires-Dist: pytest-coverage; extra == "testing"
22
+ Requires-Dist: pytest-timer; extra == "testing"
23
+ Requires-Dist: mypy; extra == "testing"
24
+ Requires-Dist: types-pytz; extra == "testing"
25
+ Requires-Dist: pylint; extra == "testing"
26
+ Provides-Extra: development
27
+ Requires-Dist: pip-tools; extra == "development"
28
+ Requires-Dist: datamodel-code-generator; extra == "development"
29
+ Requires-Dist: pre-commit; extra == "development"
30
+ Requires-Dist: tox; extra == "development"
31
+ Provides-Extra: docs
32
+ Requires-Dist: sphinx; extra == "docs"
33
+ Requires-Dist: sphinx-rtd-theme>=1.2; extra == "docs"
34
+ Requires-Dist: sphinx-tabs; extra == "docs"
35
+ Requires-Dist: sphinx_copybutton; extra == "docs"
36
+ Requires-Dist: sphinx_fontawesome; extra == "docs"
37
+ Requires-Dist: sphinxcontrib.httpdomain; extra == "docs"
38
+
39
+ Python Wrapper for S2 Flexibility Protocol
40
+ ===========================================
41
+ .. image:: https://img.shields.io/pypi/v/s2-python
42
+ :alt: PyPI - Version
43
+ .. image:: https://img.shields.io/pypi/pyversions/s2-python
44
+ :alt: PyPI - Python Version
45
+ .. image:: https://img.shields.io/pypi/l/s2-python
46
+ :alt: PyPI - License
47
+
48
+ This Python package implements the message validation for the EN50491-12-2 "S2" standard for home and building energy management. This implementation
49
+ is based on the asyncapi description of the protocol provided in the `s2-ws-json <https://github.com/flexiblepower/s2-ws-json/>`_ repository.
50
+
51
+ Currently, the package supports the *common* and *FILL RATE BASED CONTROL* types and messages.
52
+
53
+ To Install
54
+ -----------
55
+ You can install this package using pip or any Python dependency manager that collects the packages from Pypi:
56
+
57
+ .. code-block:: bash
58
+
59
+ pip install s2-python
60
+
61
+ The packages on Pypi may be found `here <https://pypi.org/project/s2-python/>`_
62
+
63
+ Example
64
+ ---------
65
+
66
+ .. code-block:: python
67
+
68
+ from s2python.common import PowerRange, CommodityQuantity
69
+
70
+ # create s2 messages as Python objects
71
+ number_range = PowerRange(
72
+ start_of_range=4.0,
73
+ end_of_range=5.0,
74
+ commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1,
75
+ )
76
+ # serialize s2 messages
77
+ number_range.to_json()
78
+ # deserialize s2 messages
79
+ json_str = '{"start_of_range": 4.0, "end_of_range": 5.0, "commodity_quantity": "ELECTRIC.POWER.L1"}'
80
+ PowerRange.from_json(json_str)
81
+
82
+ Development
83
+ -------------
84
+
85
+ For development, you can install the required dependencies using the following command:
86
+
87
+ pip install -e .[testing,development]
88
+
89
+
90
+ The tests can be run using tox:
91
+
92
+ tox
93
+
94
+ To build the package, you can use tox as well:
95
+
96
+ tox -e build,clean
97
+
98
+
99
+
@@ -10,6 +10,7 @@ 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/s2_parser.py
13
14
  src/s2python/s2_validation_error.py
14
15
  src/s2python/utils.py
15
16
  src/s2python/validate_values_mixin.py
@@ -1,4 +1,4 @@
1
- pydantic<=1.10.7
1
+ pydantic~=1.10.7
2
2
  pytz
3
3
  click
4
4
 
@@ -21,4 +21,5 @@ pytest
21
21
  pytest-coverage
22
22
  pytest-timer
23
23
  mypy
24
+ types-pytz
24
25
  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"
@@ -1,5 +1,15 @@
1
- from s2python.generated.gen_s2 import (RoleType, CommodityQuantity, Commodity, InstructionStatus, ReceptionStatusValues,
2
- EnergyManagementRole, SessionRequestType, ControlType, Currency, RevokableObjects)
1
+ from s2python.generated.gen_s2 import (
2
+ RoleType,
3
+ CommodityQuantity,
4
+ Commodity,
5
+ InstructionStatus,
6
+ ReceptionStatusValues,
7
+ EnergyManagementRole,
8
+ SessionRequestType,
9
+ ControlType,
10
+ Currency,
11
+ RevokableObjects,
12
+ )
3
13
 
4
14
  from s2python.common.duration import Duration
5
15
  from s2python.common.role import Role
@@ -2,18 +2,21 @@ from datetime import timedelta
2
2
  import math
3
3
 
4
4
  from s2python.generated.gen_s2 import Duration as GenDuration
5
- from s2python.validate_values_mixin import catch_and_convert_exceptions, ValidateValuesMixin
5
+ from s2python.validate_values_mixin import (
6
+ catch_and_convert_exceptions,
7
+ S2Message,
8
+ )
6
9
 
7
10
 
8
11
  @catch_and_convert_exceptions
9
- class Duration(GenDuration, ValidateValuesMixin['Duration']):
12
+ class Duration(GenDuration, S2Message["Duration"]):
10
13
  def to_timedelta(self) -> timedelta:
11
14
  return timedelta(milliseconds=self.__root__)
12
15
 
13
16
  @staticmethod
14
- def from_timedelta(duration: timedelta) -> 'Duration':
17
+ def from_timedelta(duration: timedelta) -> "Duration":
15
18
  return Duration(__root__=math.ceil(duration.total_seconds() * 1000))
16
19
 
17
20
  @staticmethod
18
- def from_milliseconds(milliseconds: int) -> 'Duration':
21
+ def from_milliseconds(milliseconds: int) -> "Duration":
19
22
  return Duration(__root__=milliseconds)
@@ -1,12 +1,15 @@
1
1
  import uuid
2
2
 
3
3
  from s2python.generated.gen_s2 import Handshake as GenHandshake
4
- from s2python.validate_values_mixin import catch_and_convert_exceptions, ValidateValuesMixin
4
+ from s2python.validate_values_mixin import (
5
+ catch_and_convert_exceptions,
6
+ S2Message,
7
+ )
5
8
 
6
9
 
7
10
  @catch_and_convert_exceptions
8
- class Handshake(GenHandshake, ValidateValuesMixin['Handshake']):
11
+ class Handshake(GenHandshake, S2Message["Handshake"]):
9
12
  class Config(GenHandshake.Config):
10
13
  validate_assignment = True
11
14
 
12
- message_id: uuid.UUID = GenHandshake.__fields__['message_id'].field_info # type: ignore[assignment]
15
+ message_id: uuid.UUID = GenHandshake.__fields__["message_id"].field_info # 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
+ class Config(GenHandshakeResponse.Config):
13
+ validate_assignment = True
14
+
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
@@ -0,0 +1,20 @@
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
+ class Config(GenPowerForecast.Config):
15
+ validate_assignment = True
16
+
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]
@@ -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
+ class Config(GenPowerForecastElement.Config):
15
+ validate_assignment = True
16
+
17
+ duration: Duration = GenPowerForecastElement.__fields__["duration"].field_info # type: ignore[assignment]
18
+ power_values: List[PowerForecastValue] = GenPowerForecastElement.__fields__[
19
+ "power_values"
20
+ ].field_info # type: ignore[assignment]
@@ -1,8 +1,11 @@
1
1
  from s2python.generated.gen_s2 import PowerForecastValue as GenPowerForecastValue
2
- from s2python.validate_values_mixin import catch_and_convert_exceptions, ValidateValuesMixin
2
+ from s2python.validate_values_mixin import (
3
+ catch_and_convert_exceptions,
4
+ S2Message,
5
+ )
3
6
 
4
7
 
5
8
  @catch_and_convert_exceptions
6
- class PowerForecastValue(GenPowerForecastValue, ValidateValuesMixin['PowerForecastValue']):
9
+ class PowerForecastValue(GenPowerForecastValue, S2Message["PowerForecastValue"]):
7
10
  class Config(GenPowerForecastValue.Config):
8
11
  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
+ class Config(GenPowerMeasurement.Config):
15
+ validate_assignment = True
16
+
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
@@ -1,8 +1,11 @@
1
1
  from s2python.generated.gen_s2 import PowerValue as GenPowerValue
2
- from s2python.validate_values_mixin import catch_and_convert_exceptions, ValidateValuesMixin
2
+ from s2python.validate_values_mixin import (
3
+ catch_and_convert_exceptions,
4
+ S2Message,
5
+ )
3
6
 
4
7
 
5
8
  @catch_and_convert_exceptions
6
- class PowerValue(GenPowerValue, ValidateValuesMixin['PowerValue']):
9
+ class PowerValue(GenPowerValue, S2Message["PowerValue"]):
7
10
  class Config(GenPowerValue.Config):
8
11
  validate_assignment = True
@@ -1,12 +1,17 @@
1
1
  import uuid
2
2
 
3
3
  from s2python.generated.gen_s2 import ReceptionStatus as GenReceptionStatus
4
- from s2python.validate_values_mixin import catch_and_convert_exceptions, ValidateValuesMixin
4
+ from s2python.validate_values_mixin import (
5
+ catch_and_convert_exceptions,
6
+ S2Message,
7
+ )
5
8
 
6
9
 
7
10
  @catch_and_convert_exceptions
8
- class ReceptionStatus(GenReceptionStatus, ValidateValuesMixin['ReceptionStatus']):
11
+ class ReceptionStatus(GenReceptionStatus, S2Message["ReceptionStatus"]):
9
12
  class Config(GenReceptionStatus.Config):
10
13
  validate_assignment = True
11
14
 
12
- subject_message_id: uuid.UUID = GenReceptionStatus.__fields__['subject_message_id'].field_info # type: ignore[assignment]
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]
@@ -1,8 +1,11 @@
1
1
  from s2python.generated.gen_s2 import Role as GenRole
2
- from s2python.validate_values_mixin import ValidateValuesMixin, catch_and_convert_exceptions
2
+ from s2python.validate_values_mixin import (
3
+ S2Message,
4
+ catch_and_convert_exceptions,
5
+ )
3
6
 
4
7
 
5
8
  @catch_and_convert_exceptions
6
- class Role(GenRole, ValidateValuesMixin['Role']):
9
+ class Role(GenRole, S2Message["Role"]):
7
10
  class Config(GenRole.Config):
8
11
  validate_assignment = True