s2-python 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl
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.3.0.dist-info → s2_python-0.4.0.dist-info}/METADATA +21 -21
- s2_python-0.4.0.dist-info/RECORD +66 -0
- {s2_python-0.3.0.dist-info → s2_python-0.4.0.dist-info}/WHEEL +1 -1
- s2python/common/duration.py +2 -2
- s2python/common/handshake.py +2 -2
- s2python/common/handshake_response.py +2 -2
- s2python/common/instruction_status_update.py +2 -2
- s2python/common/number_range.py +2 -2
- s2python/common/power_forecast.py +2 -2
- s2python/common/power_forecast_element.py +2 -2
- s2python/common/power_forecast_value.py +2 -2
- s2python/common/power_measurement.py +2 -2
- s2python/common/power_range.py +2 -2
- s2python/common/power_value.py +2 -2
- s2python/common/reception_status.py +2 -2
- s2python/common/resource_manager_details.py +2 -2
- s2python/common/revoke_object.py +2 -2
- s2python/common/role.py +2 -2
- s2python/common/select_control_type.py +2 -2
- s2python/common/session_request.py +2 -2
- s2python/common/timer.py +2 -2
- s2python/common/transition.py +2 -2
- s2python/frbc/frbc_actuator_description.py +2 -2
- s2python/frbc/frbc_actuator_status.py +2 -2
- s2python/frbc/frbc_fill_level_target_profile.py +2 -2
- s2python/frbc/frbc_fill_level_target_profile_element.py +2 -2
- s2python/frbc/frbc_instruction.py +2 -2
- s2python/frbc/frbc_leakage_behaviour.py +2 -2
- s2python/frbc/frbc_leakage_behaviour_element.py +2 -2
- s2python/frbc/frbc_operation_mode.py +2 -2
- s2python/frbc/frbc_operation_mode_element.py +2 -2
- s2python/frbc/frbc_storage_description.py +2 -2
- s2python/frbc/frbc_storage_status.py +2 -2
- s2python/frbc/frbc_system_description.py +2 -2
- s2python/frbc/frbc_timer_status.py +2 -2
- s2python/frbc/frbc_usage_forecast.py +2 -2
- s2python/frbc/frbc_usage_forecast_element.py +2 -2
- s2python/message.py +50 -0
- s2python/ppbc/__init__.py +12 -0
- s2python/ppbc/ppbc_end_interruption_instruction.py +32 -0
- s2python/ppbc/ppbc_power_profile_definition.py +27 -0
- s2python/ppbc/ppbc_power_profile_status.py +26 -0
- s2python/ppbc/ppbc_power_sequence.py +30 -0
- s2python/ppbc/ppbc_power_sequence_container.py +27 -0
- s2python/ppbc/ppbc_power_sequence_container_status.py +32 -0
- s2python/ppbc/ppbc_power_sequence_element.py +25 -0
- s2python/ppbc/ppbc_schedule_instruction.py +33 -0
- s2python/ppbc/ppbc_start_interruption_instruction.py +32 -0
- s2python/s2_connection.py +7 -7
- s2python/s2_control_type.py +27 -3
- s2python/s2_parser.py +12 -4
- s2python/validate_values_mixin.py +2 -2
- s2_python-0.3.0.dist-info/RECORD +0 -55
- {s2_python-0.3.0.dist-info → s2_python-0.4.0.dist-info}/entry_points.txt +0 -0
- {s2_python-0.3.0.dist-info → s2_python-0.4.0.dist-info}/top_level.txt +0 -0
@@ -3,12 +3,12 @@ import uuid
|
|
3
3
|
from s2python.generated.gen_s2 import FRBCTimerStatus as GenFRBCTimerStatus
|
4
4
|
from s2python.validate_values_mixin import (
|
5
5
|
catch_and_convert_exceptions,
|
6
|
-
|
6
|
+
S2MessageComponent,
|
7
7
|
)
|
8
8
|
|
9
9
|
|
10
10
|
@catch_and_convert_exceptions
|
11
|
-
class FRBCTimerStatus(GenFRBCTimerStatus,
|
11
|
+
class FRBCTimerStatus(GenFRBCTimerStatus, S2MessageComponent["FRBCTimerStatus"]):
|
12
12
|
model_config = GenFRBCTimerStatus.model_config
|
13
13
|
model_config["validate_assignment"] = True
|
14
14
|
|
@@ -4,13 +4,13 @@ import uuid
|
|
4
4
|
from s2python.generated.gen_s2 import FRBCUsageForecast as GenFRBCUsageForecast
|
5
5
|
from s2python.validate_values_mixin import (
|
6
6
|
catch_and_convert_exceptions,
|
7
|
-
|
7
|
+
S2MessageComponent,
|
8
8
|
)
|
9
9
|
from s2python.frbc.frbc_usage_forecast_element import FRBCUsageForecastElement
|
10
10
|
|
11
11
|
|
12
12
|
@catch_and_convert_exceptions
|
13
|
-
class FRBCUsageForecast(GenFRBCUsageForecast,
|
13
|
+
class FRBCUsageForecast(GenFRBCUsageForecast, S2MessageComponent["FRBCUsageForecast"]):
|
14
14
|
model_config = GenFRBCUsageForecast.model_config
|
15
15
|
model_config["validate_assignment"] = True
|
16
16
|
|
@@ -5,12 +5,12 @@ from s2python.generated.gen_s2 import (
|
|
5
5
|
)
|
6
6
|
from s2python.validate_values_mixin import (
|
7
7
|
catch_and_convert_exceptions,
|
8
|
-
|
8
|
+
S2MessageComponent,
|
9
9
|
)
|
10
10
|
|
11
11
|
|
12
12
|
@catch_and_convert_exceptions
|
13
|
-
class FRBCUsageForecastElement(GenFRBCUsageForecastElement,
|
13
|
+
class FRBCUsageForecastElement(GenFRBCUsageForecastElement, S2MessageComponent["FRBCUsageForecastElement"]):
|
14
14
|
model_config = GenFRBCUsageForecastElement.model_config
|
15
15
|
model_config["validate_assignment"] = True
|
16
16
|
|
s2python/message.py
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
from typing import Union
|
2
|
+
|
3
|
+
from s2python.frbc import (
|
4
|
+
FRBCActuatorStatus,
|
5
|
+
FRBCFillLevelTargetProfile,
|
6
|
+
FRBCInstruction,
|
7
|
+
FRBCLeakageBehaviour,
|
8
|
+
FRBCStorageStatus,
|
9
|
+
FRBCSystemDescription,
|
10
|
+
FRBCTimerStatus,
|
11
|
+
FRBCUsageForecast
|
12
|
+
)
|
13
|
+
from s2python.ppbc import (
|
14
|
+
PPBCScheduleInstruction,
|
15
|
+
)
|
16
|
+
|
17
|
+
from s2python.common import (
|
18
|
+
Handshake,
|
19
|
+
HandshakeResponse,
|
20
|
+
InstructionStatusUpdate,
|
21
|
+
PowerForecast,
|
22
|
+
PowerMeasurement,
|
23
|
+
ReceptionStatus,
|
24
|
+
ResourceManagerDetails,
|
25
|
+
RevokeObject,
|
26
|
+
SelectControlType,
|
27
|
+
SessionRequest
|
28
|
+
)
|
29
|
+
|
30
|
+
S2Message = Union[
|
31
|
+
FRBCActuatorStatus,
|
32
|
+
FRBCFillLevelTargetProfile,
|
33
|
+
FRBCInstruction,
|
34
|
+
FRBCLeakageBehaviour,
|
35
|
+
FRBCStorageStatus,
|
36
|
+
FRBCSystemDescription,
|
37
|
+
FRBCTimerStatus,
|
38
|
+
FRBCUsageForecast,
|
39
|
+
PPBCScheduleInstruction,
|
40
|
+
Handshake,
|
41
|
+
HandshakeResponse,
|
42
|
+
InstructionStatusUpdate,
|
43
|
+
PowerForecast,
|
44
|
+
PowerMeasurement,
|
45
|
+
ReceptionStatus,
|
46
|
+
ResourceManagerDetails,
|
47
|
+
RevokeObject,
|
48
|
+
SelectControlType,
|
49
|
+
SessionRequest,
|
50
|
+
]
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from s2python.ppbc.ppbc_schedule_instruction import PPBCScheduleInstruction
|
2
|
+
from s2python.ppbc.ppbc_end_interruption_instruction import (
|
3
|
+
PPBCEndInterruptionInstruction,
|
4
|
+
)
|
5
|
+
from s2python.ppbc.ppbc_power_profile_definition import PPBCPowerProfileDefinition
|
6
|
+
from s2python.ppbc.ppbc_power_sequence_container import PPBCPowerSequenceContainer
|
7
|
+
from s2python.ppbc.ppbc_power_sequence import PPBCPowerSequence
|
8
|
+
from s2python.ppbc.ppbc_power_profile_status import PPBCPowerProfileStatus
|
9
|
+
from s2python.ppbc.ppbc_power_sequence_container_status import (
|
10
|
+
PPBCPowerSequenceContainerStatus,
|
11
|
+
)
|
12
|
+
from s2python.ppbc.ppbc_power_sequence_element import PPBCPowerSequenceElement
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import uuid
|
2
|
+
|
3
|
+
from s2python.generated.gen_s2 import (
|
4
|
+
PPBCEndInterruptionInstruction as GenPPBCEndInterruptionInstruction,
|
5
|
+
)
|
6
|
+
|
7
|
+
from s2python.validate_values_mixin import (
|
8
|
+
S2MessageComponent,
|
9
|
+
catch_and_convert_exceptions,
|
10
|
+
)
|
11
|
+
|
12
|
+
|
13
|
+
@catch_and_convert_exceptions
|
14
|
+
class PPBCEndInterruptionInstruction(
|
15
|
+
GenPPBCEndInterruptionInstruction, S2MessageComponent["PPBCEndInterruptionInstruction"]
|
16
|
+
):
|
17
|
+
model_config = GenPPBCEndInterruptionInstruction.model_config
|
18
|
+
model_config["validate_assignment"] = True
|
19
|
+
|
20
|
+
id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields["id"] # type: ignore[assignment]
|
21
|
+
power_profile_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[
|
22
|
+
"power_profile_id"
|
23
|
+
] # type: ignore[assignment]
|
24
|
+
sequence_container_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[
|
25
|
+
"sequence_container_id"
|
26
|
+
] # type: ignore[assignment]
|
27
|
+
power_sequence_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[
|
28
|
+
"power_sequence_id"
|
29
|
+
] # type: ignore[assignment]
|
30
|
+
abnormal_condition: bool = GenPPBCEndInterruptionInstruction.model_fields[
|
31
|
+
"abnormal_condition"
|
32
|
+
] # type: ignore[assignment]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
from typing import List
|
2
|
+
import uuid
|
3
|
+
|
4
|
+
from s2python.generated.gen_s2 import (
|
5
|
+
PPBCPowerProfileDefinition as GenPPBCPowerProfileDefinition,
|
6
|
+
)
|
7
|
+
|
8
|
+
from s2python.validate_values_mixin import (
|
9
|
+
S2MessageComponent,
|
10
|
+
catch_and_convert_exceptions,
|
11
|
+
)
|
12
|
+
|
13
|
+
from s2python.ppbc.ppbc_power_sequence_container import PPBCPowerSequenceContainer
|
14
|
+
|
15
|
+
|
16
|
+
@catch_and_convert_exceptions
|
17
|
+
class PPBCPowerProfileDefinition(
|
18
|
+
GenPPBCPowerProfileDefinition, S2MessageComponent["PPBCPowerProfileDefinition"]
|
19
|
+
):
|
20
|
+
model_config = GenPPBCPowerProfileDefinition.model_config
|
21
|
+
model_config["validate_assignment"] = True
|
22
|
+
|
23
|
+
message_id: uuid.UUID = GenPPBCPowerProfileDefinition.model_fields["message_id"] # type: ignore[assignment]
|
24
|
+
id: uuid.UUID = GenPPBCPowerProfileDefinition.model_fields["id"] # type: ignore[assignment]
|
25
|
+
power_sequences_containers: List[PPBCPowerSequenceContainer] = (
|
26
|
+
GenPPBCPowerProfileDefinition.model_fields["power_sequences_containers"] # type: ignore[assignment]
|
27
|
+
)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
from typing import List
|
2
|
+
|
3
|
+
from s2python.generated.gen_s2 import (
|
4
|
+
PPBCPowerProfileStatus as GenPPBCPowerProfileStatus,
|
5
|
+
)
|
6
|
+
|
7
|
+
from s2python.validate_values_mixin import (
|
8
|
+
S2MessageComponent,
|
9
|
+
catch_and_convert_exceptions,
|
10
|
+
)
|
11
|
+
|
12
|
+
from s2python.ppbc.ppbc_power_sequence_container_status import (
|
13
|
+
PPBCPowerSequenceContainerStatus,
|
14
|
+
)
|
15
|
+
|
16
|
+
|
17
|
+
@catch_and_convert_exceptions
|
18
|
+
class PPBCPowerProfileStatus(
|
19
|
+
GenPPBCPowerProfileStatus, S2MessageComponent["PPBCPowerProfileStatus"]
|
20
|
+
):
|
21
|
+
model_config = GenPPBCPowerProfileStatus.model_config
|
22
|
+
model_config["validate_assignment"] = True
|
23
|
+
|
24
|
+
sequence_container_status: List[PPBCPowerSequenceContainerStatus] = (
|
25
|
+
GenPPBCPowerProfileStatus.model_fields["sequence_container_status"] # type: ignore[assignment]
|
26
|
+
)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
from typing import List
|
2
|
+
import uuid
|
3
|
+
|
4
|
+
from s2python.generated.gen_s2 import (
|
5
|
+
PPBCPowerSequence as GenPPBCPowerSequence,
|
6
|
+
)
|
7
|
+
|
8
|
+
from s2python.validate_values_mixin import (
|
9
|
+
S2MessageComponent,
|
10
|
+
catch_and_convert_exceptions,
|
11
|
+
)
|
12
|
+
|
13
|
+
from s2python.ppbc.ppbc_power_sequence_element import PPBCPowerSequenceElement
|
14
|
+
from s2python.common import Duration
|
15
|
+
|
16
|
+
|
17
|
+
@catch_and_convert_exceptions
|
18
|
+
class PPBCPowerSequence(GenPPBCPowerSequence, S2MessageComponent["PPBCPowerSequence"]):
|
19
|
+
model_config = GenPPBCPowerSequence.model_config
|
20
|
+
model_config["validate_assignment"] = True
|
21
|
+
|
22
|
+
id: uuid.UUID = GenPPBCPowerSequence.model_fields["id"] # type: ignore[assignment]
|
23
|
+
elements: List[PPBCPowerSequenceElement] = GenPPBCPowerSequence.model_fields[
|
24
|
+
"elements"
|
25
|
+
] # type: ignore[assignment]
|
26
|
+
is_interruptible: bool = GenPPBCPowerSequence.model_fields["is_interruptible"] # type: ignore[assignment]
|
27
|
+
max_pause_before: Duration = GenPPBCPowerSequence.model_fields["max_pause_before"] # type: ignore[assignment]
|
28
|
+
abnormal_condition_only: bool = GenPPBCPowerSequence.model_fields[
|
29
|
+
"abnormal_condition_only"
|
30
|
+
] # type: ignore[assignment]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
from typing import List
|
2
|
+
import uuid
|
3
|
+
|
4
|
+
|
5
|
+
from s2python.generated.gen_s2 import (
|
6
|
+
PPBCPowerSequenceContainer as GenPPBCPowerSequenceContainer,
|
7
|
+
)
|
8
|
+
|
9
|
+
from s2python.validate_values_mixin import (
|
10
|
+
S2MessageComponent,
|
11
|
+
catch_and_convert_exceptions,
|
12
|
+
)
|
13
|
+
|
14
|
+
from s2python.ppbc.ppbc_power_sequence import PPBCPowerSequence
|
15
|
+
|
16
|
+
|
17
|
+
@catch_and_convert_exceptions
|
18
|
+
class PPBCPowerSequenceContainer(
|
19
|
+
GenPPBCPowerSequenceContainer, S2MessageComponent["PPBCPowerSequenceContainer"]
|
20
|
+
):
|
21
|
+
model_config = GenPPBCPowerSequenceContainer.model_config
|
22
|
+
model_config["validate_assignment"] = True
|
23
|
+
|
24
|
+
id: uuid.UUID = GenPPBCPowerSequenceContainer.model_fields["id"] # type: ignore[assignment]
|
25
|
+
power_sequences: List[PPBCPowerSequence] = (
|
26
|
+
GenPPBCPowerSequenceContainer.model_fields["power_sequences"] # type: ignore[assignment]
|
27
|
+
)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import uuid
|
2
|
+
from typing import Union
|
3
|
+
|
4
|
+
from s2python.generated.gen_s2 import (
|
5
|
+
PPBCPowerSequenceContainerStatus as GenPPBCPowerSequenceContainerStatus,
|
6
|
+
)
|
7
|
+
|
8
|
+
from s2python.validate_values_mixin import (
|
9
|
+
S2MessageComponent,
|
10
|
+
catch_and_convert_exceptions,
|
11
|
+
)
|
12
|
+
|
13
|
+
|
14
|
+
@catch_and_convert_exceptions
|
15
|
+
class PPBCPowerSequenceContainerStatus(
|
16
|
+
GenPPBCPowerSequenceContainerStatus, S2MessageComponent["PPBCPowerSequenceContainerStatus"]
|
17
|
+
):
|
18
|
+
model_config = GenPPBCPowerSequenceContainerStatus.model_config
|
19
|
+
model_config["validate_assignment"] = True
|
20
|
+
|
21
|
+
power_profile_id: uuid.UUID = GenPPBCPowerSequenceContainerStatus.model_fields[
|
22
|
+
"power_profile_id" # type: ignore[assignment]
|
23
|
+
]
|
24
|
+
sequence_container_id: uuid.UUID = GenPPBCPowerSequenceContainerStatus.model_fields[
|
25
|
+
"sequence_container_id" # type: ignore[assignment]
|
26
|
+
]
|
27
|
+
selected_sequence_id: Union[uuid.UUID, None] = (
|
28
|
+
GenPPBCPowerSequenceContainerStatus.model_fields["selected_sequence_id"] # type: ignore[assignment]
|
29
|
+
)
|
30
|
+
progress: Union[uuid.UUID, None] = GenPPBCPowerSequenceContainerStatus.model_fields[
|
31
|
+
"progress" # type: ignore[assignment]
|
32
|
+
]
|
@@ -0,0 +1,25 @@
|
|
1
|
+
from typing import List
|
2
|
+
|
3
|
+
from s2python.generated.gen_s2 import (
|
4
|
+
PPBCPowerSequenceElement as GenPPBCPowerSequenceElement,
|
5
|
+
)
|
6
|
+
|
7
|
+
from s2python.validate_values_mixin import (
|
8
|
+
S2MessageComponent,
|
9
|
+
catch_and_convert_exceptions,
|
10
|
+
)
|
11
|
+
|
12
|
+
from s2python.common import Duration, PowerForecastValue
|
13
|
+
|
14
|
+
|
15
|
+
@catch_and_convert_exceptions
|
16
|
+
class PPBCPowerSequenceElement(
|
17
|
+
GenPPBCPowerSequenceElement, S2MessageComponent["PPBCPowerSequenceElement"]
|
18
|
+
):
|
19
|
+
model_config = GenPPBCPowerSequenceElement.model_config
|
20
|
+
model_config["validate_assignment"] = True
|
21
|
+
|
22
|
+
duration: Duration = GenPPBCPowerSequenceElement.model_fields["duration"] # type: ignore[assignment]
|
23
|
+
power_values: List[PowerForecastValue] = GenPPBCPowerSequenceElement.model_fields[
|
24
|
+
"power_values"
|
25
|
+
] # type: ignore[assignment]
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import uuid
|
2
|
+
|
3
|
+
from s2python.generated.gen_s2 import (
|
4
|
+
PPBCScheduleInstruction as GenPPBCScheduleInstruction,
|
5
|
+
)
|
6
|
+
from s2python.validate_values_mixin import (
|
7
|
+
catch_and_convert_exceptions,
|
8
|
+
S2MessageComponent,
|
9
|
+
)
|
10
|
+
|
11
|
+
|
12
|
+
@catch_and_convert_exceptions
|
13
|
+
class PPBCScheduleInstruction(
|
14
|
+
GenPPBCScheduleInstruction, S2MessageComponent["PPBCScheduleInstruction"]
|
15
|
+
):
|
16
|
+
model_config = GenPPBCScheduleInstruction.model_config
|
17
|
+
model_config["validate_assignment"] = True
|
18
|
+
|
19
|
+
id: uuid.UUID = GenPPBCScheduleInstruction.model_fields["id"] # type: ignore[assignment]
|
20
|
+
|
21
|
+
power_profile_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields[
|
22
|
+
"power_profile_id"
|
23
|
+
] # type: ignore[assignment]
|
24
|
+
|
25
|
+
message_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields["message_id"] # type: ignore[assignment]
|
26
|
+
|
27
|
+
sequence_container_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields[
|
28
|
+
"sequence_container_id"
|
29
|
+
] # type: ignore[assignment]
|
30
|
+
|
31
|
+
power_sequence_id: uuid.UUID = GenPPBCScheduleInstruction.model_fields[
|
32
|
+
"power_sequence_id"
|
33
|
+
] # type: ignore[assignment]
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import uuid
|
2
|
+
|
3
|
+
from s2python.generated.gen_s2 import (
|
4
|
+
PPBCStartInterruptionInstruction as GenPPBCStartInterruptionInstruction,
|
5
|
+
)
|
6
|
+
|
7
|
+
from s2python.validate_values_mixin import (
|
8
|
+
S2MessageComponent,
|
9
|
+
catch_and_convert_exceptions,
|
10
|
+
)
|
11
|
+
|
12
|
+
|
13
|
+
@catch_and_convert_exceptions
|
14
|
+
class PPBCStartInterruptionInstruction(
|
15
|
+
GenPPBCStartInterruptionInstruction, S2MessageComponent["PPBCStartInterruptionInstruction"]
|
16
|
+
):
|
17
|
+
model_config = GenPPBCStartInterruptionInstruction.model_config
|
18
|
+
model_config["validate_assignment"] = True
|
19
|
+
|
20
|
+
id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields["id"] # type: ignore[assignment]
|
21
|
+
power_profile_id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields[
|
22
|
+
"power_profile_id"
|
23
|
+
] # type: ignore[assignment]
|
24
|
+
sequence_container_id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields[
|
25
|
+
"sequence_container_id"
|
26
|
+
] # type: ignore[assignment]
|
27
|
+
power_sequence_id: uuid.UUID = GenPPBCStartInterruptionInstruction.model_fields[
|
28
|
+
"power_sequence_id"
|
29
|
+
] # type: ignore[assignment]
|
30
|
+
abnormal_condition: bool = GenPPBCStartInterruptionInstruction.model_fields[
|
31
|
+
"abnormal_condition"
|
32
|
+
] # type: ignore[assignment]
|
s2python/s2_connection.py
CHANGED
@@ -27,7 +27,7 @@ from s2python.reception_status_awaiter import ReceptionStatusAwaiter
|
|
27
27
|
from s2python.s2_control_type import S2ControlType
|
28
28
|
from s2python.s2_parser import S2Parser
|
29
29
|
from s2python.s2_validation_error import S2ValidationError
|
30
|
-
from s2python.
|
30
|
+
from s2python.message import S2Message
|
31
31
|
from s2python.version import S2_VERSION
|
32
32
|
|
33
33
|
logger = logging.getLogger("s2python")
|
@@ -141,7 +141,7 @@ class MessageHandlers:
|
|
141
141
|
"""
|
142
142
|
handler = self.handlers.get(type(msg))
|
143
143
|
if handler is not None:
|
144
|
-
send_okay = SendOkay(connection, msg.message_id) # type: ignore[attr-defined]
|
144
|
+
send_okay = SendOkay(connection, msg.message_id) # type: ignore[attr-defined, union-attr]
|
145
145
|
|
146
146
|
try:
|
147
147
|
if asyncio.iscoroutinefunction(handler):
|
@@ -158,9 +158,9 @@ class MessageHandlers:
|
|
158
158
|
except Exception:
|
159
159
|
if not send_okay.status_is_send.is_set():
|
160
160
|
await connection.respond_with_reception_status(
|
161
|
-
subject_message_id=str(msg.message_id), # type: ignore[attr-defined]
|
161
|
+
subject_message_id=str(msg.message_id), # type: ignore[attr-defined, union-attr]
|
162
162
|
status=ReceptionStatusValues.PERMANENT_ERROR,
|
163
|
-
diagnostic_label=f"While processing message {msg.message_id} " # type: ignore[attr-defined]
|
163
|
+
diagnostic_label=f"While processing message {msg.message_id} " # type: ignore[attr-defined, union-attr] # pylint: disable=line-too-long
|
164
164
|
f"an unrecoverable error occurred.",
|
165
165
|
)
|
166
166
|
raise
|
@@ -490,17 +490,17 @@ class S2Connection: # pylint: disable=too-many-instance-attributes
|
|
490
490
|
await self._send_and_forget(s2_msg)
|
491
491
|
logger.debug(
|
492
492
|
"Waiting for ReceptionStatus for %s %s seconds",
|
493
|
-
s2_msg.message_id, # type: ignore[attr-defined]
|
493
|
+
s2_msg.message_id, # type: ignore[attr-defined, union-attr]
|
494
494
|
timeout_reception_status,
|
495
495
|
)
|
496
496
|
try:
|
497
497
|
reception_status = await self.reception_status_awaiter.wait_for_reception_status(
|
498
|
-
s2_msg.message_id, timeout_reception_status # type: ignore[attr-defined]
|
498
|
+
s2_msg.message_id, timeout_reception_status # type: ignore[attr-defined, union-attr]
|
499
499
|
)
|
500
500
|
except TimeoutError:
|
501
501
|
logger.error(
|
502
502
|
"Did not receive a reception status on time for %s",
|
503
|
-
s2_msg.message_id, # type: ignore[attr-defined]
|
503
|
+
s2_msg.message_id, # type: ignore[attr-defined, union-attr]
|
504
504
|
)
|
505
505
|
self._stop_event.set()
|
506
506
|
raise
|
s2python/s2_control_type.py
CHANGED
@@ -3,7 +3,8 @@ import typing
|
|
3
3
|
|
4
4
|
from s2python.common import ControlType as ProtocolControlType
|
5
5
|
from s2python.frbc import FRBCInstruction
|
6
|
-
from s2python.
|
6
|
+
from s2python.ppbc import PPBCScheduleInstruction
|
7
|
+
from s2python.message import S2Message
|
7
8
|
|
8
9
|
if typing.TYPE_CHECKING:
|
9
10
|
from s2python.s2_connection import S2Connection, MessageHandlers
|
@@ -36,10 +37,33 @@ class FRBCControlType(S2ControlType):
|
|
36
37
|
) -> None: ...
|
37
38
|
|
38
39
|
@abc.abstractmethod
|
39
|
-
def activate(self, conn: "S2Connection") -> None:
|
40
|
+
def activate(self, conn: "S2Connection") -> None:
|
41
|
+
"""Overwrite with the actual dctivation logic of your Resource Manager for this particular control type."""
|
40
42
|
|
41
43
|
@abc.abstractmethod
|
42
|
-
def deactivate(self, conn: "S2Connection") -> None:
|
44
|
+
def deactivate(self, conn: "S2Connection") -> None:
|
45
|
+
"""Overwrite with the actual deactivation logic of your Resource Manager for this particular control type."""
|
46
|
+
|
47
|
+
|
48
|
+
class PPBCControlType(S2ControlType):
|
49
|
+
def get_protocol_control_type(self) -> ProtocolControlType:
|
50
|
+
return ProtocolControlType.POWER_PROFILE_BASED_CONTROL
|
51
|
+
|
52
|
+
def register_handlers(self, handlers: "MessageHandlers") -> None:
|
53
|
+
handlers.register_handler(PPBCScheduleInstruction, self.handle_instruction)
|
54
|
+
|
55
|
+
@abc.abstractmethod
|
56
|
+
def handle_instruction(
|
57
|
+
self, conn: "S2Connection", msg: S2Message, send_okay: typing.Callable[[], None]
|
58
|
+
) -> None: ...
|
59
|
+
|
60
|
+
@abc.abstractmethod
|
61
|
+
def activate(self, conn: "S2Connection") -> None:
|
62
|
+
"""Overwrite with the actual dctivation logic of your Resource Manager for this particular control type."""
|
63
|
+
|
64
|
+
@abc.abstractmethod
|
65
|
+
def deactivate(self, conn: "S2Connection") -> None:
|
66
|
+
"""Overwrite with the actual deactivation logic of your Resource Manager for this particular control type."""
|
43
67
|
|
44
68
|
|
45
69
|
class NoControlControlType(S2ControlType):
|
s2python/s2_parser.py
CHANGED
@@ -24,14 +24,17 @@ from s2python.frbc import (
|
|
24
24
|
FRBCTimerStatus,
|
25
25
|
FRBCUsageForecast,
|
26
26
|
)
|
27
|
-
from s2python.
|
27
|
+
from s2python.ppbc import PPBCScheduleInstruction
|
28
|
+
|
29
|
+
from s2python.message import S2Message
|
30
|
+
from s2python.validate_values_mixin import S2MessageComponent
|
28
31
|
from s2python.s2_validation_error import S2ValidationError
|
29
32
|
|
30
33
|
|
31
34
|
LOGGER = logging.getLogger(__name__)
|
32
35
|
S2MessageType = str
|
33
36
|
|
34
|
-
M = TypeVar("M", bound=
|
37
|
+
M = TypeVar("M", bound=S2MessageComponent)
|
35
38
|
|
36
39
|
|
37
40
|
# May be generated with development_utilities/generate_s2_message_type_to_class.py
|
@@ -44,6 +47,7 @@ TYPE_TO_MESSAGE_CLASS: Dict[str, Type[S2Message]] = {
|
|
44
47
|
"FRBC.SystemDescription": FRBCSystemDescription,
|
45
48
|
"FRBC.TimerStatus": FRBCTimerStatus,
|
46
49
|
"FRBC.UsageForecast": FRBCUsageForecast,
|
50
|
+
"PPBC.ScheduleInstruction": PPBCScheduleInstruction,
|
47
51
|
"Handshake": Handshake,
|
48
52
|
"HandshakeResponse": HandshakeResponse,
|
49
53
|
"InstructionStatusUpdate": InstructionStatusUpdate,
|
@@ -86,7 +90,9 @@ class S2Parser:
|
|
86
90
|
return TYPE_TO_MESSAGE_CLASS[message_type].model_validate(message_json)
|
87
91
|
|
88
92
|
@staticmethod
|
89
|
-
def parse_as_message(
|
93
|
+
def parse_as_message(
|
94
|
+
unparsed_message: Union[dict, str, bytes], as_message: Type[M]
|
95
|
+
) -> M:
|
90
96
|
"""Parse the message to a specific S2 python message.
|
91
97
|
|
92
98
|
:param unparsed_message: The message as a JSON-formatted string or as a JSON-parsed dictionary.
|
@@ -98,7 +104,9 @@ class S2Parser:
|
|
98
104
|
return as_message.from_dict(message_json)
|
99
105
|
|
100
106
|
@staticmethod
|
101
|
-
def parse_message_type(
|
107
|
+
def parse_message_type(
|
108
|
+
unparsed_message: Union[dict, str, bytes],
|
109
|
+
) -> Optional[S2MessageType]:
|
102
110
|
"""Parse only the message type from the unparsed message.
|
103
111
|
|
104
112
|
This is useful to call before `parse_as_message` to retrieve the message type and allows for strictly-typed
|
@@ -15,7 +15,7 @@ MappingIntStrAny = Mapping[IntStr, Any]
|
|
15
15
|
C = TypeVar("C", bound="BaseModel")
|
16
16
|
|
17
17
|
|
18
|
-
class
|
18
|
+
class S2MessageComponent(BaseModel, Generic[C]):
|
19
19
|
def to_json(self: C) -> str:
|
20
20
|
try:
|
21
21
|
return self.model_dump_json(by_alias=True, exclude_none=True)
|
@@ -59,7 +59,7 @@ def convert_to_s2exception(f: Callable) -> Callable:
|
|
59
59
|
return inner
|
60
60
|
|
61
61
|
|
62
|
-
def catch_and_convert_exceptions(input_class: Type[
|
62
|
+
def catch_and_convert_exceptions(input_class: Type[S2MessageComponent[B_co]]) -> Type[S2MessageComponent[B_co]]:
|
63
63
|
input_class.__init__ = convert_to_s2exception(input_class.__init__) # type: ignore[method-assign]
|
64
64
|
input_class.__setattr__ = convert_to_s2exception(input_class.__setattr__) # type: ignore[method-assign]
|
65
65
|
input_class.model_validate_json = convert_to_s2exception( # type: ignore[method-assign]
|
s2_python-0.3.0.dist-info/RECORD
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
s2python/__init__.py,sha256=e5lwvqsPl-z7IfEd0hRQhLBRKBYcuw2eqrecXnMfLdg,384
|
2
|
-
s2python/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
s2python/reception_status_awaiter.py,sha256=jKMliFk1XxwsEGtx3vFESbJhUtClB7cTu-td90-qBN8,2137
|
4
|
-
s2python/s2_connection.py,sha256=S36VNTLP3kMvcdiaw4Slw438CDPF7O1mugEarx8KIwY,20075
|
5
|
-
s2python/s2_control_type.py,sha256=TPG4ZWEi8RbVg50V4BnNfkYb5EEvNsWuG8S5Qx2W-iQ,1721
|
6
|
-
s2python/s2_parser.py,sha256=1ZaCL3bWKHtmidr_VQqp3nzjr8VQjeltRN81stA0mfw,4160
|
7
|
-
s2python/s2_validation_error.py,sha256=BkOLoNsrcQ3MzdCYaPDgs1Wu6lPdlQDpZsTpykKGQmE,384
|
8
|
-
s2python/utils.py,sha256=QX9b-mi-H_YUGTmGmJsrAbaWWM3dgaoaRLRXHHlaZDE,212
|
9
|
-
s2python/validate_values_mixin.py,sha256=hfXW-ViHSwahIgD2r1tmdOtt9uOZEdMCf9Bw2mRJUM8,2541
|
10
|
-
s2python/version.py,sha256=IBzoytgbYYYekQnSTfSmWeYAZ4c_yUFU2oLIAG4UYjs,45
|
11
|
-
s2python/common/__init__.py,sha256=yEAXCS59XpNOEXbEXoN04SwultP-3evgVzFuEUSgB5I,1345
|
12
|
-
s2python/common/duration.py,sha256=Sw1l0-omcPCzlWJP-xkMioQjiBwjTICGoqtYi8BoVOM,649
|
13
|
-
s2python/common/handshake.py,sha256=43MGJWjbPT53DQUP2kclMY82wefcW2uJ3UyHezJPZZU,449
|
14
|
-
s2python/common/handshake_response.py,sha256=CFZ9tPbYWRqvl8HlvcOSRW1akAf8P63Vv_t0dbxAaKA,505
|
15
|
-
s2python/common/instruction_status_update.py,sha256=d-Z_0fZh_yIC-cupkaDG-x19uVxznQVHsyacZW5hwQ0,674
|
16
|
-
s2python/common/number_range.py,sha256=4OT4zzmsgytM0cScBuIqcTl0w1I0gAcbcaN7oRfJiak,723
|
17
|
-
s2python/common/power_forecast.py,sha256=foJKA9Wmm-CzkK7qIfaW4963NqoY1-pZcvBXmUMPazw,686
|
18
|
-
s2python/common/power_forecast_element.py,sha256=HdetbhqTqXa_TWMkpL7P7r3yKdmiNMFmZNtrMT4fAlw,787
|
19
|
-
s2python/common/power_forecast_value.py,sha256=o-KegTZjUsrziNenoZZ9pjfYrkrLG_b5Cr8GcVcebD4,393
|
20
|
-
s2python/common/power_measurement.py,sha256=t6qDcisnI8xSEmfOZeI35MMgkBB5vFqnnc5KsqrPiqk,675
|
21
|
-
s2python/common/power_range.py,sha256=tvzb9cyVs1NLsiN6jo8jdHo9vRqCu4bnvkBvsoqKUbw,668
|
22
|
-
s2python/common/power_value.py,sha256=yVo0OotIk1_SccOLMfkDAYp4V5xCoPUgHDEJBGg8GCs,345
|
23
|
-
s2python/common/reception_status.py,sha256=hOgLDy7KN0aWPiKfN9u-AUUeXnrpW2UDVZRAcUkefZY,507
|
24
|
-
s2python/common/resource_manager_details.py,sha256=CCvnS21vywcaZAAQzPIzU42CkydnBbkAVjgoKbtDeSE,1026
|
25
|
-
s2python/common/revoke_object.py,sha256=6PoKLZjPSz43O_W58zSUFNYamRJD-X1YF1gi0WLtt9s,567
|
26
|
-
s2python/common/role.py,sha256=N8nYdMquBIwNx5RS8UrMGHDHdXy57P_iAcDpdDYm62A,309
|
27
|
-
s2python/common/select_control_type.py,sha256=xCd18THcBthEJjLz9otHscb4pgxsUYghlcxzlEXvhPs,505
|
28
|
-
s2python/common/session_request.py,sha256=kFAqUkl9_yVSLvCT3E0BUQKJC-JPhZk3rW01GiT3tQ4,484
|
29
|
-
s2python/common/support.py,sha256=Kbrf_KGB45Wfr8j2pqDe1lLde6CIr3nl_LYkWnilmV0,1015
|
30
|
-
s2python/common/timer.py,sha256=_zokHPmPHKHx-H9vBau18pcN1HrYBIhWSKkzFzd999w,538
|
31
|
-
s2python/common/transition.py,sha256=nUdJaiWgf6tAgfAMqJmdsKmob063NcZJZMt0ysjjkWE,1046
|
32
|
-
s2python/frbc/__init__.py,sha256=ROV3qZoldPkdgVFfMQr5Mf3GDfBzXaMfhNNCuXY6T0s,1104
|
33
|
-
s2python/frbc/frbc_actuator_description.py,sha256=Ig2jmf2_qsDBfuW90rAVD-e0hkmkIqKdTcQZI3XY3S8,6148
|
34
|
-
s2python/frbc/frbc_actuator_status.py,sha256=4XGk-ueXq6o_kOLTXGK_bfEFdJy8p8jjHDLyohzykSQ,955
|
35
|
-
s2python/frbc/frbc_fill_level_target_profile.py,sha256=od1w2nR35sckV4Bvp_EpfZaMJxKRrDu66X8mliSRuec,862
|
36
|
-
s2python/frbc/frbc_fill_level_target_profile_element.py,sha256=KG0th6Zp3T7QnE0eZXpaC3X1zVWkUAi-tSmik0ZXGKk,1262
|
37
|
-
s2python/frbc/frbc_instruction.py,sha256=EyNnt2P9w0955eYoeWPqaHSco0NzbvYAGD0F9vYS0SM,791
|
38
|
-
s2python/frbc/frbc_leakage_behaviour.py,sha256=Esjmsy9jyi2naokTVu6y9oPBVjjlTyEguPF2snQMj7w,776
|
39
|
-
s2python/frbc/frbc_leakage_behaviour_element.py,sha256=rpfp87zl7xgcx4bXLj362VkdrKOxhs9m9fZDe42z4tg,1085
|
40
|
-
s2python/frbc/frbc_operation_mode.py,sha256=B30t7ITSCAzBdNZv4hns7VacVsRN0DyydgTvoF9JYdY,1881
|
41
|
-
s2python/frbc/frbc_operation_mode_element.py,sha256=uin-wgbySldMBbjk14l_ZOH7lpsyXeo1jjCYolB1RNI,1055
|
42
|
-
s2python/frbc/frbc_storage_description.py,sha256=K1bjmG5_2SP14PMIkkldTyvTWQzDTC9KYFuiksW0AS8,604
|
43
|
-
s2python/frbc/frbc_storage_status.py,sha256=TKQeX1vsnYrblgS8UeDu0Siy7p0zedYck85vFVkdiT8,505
|
44
|
-
s2python/frbc/frbc_system_description.py,sha256=g94kqGRNcPXcQQzpb9Wz7dDncbuJsmA4KHa0r7b3r4w,962
|
45
|
-
s2python/frbc/frbc_timer_status.py,sha256=Lh95iJ62FQGeqSTH5oDJnxzWBCzaNZAjunQyGEPOlcM,693
|
46
|
-
s2python/frbc/frbc_usage_forecast.py,sha256=e5tvKpVAsKbjQxN-g8T3RDNivwibJVtkjqmlOHpd2ek,729
|
47
|
-
s2python/frbc/frbc_usage_forecast_element.py,sha256=Njox8S11L3b_b8F-eengIRCSMvHQwp6LgVCE3_u3DPo,583
|
48
|
-
s2python/frbc/rm.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
|
-
s2python/generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
50
|
-
s2python/generated/gen_s2.py,sha256=eg9J0pcWxCy0oXO8eq9AtoB-GONHZLNd8JANpMhKQCQ,63573
|
51
|
-
s2_python-0.3.0.dist-info/METADATA,sha256=WBE9X5_s41LXGhd1aMkc9xkzRr8j7qcSGoMAeTUWdjo,3614
|
52
|
-
s2_python-0.3.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
53
|
-
s2_python-0.3.0.dist-info/entry_points.txt,sha256=feX-xmgJZgSe5-jxMgFKPKCJz4Ys3eQcGrsXsirNZyM,61
|
54
|
-
s2_python-0.3.0.dist-info/top_level.txt,sha256=OLFq0oDhr77Mp-EYLEcWk5P3jvooOt4IHkTI5KYJMc8,9
|
55
|
-
s2_python-0.3.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|