From 508f992730ce74c24348040efb96b44863fdd53e Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Wed, 17 Jul 2019 23:25:22 +0100 Subject: [PATCH] Add __eq__ to protobuf containers (#3126) See https://github.com/protocolbuffers/protobuf/blob/master/python/google/protobuf/internal/containers.py. Without these `mypy --strict-equality` causes false positives with protobufs. --- third_party/2and3/google/protobuf/internal/containers.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/third_party/2and3/google/protobuf/internal/containers.pyi b/third_party/2and3/google/protobuf/internal/containers.pyi index 33e603c93..1a2defc3c 100644 --- a/third_party/2and3/google/protobuf/internal/containers.pyi +++ b/third_party/2and3/google/protobuf/internal/containers.pyi @@ -35,6 +35,7 @@ class RepeatedScalarFieldContainer(BaseContainer[_T]): def __setslice__(self, start: int, stop: int, values: Iterable[_T]) -> None: ... def __delitem__(self, key: Union[int, slice]) -> None: ... def __delslice__(self, start: int, stop: int) -> None: ... + def __eq__(self, other: object) -> bool: ... class RepeatedCompositeFieldContainer(BaseContainer[_T]): def __init__(self, message_listener: MessageListener, type_checker: Any) -> None: ... @@ -46,6 +47,7 @@ class RepeatedCompositeFieldContainer(BaseContainer[_T]): def __getslice__(self, start: int, stop: int) -> List[_T]: ... def __delitem__(self, key: Union[int, slice]) -> None: ... def __delslice__(self, start: int, stop: int) -> None: ... + def __eq__(self, other: object) -> bool: ... # Classes not yet typed class Mapping(Any): ...