Uh oh!
There was an error while loading. Please reload this page.
protobuf: Annotate well_known_types.pyi - #9323
Conversation
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
AlexWaygood
commented
Dec 2, 2022
You may need to invent a fictional Type checkers aren't very good at understanding that classes with |
ikonst
commented
Dec 2, 2022
Thanks, I was just wondering why it "passes" in mypy... |
This comment has been minimized.
This comment has been minimized.
AlexWaygood
commented
Dec 2, 2022
You'll need to add an entry to https://github.com/python/typeshed/blob/main/stubs/protobuf/%40tests/stubtest_allowlist.txt to get stubtest to shut up about the fictional |
AlexWaygood
commented
Dec 2, 2022
No idea what's going on with pytype, that might need some investigation. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
AlexWaygood
commented
Dec 2, 2022
Ahh, I'm guessing this breaks pytype because you're importing from one of the files that we exclude from the pytype check: https://github.com/python/typeshed/blob/main/tests/pytype_exclude_list.txt I guess if need be, we could maybe just add more files to that excludelist. Hopefully that will fix it. |
This comment has been minimized.
This comment has been minimized.
protobuf: Annotate well_known_types.pyiUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
google.protobuf.struct_pb2.Structand.Listoffer high-level methods which we are partially blind to, making things likelist(list_value)fail.The methods return either JSON primitive types (numbers are always floats!),
StructorList, and accept that along with plain sequences and mappings of the above. python/typing#182 comes handy in that we can now rely on recursive type aliases.