-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
protobuf
: Annotate well_known_types.pyi
#9323
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
24 commits
Select commit
Hold shift + click to select a range
658e5b1
Annotate google.protobuf.struct_pb2
ikonst 96335b0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 31dcaa1
oops
ikonst 5b60ba0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] f48ab6d
add test
ikonst dc522b4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 4dc7813
oops
ikonst 89fa8de
make flake8 happy
ikonst 9f5b252
typing_extensions
ikonst f4a0efc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 467cd54
move test, add fake __iter__
ikonst 22bce74
from __future__ import annotations
ikonst f22fbe5
# pyright: reportUnnecessaryTypeIgnoreComment=true
ikonst a519226
oops
ikonst c54c518
stubtest_allowlist
ikonst 2c01278
lol I'm tired
ikonst 2bf6167
add well_known_types to pytype exclude list :(
ikonst 93c9578
fix out-of-date comment on `list(list_value)`
ikonst b7710a1
Change __contains__ to accept object
ikonst 83ffc90
return KeyView and list
ikonst c02609e
Add comment to def __iter__
ikonst 4cce6b9
KeyView -> KeysView
ikonst f2a1cfd
update can accept a SupportsItems
ikonst f4aff4c
import SupportsItems
ikonst 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# pyright: reportUnnecessaryTypeIgnoreComment=true | ||
from __future__ import annotations | ||
|
||
from google.protobuf.struct_pb2 import ListValue, Struct | ||
|
||
list_value = ListValue() | ||
|
||
lst = list(list_value) # Ensure type checkers recognise that the class is iterable (doesn't have an `__iter__` method at runtime) | ||
|
||
list_value[0] = 42.42 | ||
list_value[0] = "42" | ||
list_value[0] = None | ||
list_value[0] = True | ||
list_value[0] = [42.42, "42", None, True, [42.42, "42", None, True], {"42": 42}] | ||
list_value[0] = ListValue() | ||
list_value[0] = Struct() | ||
|
||
list_element = list_value[0] |
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
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.