DebugClients/Python3/DebugClientBase.py

changeset 5171
f1e9eebd5469
parent 5169
74e000797a93
child 5174
8c48f5e0cd92
child 5175
9db0b0f15d12
--- a/DebugClients/Python3/DebugClientBase.py	Wed Sep 14 20:08:16 2016 +0200
+++ b/DebugClients/Python3/DebugClientBase.py	Fri Sep 16 19:28:39 2016 +0200
@@ -138,6 +138,9 @@
     """
     clientCapabilities = DebugClientCapabilities.HasAll
     
+    # keep these in sync with VariablesViewer.VariableItem.Indicators
+    Indicators = ("()", "[]", "{:}", "{}")         # __IGNORE_WARNING__
+    
     def __init__(self):
         """
         Constructor
@@ -1433,8 +1436,7 @@
         if scope != -1:
             variable = dict
             for attribute in var:
-                if attribute[-2:] in ["[]", "()", "{}"]:  # __IGNORE_WARNING__
-                    attribute = attribute[:-2]
+                attribute = self.__extractIndicators(attribute)[0]
                 typeObject, typeName, typeStr, resolver = \
                     DebugVariables.getType(variable)
                 if resolver:
@@ -1458,6 +1460,22 @@
             "variables": varlist,
         })
         
+    def __extractIndicators(self, var):
+        """
+        Private method to extract the indicator string from a variable text.
+        
+        @param var variable text
+        @type str
+        @return tuple containing the variable text without indicators and the
+            indicator string
+        @rtype tuple of two str
+        """
+        for indicator in DebugClientBase.Indicators:
+            if var.endswith(indicator):
+                return var[:-len(indicator)], indicator
+        
+        return var, ""
+        
     def __formatQtVariable(self, value, qttype):
         """
         Private method to produce a formatted output of a simple Qt4/Qt5 type.
@@ -1640,7 +1658,9 @@
                 continue
             
             # filter hidden attributes (filter #0)
-            if 0 in filter and str(key)[:2] == '__':
+            if 0 in filter and str(key)[:2] == '__' and not (
+                key == "___len___" and
+                    DebugVariables.TooLargeAttribute in keylist):
                 continue
             
             # special handling for '__builtins__' (it's way too big)
@@ -1684,7 +1704,8 @@
                             continue
                 
                 try:
-                    if valtype not in ['list', 'tuple', 'dict']:
+                    if valtype not in ['list', 'tuple', 'dict', 'set',
+                                       'frozenset']:
                         rvalue = repr(value)
                         if valtype.startswith('class') and \
                            rvalue[0] in ['{', '(', '[']:

eric ide

mercurial