Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MutableMap should implement container.abc.MutableMapping
Summary: type-checks for generated code fail with the errors below. ``` [2024-11-16T21:45:14.168-08:00] Found type errors! [2024-11-16T21:45:14.168-08:00] buck-out/v2/gen/fbcode/3cc3cae8ebb1ba74/thrift/test/thrift-python/__struct_test_thrift_with_abstract-python-struct_test.thrift__/out/gen-python/thrift/test/thrift_python/struct_test/thrift_mutable_types.pyi:532:4 Inconsistent override [15]: `thrift.test.thrift_python.struct_test.thrift_mutable_types.TestStructContainerAssignment.__iter__` overrides method defined in `_fbthrift_python_abstract_types.TestStructContainerAssignment` inconsistently. Returned type `_typing.Iterator[_typing.Tuple[str, _typing.Union[_fbthrift_python_mutable_containers.MutableList[_fbthrift_python_mutable_containers.MutableList[int]], _fbthrift_python_mutable_containers.MutableList[TestStructAsListElement], _fbthrift_python_mutable_containers.MutableList[int], _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableList[int]], _fbthrift_python_mutable_containers.MutableSet[str]]]]` is not a subtype of the overridden return `_typing.Iterator[_typing.Tuple[str, _typing.Union[_typing.AbstractSet[str], _typing.Mapping[int, _typing.Sequence[int]], _typing.Sequence[_typing.Sequence[int]], _typing.Sequence[_fbthrift_python_abstract_types.TestStructAsListElement], _typing.Sequence[int]]]]`. [2024-11-16T21:45:14.168-08:00] buck-out/v2/gen/fbcode/3cc3cae8ebb1ba74/thrift/test/thrift-python/__struct_test_thrift_with_abstract-python-struct_test.thrift__/out/gen-python/thrift/test/thrift_python/struct_test/thrift_mutable_types.pyi:1116:4 Inconsistent override [15]: `thrift.test.thrift_python.struct_test.thrift_mutable_types.TestStructCopy.__iter__` overrides method defined in `_fbthrift_python_abstract_types.TestStructCopy` inconsistently. Returned type `_typing.Iterator[_typing.Tuple[str, _typing.Union[_fbthrift_python_mutable_containers.MutableList[int], _fbthrift_python_mutable_containers.MutableMap[str, int], _fbthrift_python_mutable_containers.MutableSet[str], TestStructCopy, _fbthrift_iobuf.IOBuf, int, str]]]` is not a subtype of the overridden return `_typing.Iterator[_typing.Tuple[str, _typing.Union[_typing.AbstractSet[str], _typing.Mapping[str, int], _typing.Sequence[int], _fbthrift_iobuf.IOBuf, _fbthrift_python_abstract_types.TestStructCopy, int, str]]]`. [2024-11-16T21:45:14.168-08:00] buck-out/v2/gen/fbcode/3cc3cae8ebb1ba74/thrift/test/thrift-python/__struct_test_thrift_with_abstract-python-struct_test.thrift__/out/gen-python/thrift/test/thrift_python/struct_test/thrift_mutable_types.pyi:1202:4 Inconsistent override [15]: `thrift.test.thrift_python.struct_test.thrift_mutable_types.TestExceptionCopy.__iter__` overrides method defined in `_fbthrift_python_abstract_types.TestExceptionCopy` inconsistently. Returned type `_typing.Iterator[_typing.Tuple[str, _typing.Union[_fbthrift_python_mutable_containers.MutableList[int], _fbthrift_python_mutable_containers.MutableMap[str, int], _fbthrift_python_mutable_containers.MutableSet[str], TestExceptionCopy, int, str]]]` is not a subtype of the overridden return `_typing.Iterator[_typing.Tuple[str, _typing.Union[_typing.AbstractSet[str], _typing.Mapping[str, int], _typing.Sequence[int], _fbthrift_python_abstract_types.TestExceptionCopy, int, str]]]`. ``` Reviewed By: yoney Differential Revision: D66067300 fbshipit-source-id: 876b1d2311cd88499eb0106475493318478c3164
- Loading branch information