s2-python 0.0.1__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.
- {s2-python-0.0.1 → s2-python-0.1.0}/PKG-INFO +20 -4
- {s2-python-0.0.1 → s2-python-0.1.0}/README.rst +17 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/setup.cfg +4 -3
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2_python.egg-info/PKG-INFO +20 -4
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2_python.egg-info/SOURCES.txt +1 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2_python.egg-info/requires.txt +2 -1
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/__init__.py +1 -1
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/duration.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/handshake.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/handshake_response.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/instruction_status_update.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/number_range.py +10 -7
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/power_forecast.py +3 -3
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/power_forecast_element.py +4 -5
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/power_forecast_value.py +2 -4
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/power_measurement.py +3 -3
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/power_range.py +6 -3
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/power_value.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/reception_status.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/resource_manager_details.py +4 -3
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/revoke_object.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/role.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/select_control_type.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/session_request.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/support.py +6 -4
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/timer.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/transition.py +3 -3
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_actuator_description.py +10 -4
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_actuator_status.py +2 -4
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_fill_level_target_profile.py +5 -3
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_fill_level_target_profile_element.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_instruction.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_leakage_behaviour.py +3 -5
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_leakage_behaviour_element.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_operation_mode.py +5 -4
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_operation_mode_element.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_storage_description.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_storage_status.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_system_description.py +4 -3
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_timer_status.py +2 -2
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_usage_forecast.py +3 -3
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/frbc_usage_forecast_element.py +2 -2
- s2-python-0.1.0/src/s2python/s2_parser.py +113 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/s2_validation_error.py +3 -1
- s2-python-0.1.0/src/s2python/utils.py +8 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/validate_values_mixin.py +38 -17
- s2-python-0.0.1/src/s2python/utils.py +0 -3
- {s2-python-0.0.1 → s2-python-0.1.0}/pyproject.toml +0 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/setup.py +0 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2_python.egg-info/dependency_links.txt +0 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2_python.egg-info/entry_points.txt +0 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2_python.egg-info/not-zip-safe +0 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2_python.egg-info/top_level.txt +0 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/common/__init__.py +0 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/frbc/__init__.py +0 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/generated/__init__.py +0 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/generated/gen_s2.py +0 -0
- {s2-python-0.0.1 → s2-python-0.1.0}/src/s2python/version.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: s2-python
|
3
|
-
Version: 0.0
|
3
|
+
Version: 0.1.0
|
4
4
|
Summary: S2 Protocol Python Wrapper
|
5
5
|
Home-page: https://github.com/flexiblepower/s2-ws-json-python
|
6
6
|
Author: Flexiblepower
|
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
15
15
|
Description-Content-Type: text/x-rst; charset=UTF-8
|
16
|
-
Requires-Dist: pydantic
|
16
|
+
Requires-Dist: pydantic~=1.10.7
|
17
17
|
Requires-Dist: pytz
|
18
18
|
Requires-Dist: click
|
19
19
|
Provides-Extra: testing
|
@@ -21,6 +21,7 @@ Requires-Dist: pytest; extra == "testing"
|
|
21
21
|
Requires-Dist: pytest-coverage; extra == "testing"
|
22
22
|
Requires-Dist: pytest-timer; extra == "testing"
|
23
23
|
Requires-Dist: mypy; extra == "testing"
|
24
|
+
Requires-Dist: types-pytz; extra == "testing"
|
24
25
|
Requires-Dist: pylint; extra == "testing"
|
25
26
|
Provides-Extra: development
|
26
27
|
Requires-Dist: pip-tools; extra == "development"
|
@@ -39,7 +40,7 @@ Python Wrapper for S2 Flexibility Protocol
|
|
39
40
|
===========================================
|
40
41
|
.. image:: https://img.shields.io/pypi/v/s2-python
|
41
42
|
:alt: PyPI - Version
|
42
|
-
.. image:: https://img.shields.io/pypi/pyversions/
|
43
|
+
.. image:: https://img.shields.io/pypi/pyversions/s2-python
|
43
44
|
:alt: PyPI - Python Version
|
44
45
|
.. image:: https://img.shields.io/pypi/l/s2-python
|
45
46
|
:alt: PyPI - License
|
@@ -49,14 +50,29 @@ is based on the asyncapi description of the protocol provided in the `s2-ws-json
|
|
49
50
|
|
50
51
|
Currently, the package supports the *common* and *FILL RATE BASED CONTROL* types and messages.
|
51
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/>`_
|
52
62
|
|
53
63
|
Example
|
54
64
|
---------
|
55
65
|
|
56
66
|
.. code-block:: python
|
57
67
|
|
68
|
+
from s2python.common import PowerRange, CommodityQuantity
|
69
|
+
|
58
70
|
# create s2 messages as Python objects
|
59
|
-
number_range = PowerRange(
|
71
|
+
number_range = PowerRange(
|
72
|
+
start_of_range=4.0,
|
73
|
+
end_of_range=5.0,
|
74
|
+
commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1,
|
75
|
+
)
|
60
76
|
# serialize s2 messages
|
61
77
|
number_range.to_json()
|
62
78
|
# 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/
|
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(
|
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
|
11
|
+
version = 0.1.0
|
12
12
|
platforms = Linux
|
13
13
|
classifiers =
|
14
14
|
Development Status :: 4 - Beta
|
@@ -23,9 +23,9 @@ packages = find_namespace:
|
|
23
23
|
include_package_data = True
|
24
24
|
package_dir =
|
25
25
|
=src
|
26
|
-
python_requires > = 3.
|
26
|
+
python_requires > = 3.8, <= 3.11
|
27
27
|
install_requires =
|
28
|
-
pydantic
|
28
|
+
pydantic~=1.10.7
|
29
29
|
pytz
|
30
30
|
click
|
31
31
|
|
@@ -40,6 +40,7 @@ testing =
|
|
40
40
|
pytest-coverage
|
41
41
|
pytest-timer
|
42
42
|
mypy
|
43
|
+
types-pytz
|
43
44
|
pylint
|
44
45
|
development =
|
45
46
|
pip-tools
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: s2-python
|
3
|
-
Version: 0.0
|
3
|
+
Version: 0.1.0
|
4
4
|
Summary: S2 Protocol Python Wrapper
|
5
5
|
Home-page: https://github.com/flexiblepower/s2-ws-json-python
|
6
6
|
Author: Flexiblepower
|
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
15
15
|
Description-Content-Type: text/x-rst; charset=UTF-8
|
16
|
-
Requires-Dist: pydantic
|
16
|
+
Requires-Dist: pydantic~=1.10.7
|
17
17
|
Requires-Dist: pytz
|
18
18
|
Requires-Dist: click
|
19
19
|
Provides-Extra: testing
|
@@ -21,6 +21,7 @@ Requires-Dist: pytest; extra == "testing"
|
|
21
21
|
Requires-Dist: pytest-coverage; extra == "testing"
|
22
22
|
Requires-Dist: pytest-timer; extra == "testing"
|
23
23
|
Requires-Dist: mypy; extra == "testing"
|
24
|
+
Requires-Dist: types-pytz; extra == "testing"
|
24
25
|
Requires-Dist: pylint; extra == "testing"
|
25
26
|
Provides-Extra: development
|
26
27
|
Requires-Dist: pip-tools; extra == "development"
|
@@ -39,7 +40,7 @@ Python Wrapper for S2 Flexibility Protocol
|
|
39
40
|
===========================================
|
40
41
|
.. image:: https://img.shields.io/pypi/v/s2-python
|
41
42
|
:alt: PyPI - Version
|
42
|
-
.. image:: https://img.shields.io/pypi/pyversions/
|
43
|
+
.. image:: https://img.shields.io/pypi/pyversions/s2-python
|
43
44
|
:alt: PyPI - Python Version
|
44
45
|
.. image:: https://img.shields.io/pypi/l/s2-python
|
45
46
|
:alt: PyPI - License
|
@@ -49,14 +50,29 @@ is based on the asyncapi description of the protocol provided in the `s2-ws-json
|
|
49
50
|
|
50
51
|
Currently, the package supports the *common* and *FILL RATE BASED CONTROL* types and messages.
|
51
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/>`_
|
52
62
|
|
53
63
|
Example
|
54
64
|
---------
|
55
65
|
|
56
66
|
.. code-block:: python
|
57
67
|
|
68
|
+
from s2python.common import PowerRange, CommodityQuantity
|
69
|
+
|
58
70
|
# create s2 messages as Python objects
|
59
|
-
number_range = PowerRange(
|
71
|
+
number_range = PowerRange(
|
72
|
+
start_of_range=4.0,
|
73
|
+
end_of_range=5.0,
|
74
|
+
commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1,
|
75
|
+
)
|
60
76
|
# serialize s2 messages
|
61
77
|
number_range.to_json()
|
62
78
|
# deserialize s2 messages
|
@@ -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
|
@@ -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,12 +4,12 @@ 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
|
-
|
7
|
+
S2Message,
|
8
8
|
)
|
9
9
|
|
10
10
|
|
11
11
|
@catch_and_convert_exceptions
|
12
|
-
class Duration(GenDuration,
|
12
|
+
class Duration(GenDuration, S2Message["Duration"]):
|
13
13
|
def to_timedelta(self) -> timedelta:
|
14
14
|
return timedelta(milliseconds=self.__root__)
|
15
15
|
|
@@ -3,12 +3,12 @@ import uuid
|
|
3
3
|
from s2python.generated.gen_s2 import Handshake as GenHandshake
|
4
4
|
from s2python.validate_values_mixin import (
|
5
5
|
catch_and_convert_exceptions,
|
6
|
-
|
6
|
+
S2Message,
|
7
7
|
)
|
8
8
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
|
-
class Handshake(GenHandshake,
|
11
|
+
class Handshake(GenHandshake, S2Message["Handshake"]):
|
12
12
|
class Config(GenHandshake.Config):
|
13
13
|
validate_assignment = True
|
14
14
|
|
@@ -3,12 +3,12 @@ import uuid
|
|
3
3
|
from s2python.generated.gen_s2 import HandshakeResponse as GenHandshakeResponse
|
4
4
|
from s2python.validate_values_mixin import (
|
5
5
|
catch_and_convert_exceptions,
|
6
|
-
|
6
|
+
S2Message,
|
7
7
|
)
|
8
8
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
|
-
class HandshakeResponse(GenHandshakeResponse,
|
11
|
+
class HandshakeResponse(GenHandshakeResponse, S2Message["HandshakeResponse"]):
|
12
12
|
class Config(GenHandshakeResponse.Config):
|
13
13
|
validate_assignment = True
|
14
14
|
|
@@ -5,13 +5,13 @@ from s2python.generated.gen_s2 import (
|
|
5
5
|
)
|
6
6
|
from s2python.validate_values_mixin import (
|
7
7
|
catch_and_convert_exceptions,
|
8
|
-
|
8
|
+
S2Message,
|
9
9
|
)
|
10
10
|
|
11
11
|
|
12
12
|
@catch_and_convert_exceptions
|
13
13
|
class InstructionStatusUpdate(
|
14
|
-
GenInstructionStatusUpdate,
|
14
|
+
GenInstructionStatusUpdate, S2Message["InstructionStatusUpdate"]
|
15
15
|
):
|
16
16
|
class Config(GenInstructionStatusUpdate.Config):
|
17
17
|
validate_assignment = True
|
@@ -3,19 +3,22 @@ from typing import Any, Dict
|
|
3
3
|
from pydantic import root_validator
|
4
4
|
|
5
5
|
from s2python.validate_values_mixin import (
|
6
|
-
|
6
|
+
S2Message,
|
7
7
|
catch_and_convert_exceptions,
|
8
8
|
)
|
9
9
|
from s2python.generated.gen_s2 import NumberRange as GenNumberRange
|
10
10
|
|
11
11
|
|
12
12
|
@catch_and_convert_exceptions
|
13
|
-
class NumberRange(GenNumberRange,
|
13
|
+
class NumberRange(GenNumberRange, S2Message["NumberRange"]):
|
14
14
|
class Config(GenNumberRange.Config):
|
15
15
|
validate_assignment = True
|
16
16
|
|
17
17
|
@root_validator(pre=False)
|
18
|
-
|
18
|
+
@classmethod
|
19
|
+
def validate_start_end_order( # pylint: disable=duplicate-code
|
20
|
+
cls, values: Dict[str, Any]
|
21
|
+
) -> Dict[str, Any]:
|
19
22
|
if values.get("start_of_range", 0.0) > values.get("end_of_range", 0.0):
|
20
23
|
raise ValueError(
|
21
24
|
cls, "start_of_range should not be higher than end_of_range"
|
@@ -23,14 +26,14 @@ class NumberRange(GenNumberRange, ValidateValuesMixin["NumberRange"]):
|
|
23
26
|
|
24
27
|
return values
|
25
28
|
|
26
|
-
def __hash__(self):
|
29
|
+
def __hash__(self) -> int:
|
27
30
|
return hash(f"{self.start_of_range}|{self.end_of_range}")
|
28
31
|
|
29
|
-
def __eq__(self, other):
|
32
|
+
def __eq__(self, other: Any) -> bool:
|
30
33
|
if isinstance(other, NumberRange):
|
31
34
|
return (
|
32
35
|
self.start_of_range == other.start_of_range
|
33
36
|
and self.end_of_range == other.end_of_range
|
34
37
|
)
|
35
|
-
|
36
|
-
|
38
|
+
|
39
|
+
return False
|
@@ -1,16 +1,16 @@
|
|
1
1
|
from typing import List
|
2
2
|
import uuid
|
3
3
|
|
4
|
-
from s2python.common import PowerForecastElement
|
4
|
+
from s2python.common.power_forecast_element import PowerForecastElement
|
5
5
|
from s2python.generated.gen_s2 import PowerForecast as GenPowerForecast
|
6
6
|
from s2python.validate_values_mixin import (
|
7
7
|
catch_and_convert_exceptions,
|
8
|
-
|
8
|
+
S2Message,
|
9
9
|
)
|
10
10
|
|
11
11
|
|
12
12
|
@catch_and_convert_exceptions
|
13
|
-
class PowerForecast(GenPowerForecast,
|
13
|
+
class PowerForecast(GenPowerForecast, S2Message["PowerForecast"]):
|
14
14
|
class Config(GenPowerForecast.Config):
|
15
15
|
validate_assignment = True
|
16
16
|
|
@@ -3,15 +3,14 @@ from typing import List
|
|
3
3
|
from s2python.generated.gen_s2 import PowerForecastElement as GenPowerForecastElement
|
4
4
|
from s2python.validate_values_mixin import (
|
5
5
|
catch_and_convert_exceptions,
|
6
|
-
|
6
|
+
S2Message,
|
7
7
|
)
|
8
|
-
from s2python.common import Duration
|
8
|
+
from s2python.common.duration import Duration
|
9
|
+
from s2python.common.power_forecast_value import PowerForecastValue
|
9
10
|
|
10
11
|
|
11
12
|
@catch_and_convert_exceptions
|
12
|
-
class PowerForecastElement(
|
13
|
-
GenPowerForecastElement, ValidateValuesMixin["PowerForecastElement"]
|
14
|
-
):
|
13
|
+
class PowerForecastElement(GenPowerForecastElement, S2Message["PowerForecastElement"]):
|
15
14
|
class Config(GenPowerForecastElement.Config):
|
16
15
|
validate_assignment = True
|
17
16
|
|
@@ -1,13 +1,11 @@
|
|
1
1
|
from s2python.generated.gen_s2 import PowerForecastValue as GenPowerForecastValue
|
2
2
|
from s2python.validate_values_mixin import (
|
3
3
|
catch_and_convert_exceptions,
|
4
|
-
|
4
|
+
S2Message,
|
5
5
|
)
|
6
6
|
|
7
7
|
|
8
8
|
@catch_and_convert_exceptions
|
9
|
-
class PowerForecastValue(
|
10
|
-
GenPowerForecastValue, ValidateValuesMixin["PowerForecastValue"]
|
11
|
-
):
|
9
|
+
class PowerForecastValue(GenPowerForecastValue, S2Message["PowerForecastValue"]):
|
12
10
|
class Config(GenPowerForecastValue.Config):
|
13
11
|
validate_assignment = True
|
@@ -1,16 +1,16 @@
|
|
1
1
|
from typing import List
|
2
2
|
import uuid
|
3
3
|
|
4
|
-
from s2python.common import PowerValue
|
4
|
+
from s2python.common.power_value import PowerValue
|
5
5
|
from s2python.generated.gen_s2 import PowerMeasurement as GenPowerMeasurement
|
6
6
|
from s2python.validate_values_mixin import (
|
7
7
|
catch_and_convert_exceptions,
|
8
|
-
|
8
|
+
S2Message,
|
9
9
|
)
|
10
10
|
|
11
11
|
|
12
12
|
@catch_and_convert_exceptions
|
13
|
-
class PowerMeasurement(GenPowerMeasurement,
|
13
|
+
class PowerMeasurement(GenPowerMeasurement, S2Message["PowerMeasurement"]):
|
14
14
|
class Config(GenPowerMeasurement.Config):
|
15
15
|
validate_assignment = True
|
16
16
|
|
@@ -4,18 +4,21 @@ from pydantic import root_validator
|
|
4
4
|
|
5
5
|
from s2python.generated.gen_s2 import PowerRange as GenPowerRange
|
6
6
|
from s2python.validate_values_mixin import (
|
7
|
-
|
7
|
+
S2Message,
|
8
8
|
catch_and_convert_exceptions,
|
9
9
|
)
|
10
10
|
|
11
11
|
|
12
12
|
@catch_and_convert_exceptions
|
13
|
-
class PowerRange(GenPowerRange,
|
13
|
+
class PowerRange(GenPowerRange, S2Message["PowerRange"]):
|
14
14
|
class Config(GenPowerRange.Config):
|
15
15
|
validate_assignment = True
|
16
16
|
|
17
17
|
@root_validator(pre=False)
|
18
|
-
|
18
|
+
@classmethod
|
19
|
+
def validate_start_end_order(
|
20
|
+
cls, values: Dict[str, Any]
|
21
|
+
) -> Dict[str, Any]: # pylint: disable=duplicate-code
|
19
22
|
if values.get("start_of_range", 0.0) > values.get("end_of_range", 0.0):
|
20
23
|
raise ValueError(
|
21
24
|
cls, "start_of_range should not be higher than end_of_range"
|
@@ -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
|
-
|
4
|
+
S2Message,
|
5
5
|
)
|
6
6
|
|
7
7
|
|
8
8
|
@catch_and_convert_exceptions
|
9
|
-
class PowerValue(GenPowerValue,
|
9
|
+
class PowerValue(GenPowerValue, S2Message["PowerValue"]):
|
10
10
|
class Config(GenPowerValue.Config):
|
11
11
|
validate_assignment = True
|
@@ -3,12 +3,12 @@ import uuid
|
|
3
3
|
from s2python.generated.gen_s2 import ReceptionStatus as GenReceptionStatus
|
4
4
|
from s2python.validate_values_mixin import (
|
5
5
|
catch_and_convert_exceptions,
|
6
|
-
|
6
|
+
S2Message,
|
7
7
|
)
|
8
8
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
|
-
class ReceptionStatus(GenReceptionStatus,
|
11
|
+
class ReceptionStatus(GenReceptionStatus, S2Message["ReceptionStatus"]):
|
12
12
|
class Config(GenReceptionStatus.Config):
|
13
13
|
validate_assignment = True
|
14
14
|
|
@@ -1,19 +1,20 @@
|
|
1
1
|
from typing import List
|
2
2
|
import uuid
|
3
3
|
|
4
|
-
from s2python.common import Duration
|
4
|
+
from s2python.common.duration import Duration
|
5
|
+
from s2python.common.role import Role
|
5
6
|
from s2python.generated.gen_s2 import (
|
6
7
|
ResourceManagerDetails as GenResourceManagerDetails,
|
7
8
|
)
|
8
9
|
from s2python.validate_values_mixin import (
|
9
10
|
catch_and_convert_exceptions,
|
10
|
-
|
11
|
+
S2Message,
|
11
12
|
)
|
12
13
|
|
13
14
|
|
14
15
|
@catch_and_convert_exceptions
|
15
16
|
class ResourceManagerDetails(
|
16
|
-
GenResourceManagerDetails,
|
17
|
+
GenResourceManagerDetails, S2Message["ResourceManagerDetails"]
|
17
18
|
):
|
18
19
|
class Config(GenResourceManagerDetails.Config):
|
19
20
|
validate_assignment = True
|
@@ -3,12 +3,12 @@ import uuid
|
|
3
3
|
from s2python.generated.gen_s2 import RevokeObject as GenRevokeObject
|
4
4
|
from s2python.validate_values_mixin import (
|
5
5
|
catch_and_convert_exceptions,
|
6
|
-
|
6
|
+
S2Message,
|
7
7
|
)
|
8
8
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
|
-
class RevokeObject(GenRevokeObject,
|
11
|
+
class RevokeObject(GenRevokeObject, S2Message["RevokeObject"]):
|
12
12
|
class Config(GenRevokeObject.Config):
|
13
13
|
validate_assignment = True
|
14
14
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
from s2python.generated.gen_s2 import Role as GenRole
|
2
2
|
from s2python.validate_values_mixin import (
|
3
|
-
|
3
|
+
S2Message,
|
4
4
|
catch_and_convert_exceptions,
|
5
5
|
)
|
6
6
|
|
7
7
|
|
8
8
|
@catch_and_convert_exceptions
|
9
|
-
class Role(GenRole,
|
9
|
+
class Role(GenRole, S2Message["Role"]):
|
10
10
|
class Config(GenRole.Config):
|
11
11
|
validate_assignment = True
|
@@ -3,12 +3,12 @@ import uuid
|
|
3
3
|
from s2python.generated.gen_s2 import SelectControlType as GenSelectControlType
|
4
4
|
from s2python.validate_values_mixin import (
|
5
5
|
catch_and_convert_exceptions,
|
6
|
-
|
6
|
+
S2Message,
|
7
7
|
)
|
8
8
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
|
-
class SelectControlType(GenSelectControlType,
|
11
|
+
class SelectControlType(GenSelectControlType, S2Message["SelectControlType"]):
|
12
12
|
class Config(GenSelectControlType.Config):
|
13
13
|
validate_assignment = True
|
14
14
|
|
@@ -3,12 +3,12 @@ import uuid
|
|
3
3
|
from s2python.generated.gen_s2 import SessionRequest as GenSessionRequest
|
4
4
|
from s2python.validate_values_mixin import (
|
5
5
|
catch_and_convert_exceptions,
|
6
|
-
|
6
|
+
S2Message,
|
7
7
|
)
|
8
8
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
|
-
class SessionRequest(GenSessionRequest,
|
11
|
+
class SessionRequest(GenSessionRequest, S2Message["SessionRequest"]):
|
12
12
|
class Config(GenSessionRequest.Config):
|
13
13
|
validate_assignment = True
|
14
14
|
|
@@ -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
|
-
|
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
|
-
|
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
|
-
|
19
|
+
result = quantity in [CommodityQuantity.NATURAL_GAS_FLOW_RATE]
|
20
20
|
elif commodity == Commodity.OIL:
|
21
|
-
|
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
|
@@ -3,13 +3,13 @@ import uuid
|
|
3
3
|
from s2python.common.duration import Duration
|
4
4
|
from s2python.generated.gen_s2 import Timer as GenTimer
|
5
5
|
from s2python.validate_values_mixin import (
|
6
|
-
|
6
|
+
S2Message,
|
7
7
|
catch_and_convert_exceptions,
|
8
8
|
)
|
9
9
|
|
10
10
|
|
11
11
|
@catch_and_convert_exceptions
|
12
|
-
class Timer(GenTimer,
|
12
|
+
class Timer(GenTimer, S2Message["Timer"]):
|
13
13
|
class Config(GenTimer.Config):
|
14
14
|
validate_assignment = True
|
15
15
|
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import uuid
|
2
2
|
from typing import Optional, List
|
3
3
|
|
4
|
-
from s2python.common import Duration
|
4
|
+
from s2python.common.duration import Duration
|
5
5
|
from s2python.generated.gen_s2 import Transition as GenTransition
|
6
6
|
from s2python.validate_values_mixin import (
|
7
|
-
|
7
|
+
S2Message,
|
8
8
|
catch_and_convert_exceptions,
|
9
9
|
)
|
10
10
|
|
11
11
|
|
12
12
|
@catch_and_convert_exceptions
|
13
|
-
class Transition(GenTransition,
|
13
|
+
class Transition(GenTransition, S2Message["Transition"]):
|
14
14
|
class Config(GenTransition.Config):
|
15
15
|
validate_assignment = True
|
16
16
|
|