--- a/eric6/DebugClients/Python/DebugVariables.py Sun Apr 28 11:14:43 2019 +0200 +++ b/eric6/DebugClients/Python/DebugVariables.py Thu May 02 22:58:33 2019 +0200 @@ -247,6 +247,40 @@ ############################################################ +## Resolver for dict_items, dict_keys and dict_values +############################################################ + + +class DictViewResolver(ListResolver): + """ + Class used to resolve from dict views. + """ + def resolve(self, var, attribute): + """ + Public method to get an attribute from a variable. + + @param var variable to extract an attribute or value from + @type tuple or list + @param attribute id of the value to extract + @type str + @return value of the attribute + @rtype any + """ + return super(DictViewResolver, self).resolve(list(var), attribute) + + def getDictionary(self, var): + """ + Public method to get the attributes of a variable as a dictionary. + + @param var variable to be converted + @type any + @return dictionary containing the variable attributes + @rtype dict + """ + return super(DictViewResolver, self).getDictionary(list(var)) + + +############################################################ ## Resolver for Sets and Frozensets ############################################################ @@ -580,6 +614,7 @@ defaultResolver = DefaultResolver() dictResolver = DictResolver() listResolver = ListResolver() +dictViewResolver = DictViewResolver() setResolver = SetResolver() ndarrayResolver = NdArrayResolver() multiValueDictResolver = MultiValueDictResolver() @@ -615,12 +650,12 @@ try: _TypeMap.append((long, None)) # __IGNORE_WARNING__ except Exception: - pass # not available on all python versions + pass # not available on all Python versions try: _TypeMap.append((unicode, None)) # __IGNORE_WARNING__ except Exception: - pass # not available on all python versions + pass # not available on all Python versions try: import array @@ -640,6 +675,14 @@ _TypeMap.insert(0, (MultiValueDict, multiValueDictResolver)) except ImportError: pass # django may not be installed + + try: + from collections.abc import ItemsView, KeysView, ValuesView + _TypeMap.append((ItemsView, dictViewResolver)) + _TypeMap.append((KeysView, dictViewResolver)) + _TypeMap.append((ValuesView, dictViewResolver)) + except ImportError: + pass # not available on all Python versions def getType(obj):