protobuf: Annotate well_known_types.pyi#9323
Conversation
This comment has been minimized.
This comment has been minimized.
|
You may need to invent a fictional Type checkers aren't very good at understanding that classes with |
|
Thanks, I was just wondering why it "passes" in mypy... |
This comment has been minimized.
This comment has been minimized.
|
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 |
|
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.
|
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.pyi
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
|
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.