summary refs log tree commit diff
path: root/stubs/sortedcontainers
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-05-06 13:35:20 +0100
committerGitHub <noreply@github.com>2022-05-06 12:35:20 +0000
commit2607b3e1816341b3b8534077bd5d3a4daf3a3d15 (patch)
tree65a060f414530b98f649bed759a50cfc165bbd22 /stubs/sortedcontainers
parentAdd the `notify_appservices_from_worker` configuration option (superseding `n... (diff)
downloadsynapse-2607b3e1816341b3b8534077bd5d3a4daf3a3d15.tar.xz
Update mypy to 0.950 and fix complaints (#12650)
Diffstat (limited to 'stubs/sortedcontainers')
-rw-r--r--stubs/sortedcontainers/sorteddict.pyi19
1 files changed, 13 insertions, 6 deletions
diff --git a/stubs/sortedcontainers/sorteddict.pyi b/stubs/sortedcontainers/sorteddict.pyi
index 3a4f9c3076..7c399ab38d 100644
--- a/stubs/sortedcontainers/sorteddict.pyi
+++ b/stubs/sortedcontainers/sorteddict.pyi
@@ -85,12 +85,19 @@ class SortedDict(Dict[_KT, _VT]):
     def popitem(self, index: int = ...) -> Tuple[_KT, _VT]: ...
     def peekitem(self, index: int = ...) -> Tuple[_KT, _VT]: ...
     def setdefault(self, key: _KT, default: Optional[_VT] = ...) -> _VT: ...
-    @overload
-    def update(self, __map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
-    @overload
-    def update(self, __iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
-    @overload
-    def update(self, **kwargs: _VT) -> None: ...
+    # Mypy now reports the first overload as an error, because typeshed widened the type
+    # of `__map` to its internal `_typeshed.SupportsKeysAndGetItem` type in
+    #   https://github.com/python/typeshed/pull/6653
+    # Since sorteddicts don't change the signature of `update` from that of `dict`, we
+    # let the stubs for `update` inherit from the stubs for `dict`. (I suspect we could
+    # do the same for many othe methods.) We leave the stubs commented to better track
+    # how this file has evolved from the original stubs.
+    # @overload
+    # def update(self, __map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
+    # @overload
+    # def update(self, __iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
+    # @overload
+    # def update(self, **kwargs: _VT) -> None: ...
     def __reduce__(
         self,
     ) -> Tuple[