-
Couldn't load subscription status.
- Fork 0
Add support for builtin types for get_value and set_value #26
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 9 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
6643e6b
First draft of builtin type marshalling
jfriedri-ni 8d97456
Use a brute-force explicit helper for type-hinting the convertible na…
jfriedri-ni 02c1cdd
Use the StreamlitPanel as the main entrypoint
jfriedri-ni ec9e760
Add tests for unopened-set, unopened-get, and scalar round trips
jfriedri-ni 4407668
Remove unused import
jfriedri-ni 86c22aa
Add test showing an unset value raises when clients attempt to get it
jfriedri-ni b3e504a
Merge remote-tracking branch 'origin/main' into users/jfriedri-ni/add…
jfriedri-ni b63ea73
Add type hints that are compatible with Python 3.9
jfriedri-ni a60c17f
Do not add type hints when the analyzer can infer it
jfriedri-ni b3f1314
Parameterize the scalar value test
jfriedri-ni 4d73ca6
Add roundtrip tests for IntFlag, IntEnum, StrEnum
jfriedri-ni 518dd2f
Add tests for mixin-enums and bare-enums
jfriedri-ni 345e89a
Shorten typename imports
jfriedri-ni 3a02372
Rename fixture 'grpc_channel_for_fake_panel_service' to 'fake_panel_c…
jfriedri-ni ca9b8a3
Use grcpio's logging thread pool
jfriedri-ni 91ee96b
Remove static storage for the fake servicer
jfriedri-ni 63296e1
Remove class members from the fake service
jfriedri-ni 5969e92
Simplify class and storage for ConvertibleType
jfriedri-ni 3fb2b9b
Use pyproject.toml to suppress type checker
jfriedri-ni 62f808c
Clarify docstring
jfriedri-ni 9a5ae3c
Do not use 'as' for imports because it confuses tooling
jfriedri-ni eabcb0f
Make types compatible with Python 3.9 and 3.10
jfriedri-ni 6457e41
Remove redundant namespacing and front-load building the type convers…
jfriedri-ni fde87f6
Use the Python types rather than typenames for to_any
jfriedri-ni 905e315
Shortest path to custom initializers
jfriedri-ni b73b7b0
Use a Protocol to allow converters to have custom conversions
jfriedri-ni e07a2c0
Apply formatter
jfriedri-ni 3285505
Make protobuf_message return a Message so the default implementation …
jfriedri-ni e9fe18c
Simple naive type-fix
jfriedri-ni dc0c552
Refactor converters as an ABC family
jfriedri-ni 4f3a208
Converting builtins with a shared function, still mypy errors
jfriedri-ni 9115100
Do not share code between the builtin converters because type hinting…
jfriedri-ni 6d8318b
Address the linters
jfriedri-ni 3313691
Follow naming convention for covariant typevars
jfriedri-ni c1324ae
Rely on set_value throwing for test___unopened_panel___set_value___se…
jfriedri-ni da0a6d7
Merge remote-tracking branch 'origin/main' into users/jfriedri-ni/add…
jfriedri-ni d5d4c51
converters: Refactor message->Any conversion
bkeryan ae54c82
converters: Refactor to_python any handling
bkeryan 6ff26ea
Clarify some docstrings
jfriedri-ni 072a3ac
Use object in the to_any() and from_any() signatures
jfriedri-ni 83e6363
converters: Use type variables more consistently
bkeryan 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
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 |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| """Types that support conversion to and from protobuf.""" | ||
|
|
||
| import enum | ||
|
|
||
|
|
||
| class MyIntFlags(enum.IntFlag): | ||
| """Example of an IntFlag enum.""" | ||
|
|
||
| VALUE1 = 1 | ||
| VALUE2 = 2 | ||
| VALUE4 = 4 | ||
|
|
||
|
|
||
| class MyIntEnum(enum.IntEnum): | ||
| """Example of an IntEnum enum.""" | ||
|
|
||
| VALUE10 = 10 | ||
| VALUE20 = 20 | ||
| VALUE30 = 30 | ||
|
|
||
|
|
||
| class MixinIntEnum(int, enum.Enum): | ||
| """Example of an IntEnum using a mixin.""" | ||
|
|
||
| VALUE11 = 11 | ||
| VALUE22 = 22 | ||
| VALUE33 = 33 | ||
|
|
||
|
|
||
| class MyStrEnum(enum.StrEnum): | ||
| """Example of a StrEnum enum.""" | ||
|
|
||
| VALUE1 = "value1" | ||
| VALUE2 = "value2" | ||
| VALUE3 = "value3" | ||
|
|
||
|
|
||
| class MixinStrEnum(str, enum.Enum): | ||
| """Example of a StrEnum using a mixin.""" | ||
|
|
||
| VALUE11 = "value11" | ||
| VALUE22 = "value22" | ||
| VALUE33 = "value33" | ||
|
|
||
|
|
||
| class MyEnum(enum.Enum): | ||
| """Example of a simple enum.""" | ||
|
|
||
| VALUE100 = 100 | ||
| VALUE200 = 200 | ||
| VALUE300 = 300 | ||
|
|
||
|
|
||
| class MyFlags(enum.Flag): | ||
| """Example of a simple flag.""" | ||
|
|
||
| VALUE8 = 8 | ||
| VALUE16 = 16 | ||
| VALUE32 = 32 |
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.
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.