Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/s2python/s2_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
FRBCTimerStatus,
FRBCUsageForecast,
)
from s2python.pebc import PEBCPowerConstraints, PEBCEnergyConstraint, PEBCInstruction
from s2python.ppbc import PPBCScheduleInstruction

from s2python.message import S2Message
Expand All @@ -48,6 +49,9 @@
"FRBC.TimerStatus": FRBCTimerStatus,
"FRBC.UsageForecast": FRBCUsageForecast,
"PPBC.ScheduleInstruction": PPBCScheduleInstruction,
"PEBC.PowerConstraints": PEBCPowerConstraints,
"PEBC.Instruction": PEBCInstruction,
"PEBC.EnergyConstraint": PEBCEnergyConstraint,
"Handshake": Handshake,
"HandshakeResponse": HandshakeResponse,
"InstructionStatusUpdate": InstructionStatusUpdate,
Expand Down Expand Up @@ -90,7 +94,9 @@ def parse_as_any_message(unparsed_message: Union[dict, str, bytes]) -> S2Message
return TYPE_TO_MESSAGE_CLASS[message_type].model_validate(message_json)

@staticmethod
def parse_as_message(unparsed_message: Union[dict, str, bytes], as_message: Type[M]) -> M:
def parse_as_message(
unparsed_message: Union[dict, str, bytes], as_message: Type[M]
) -> M:
"""Parse the message to a specific S2 python message.

:param unparsed_message: The message as a JSON-formatted string or as a JSON-parsed dictionary.
Expand Down