1531 |
1531 |
1532 idx = -2 |
1532 idx = -2 |
1533 # If found, get the details of attribute |
1533 # If found, get the details of attribute |
1534 if variable is not None: |
1534 if variable is not None: |
1535 typeName, typeStr, resolver = DebugVariables.getType(variable) |
1535 typeName, typeStr, resolver = DebugVariables.getType(variable) |
1536 if typeStr.startswith(ConfigQtNames): |
1536 if resolver: |
|
1537 varGen = resolver.getDictionary(variable) |
|
1538 self.resolverCache[scope][str(var)] = varGen |
|
1539 |
|
1540 idx, varDict = next(varGen) |
|
1541 varlist = self.__formatVariablesList( |
|
1542 varDict, scope, filterList) |
|
1543 else: |
1537 # Gently handle exception which could occure as special |
1544 # Gently handle exception which could occure as special |
1538 # cases, e.g. already deleted C++ objects, str conversion.. |
1545 # cases, e.g. already deleted C++ objects, str conversion.. |
1539 try: |
1546 try: |
1540 varlist = self.__formatQtVariable(variable, typeName) |
1547 varlist = self.__formatQtVariable(variable, typeName) |
1541 except Exception: |
1548 except Exception: |
1542 varlist = [] |
1549 varlist = [] |
1543 idx = -1 |
1550 idx = -1 |
1544 elif resolver: |
|
1545 varGen = resolver.getDictionary(variable) |
|
1546 self.resolverCache[scope][str(var)] = varGen |
|
1547 |
|
1548 idx, varDict = next(varGen) |
|
1549 varlist = self.__formatVariablesList( |
|
1550 varDict, scope, filterList) |
|
1551 |
1551 |
1552 var.insert(0, idx) |
1552 var.insert(0, idx) |
1553 |
1553 |
1554 self.sendJsonCommand("ResponseVariable", { |
1554 self.sendJsonCommand("ResponseVariable", { |
1555 "scope": scope, |
1555 "scope": scope, |
1779 |
1779 |
1780 # special handling for '__builtins__' (it's way too big) |
1780 # special handling for '__builtins__' (it's way too big) |
1781 if key == '__builtins__': |
1781 if key == '__builtins__': |
1782 rvalue = '<module __builtin__ (built-in)>' |
1782 rvalue = '<module __builtin__ (built-in)>' |
1783 valtype = 'module' |
1783 valtype = 'module' |
|
1784 if ConfigVarTypeStrings.index(valtype) in filterList: |
|
1785 continue |
1784 else: |
1786 else: |
|
1787 isQt = False |
|
1788 # valtypestr, e.g. class 'PyQt5.QtCore.QPoint' |
1785 valtypestr = str(type(value))[1:-1] |
1789 valtypestr = str(type(value))[1:-1] |
1786 _, valtype = valtypestr.split(' ', 1) |
1790 _, valtype = valtypestr.split(' ', 1) |
|
1791 # valtype, e.g. PyQt5.QtCore.QPoint |
1787 valtype = valtype[1:-1] |
1792 valtype = valtype[1:-1] |
1788 # Strip 'instance' to be equal with Python 3 |
1793 # Strip 'instance' to be equal with Python 3 |
1789 if valtype == "instancemethod": |
1794 if valtype == "instancemethod": |
1790 valtype = "method" |
1795 valtype = "method" |
|
1796 elif valtype == "type" or valtype == "classobj": |
|
1797 valtype = "class" |
1791 |
1798 |
|
1799 # valtypename, e.g. QPoint |
1792 valtypename = type(value).__name__ |
1800 valtypename = type(value).__name__ |
1793 try: |
1801 try: |
1794 if ConfigVarTypeStrings.index(valtype) in filterList: |
1802 if ConfigVarTypeStrings.index(valtype) in filterList: |
1795 continue |
1803 continue |
1796 except ValueError: |
1804 except ValueError: |
1797 if valtype == "classobj": |
1805 if valtype == "sip.enumtype": |
1798 if ConfigVarTypeStrings.index( |
1806 if ConfigVarTypeStrings.index('class') in filterList: |
1799 'instance') in filterList: |
|
1800 continue |
1807 continue |
1801 elif valtype == "sip.methoddescriptor": |
1808 elif (valtype == "sip.methoddescriptor" or |
|
1809 valtype == "method_descriptor"): |
1802 if ConfigVarTypeStrings.index('method') in filterList: |
1810 if ConfigVarTypeStrings.index('method') in filterList: |
1803 continue |
1811 continue |
1804 elif valtype == "sip.enumtype": |
1812 elif valtype in ("numpy.ndarray", "array.array"): |
1805 if ConfigVarTypeStrings.index('class') in filterList: |
|
1806 continue |
|
1807 elif not valtype.startswith(("PySide.", "PySide2.")) and \ |
|
1808 (ConfigVarTypeStrings.index('other') in |
|
1809 filterList): |
|
1810 continue |
|
1811 elif valtype in ["numpy.ndarray", "array.array"]: |
|
1812 if ConfigVarTypeStrings.index('list') in filterList: |
1813 if ConfigVarTypeStrings.index('list') in filterList: |
1813 continue |
1814 continue |
1814 elif valtypename == "MultiValueDict": |
1815 elif valtypename == "MultiValueDict": |
1815 if ConfigVarTypeStrings.index('dict') in filterList: |
1816 if ConfigVarTypeStrings.index('dict') in filterList: |
1816 continue |
1817 continue |
|
1818 elif ConfigVarTypeStrings.index('instance') in filterList: |
|
1819 continue |
1817 |
1820 |
|
1821 isQt = valtype.startswith(ConfigQtNames) |
1818 if (not valtypestr.startswith('type ') and |
1822 if (not valtypestr.startswith('type ') and |
1819 valtypename not in |
1823 valtypename not in ( |
1820 ["ndarray", "MultiValueDict", "array"] and |
1824 "ndarray", "MultiValueDict", "array", |
1821 not valtype.startswith(('PyQt5.', 'PyQt4.'))): |
1825 "defaultdict" |
|
1826 ) and not isQt): # __IGNORE_WARNING_E123__ |
1822 valtype = valtypestr |
1827 valtype = valtypestr |
1823 |
1828 |
1824 try: |
1829 try: |
1825 if valtype in ['list', 'tuple', 'dict', 'set', 'frozenset' |
1830 if valtype in ['list', 'tuple', 'dict', 'set', 'frozenset' |
1826 ]: |
1831 ]: |
1836 elif valtypename == "MultiValueDict": |
1841 elif valtypename == "MultiValueDict": |
1837 rvalue = "{0:d}".format(len(value.keys())) |
1842 rvalue = "{0:d}".format(len(value.keys())) |
1838 valtype = "django.MultiValueDict" # shortened type |
1843 valtype = "django.MultiValueDict" # shortened type |
1839 else: |
1844 else: |
1840 rvalue = repr(value) |
1845 rvalue = repr(value) |
1841 if valtype.startswith('class') and \ |
1846 if valtype.startswith('class') and rvalue[0] in '{([': |
1842 rvalue[0] in ['{', '(', '[']: |
|
1843 rvalue = "" |
1847 rvalue = "" |
1844 elif (rvalue.startswith("<class '") and |
1848 elif (isQt and rvalue.startswith("<class '")): |
1845 valtype.startswith(ConfigQtNames)): |
|
1846 rvalue = rvalue[8:-2] |
1849 rvalue = rvalue[8:-2] |
1847 except Exception: |
1850 except Exception: |
1848 rvalue = '' |
1851 rvalue = '' |
1849 |
1852 |
1850 varlist.append((key, valtype, rvalue)) |
1853 varlist.append((key, valtype, rvalue)) |