Skip to content

Should treat collections.Mapping keys/values like dict.keys/values #66

@wosc

Description

@wosc

Basically something like

--- checker.py~	2019-04-23 14:47:56.000000000 +0200
+++ checker.py	2020-01-16 15:02:56.000000000 +0100
@@ -757,6 +757,18 @@
     _basic_types[type({}.keys())] = NoProxy
     _basic_types[type({}.items())] = NoProxy

+     class DummyMapping(collections.abc.Mapping):
+
+        def __getitem__(self, key):
+            raise KeyError(key)
+        def __iter__(self):
+            return iter(())
+        def __len__(self):
+            return 0
+    mydict = DummyMapping()
+    _basic_types[type(mydict.keys())] = NoProxy
+    _basic_types[type(mydict.values())] = NoProxy
+    _basic_types[type(mydict.items())] = NoProxy
+
 try:
     import pytz
 except ImportError:  # pragma: no cover

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions