-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add S2 Message Union type Signed-off-by: Victor Garcia Reolid <[email protected]> * chore: move to Literals as Pydantic 2 does * chore: run `datamodel-codegen --input specification/openapi.yml --input-file-type openapi --output src/s2python/generated/gen_s2.py` Signed-off-by: F.N. Claessen <[email protected]> * refactor: rename old S2Message to S2MessageComponent Signed-off-by: F.N. Claessen <[email protected]> * style: pylint Signed-off-by: F.N. Claessen <[email protected]> * refactor: prefer S2Message over S2MessageComponent Signed-off-by: F.N. Claessen <[email protected]> * Revert "refactor: prefer S2Message over S2MessageComponent" This reverts commit fd59de6. * refactor: prefer S2Message over S2MessageComponent in s2_parser.py Signed-off-by: F.N. Claessen <[email protected]> * fix: `src/s2python/s2_parser.py:49: error: Dict entry 8 has incompatible type "str": "type[PPBCScheduleInstruction]"; expected "str": "Union[type[FRBCActuatorStatus], type[FRBCFillLevelTargetProfile], type[FRBCInstruction], type[FRBCLeakageBehaviour], type[FRBCStorageStatus], <13 more items>]" [dict-item]` Signed-off-by: F.N. Claessen <[email protected]> * refactor: prefer S2Message over S2MessageComponent in s2_control_type.py Signed-off-by: F.N. Claessen <[email protected]> * refactor: prefer S2Message over S2MessageComponent in s2_connection.py Signed-off-by: F.N. Claessen <[email protected]> * fix: s2_parser.py has 1 place that still requires the S2MessageComponent Signed-off-by: F.N. Claessen <[email protected]> * dev: change subject_message_id to message_id (did mypy find a bug? Related to flexiblepower/s2-ws-json#21) Signed-off-by: F.N. Claessen <[email protected]> * Revert "dev: change subject_message_id to message_id (did mypy find a bug? Related to flexiblepower/s2-ws-json#21)" This reverts commit dc3d706. * fix: type ignore union-attr instead; underlying issue should be fixed under flexiblepower/s2-ws-json#21 instead Signed-off-by: F.N. Claessen <[email protected]> * fix: linting Signed-off-by: F.N. Claessen <[email protected]> --------- Signed-off-by: Victor Garcia Reolid <[email protected]> Signed-off-by: F.N. Claessen <[email protected]> Co-authored-by: F.N. Claessen <[email protected]>
- Loading branch information
1 parent
c35b7e4
commit cb08e31
Showing
49 changed files
with
161 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import inspect | ||
import s2python.frbc as frbc | ||
import s2python.common as common | ||
|
||
from pydantic import BaseModel | ||
|
||
all_members = inspect.getmembers(frbc) + inspect.getmembers(common) | ||
all_members.sort(key=lambda t: t[0]) | ||
|
||
for name, member in all_members: | ||
if inspect.isclass(member) and issubclass(member, BaseModel) and "message_type" in member.__fields__: | ||
print(f"{name},") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
from s2python.generated.gen_s2 import PowerForecastValue as GenPowerForecastValue | ||
from s2python.validate_values_mixin import ( | ||
catch_and_convert_exceptions, | ||
S2Message, | ||
S2MessageComponent, | ||
) | ||
|
||
|
||
@catch_and_convert_exceptions | ||
class PowerForecastValue(GenPowerForecastValue, S2Message["PowerForecastValue"]): | ||
class PowerForecastValue(GenPowerForecastValue, S2MessageComponent["PowerForecastValue"]): | ||
model_config = GenPowerForecastValue.model_config | ||
model_config["validate_assignment"] = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
from s2python.generated.gen_s2 import PowerValue as GenPowerValue | ||
from s2python.validate_values_mixin import ( | ||
catch_and_convert_exceptions, | ||
S2Message, | ||
S2MessageComponent, | ||
) | ||
|
||
|
||
@catch_and_convert_exceptions | ||
class PowerValue(GenPowerValue, S2Message["PowerValue"]): | ||
class PowerValue(GenPowerValue, S2MessageComponent["PowerValue"]): | ||
model_config = GenPowerValue.model_config | ||
model_config["validate_assignment"] = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
from s2python.generated.gen_s2 import Role as GenRole | ||
from s2python.validate_values_mixin import ( | ||
S2Message, | ||
S2MessageComponent, | ||
catch_and_convert_exceptions, | ||
) | ||
|
||
|
||
@catch_and_convert_exceptions | ||
class Role(GenRole, S2Message["Role"]): | ||
class Role(GenRole, S2MessageComponent["Role"]): | ||
model_config = GenRole.model_config | ||
model_config["validate_assignment"] = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.