-
Notifications
You must be signed in to change notification settings - Fork 6
add S2 Message Union type #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f5e401d
add S2 Message Union type
1cc8b26
Merge branch 'refs/heads/pydantic_v1' into generic-s2-message
Flix6x c2fede2
chore: move to Literals as Pydantic 2 does
Flix6x 2d13d5a
chore: run `datamodel-codegen --input specification/openapi.yml --inp…
Flix6x 1dc8bcf
Merge remote-tracking branch 'refs/remotes/origin/main' into generic-…
Flix6x 02966c2
refactor: rename old S2Message to S2MessageComponent
Flix6x 78ff1d3
style: pylint
Flix6x fd59de6
refactor: prefer S2Message over S2MessageComponent
Flix6x 0171f5a
Revert "refactor: prefer S2Message over S2MessageComponent"
Flix6x 87a4ca6
refactor: prefer S2Message over S2MessageComponent in s2_parser.py
Flix6x 112e78f
fix: `src/s2python/s2_parser.py:49: error: Dict entry 8 has incompati…
Flix6x 828309f
refactor: prefer S2Message over S2MessageComponent in s2_control_type.py
Flix6x 82dab11
refactor: prefer S2Message over S2MessageComponent in s2_connection.py
Flix6x 76a76ac
fix: s2_parser.py has 1 place that still requires the S2MessageComponent
Flix6x dc3d706
dev: change subject_message_id to message_id (did mypy find a bug? Re…
Flix6x f10e708
Revert "dev: change subject_message_id to message_id (did mypy find a…
Flix6x ad87e8b
fix: type ignore union-attr instead; underlying issue should be fixed…
Flix6x 3f31f16
fix: linting
Flix6x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.