DebugClients/Python2/DebugClientBase.py

changeset 5175
9db0b0f15d12
parent 5171
f1e9eebd5469
child 5190
65a2234c6789
equal deleted inserted replaced
5173:632257ad7337 5175:9db0b0f15d12
1440 attribute = self.__extractIndicators(attribute)[0] 1440 attribute = self.__extractIndicators(attribute)[0]
1441 typeObject, typeName, typeStr, resolver = \ 1441 typeObject, typeName, typeStr, resolver = \
1442 DebugVariables.getType(variable) 1442 DebugVariables.getType(variable)
1443 if resolver: 1443 if resolver:
1444 variable = resolver.resolve(variable, attribute) 1444 variable = resolver.resolve(variable, attribute)
1445 if variable is None:
1446 break
1445 else: 1447 else:
1446 break 1448 break
1447 typeObject, typeName, typeStr, resolver = \ 1449 if variable is not None:
1448 DebugVariables.getType(variable) 1450 typeObject, typeName, typeStr, resolver = \
1449 if typeStr.startswith(("PyQt5.", "PyQt4.")): 1451 DebugVariables.getType(variable)
1450 vlist = self.__formatQtVariable(variable, typeName) 1452 if typeStr.startswith(("PyQt5.", "PyQt4.")):
1451 varlist.extend(vlist) 1453 vlist = self.__formatQtVariable(variable, typeName)
1452 elif resolver: 1454 varlist.extend(vlist)
1453 dict = resolver.getDictionary(variable) 1455 elif resolver:
1454 vlist = self.__formatVariablesList( 1456 dict = resolver.getDictionary(variable)
1455 list(dict.keys()), dict, scope, filter) 1457 vlist = self.__formatVariablesList(
1456 varlist.extend(vlist) 1458 list(dict.keys()), dict, scope, filter)
1459 varlist.extend(vlist)
1457 1460
1458 self.sendJsonCommand("ResponseVariable", { 1461 self.sendJsonCommand("ResponseVariable", {
1459 "scope": scope, 1462 "scope": scope,
1460 "variable": var, 1463 "variable": var,
1461 "variables": varlist, 1464 "variables": varlist,
1662 rvalue = '<module __builtin__ (built-in)>' 1665 rvalue = '<module __builtin__ (built-in)>'
1663 valtype = 'module' 1666 valtype = 'module'
1664 else: 1667 else:
1665 value = dict[key] 1668 value = dict[key]
1666 valtypestr = ("%s" % type(value))[1:-1] 1669 valtypestr = ("%s" % type(value))[1:-1]
1670 valtypename = type(value).__name__
1667 1671
1668 if valtypestr.split(' ', 1)[0] == 'class': 1672 if valtypestr.startswith('class '):
1669 # handle new class type of python 2.2+ 1673 # handle new class type of python 2.2+
1670 if ConfigVarTypeStrings.index('instance') in filter: 1674 if ConfigVarTypeStrings.index('instance') in filter:
1671 continue 1675 continue
1672 valtype = valtypestr 1676 valtype = valtypestr
1673 else: 1677 else:
1674 valtype = valtypestr[6:-1] 1678 valtype = valtypestr[6:-1]
1675 try: 1679 if valtype not in ConfigVarTypeStrings:
1676 if ConfigVarTypeStrings.index(valtype) in filter: 1680 if valtype == "numpy.ndarray":
1677 continue 1681 if ConfigVarTypeStrings.index('list') in filter:
1678 except ValueError: 1682 continue
1679 if valtype == "classobj": 1683 elif valtypename == "MultiValueDict":
1680 if ConfigVarTypeStrings.index( 1684 if ConfigVarTypeStrings.index('dict') in filter:
1681 'instance') in filter:
1682 continue 1685 continue
1683 elif valtype == "sip.methoddescriptor": 1686 elif valtype == "sip.methoddescriptor":
1684 if ConfigVarTypeStrings.index( 1687 if ConfigVarTypeStrings.index(
1685 'method') in filter: 1688 'method') in filter:
1686 continue 1689 continue
1687 elif valtype == "sip.enumtype": 1690 elif valtype == "sip.enumtype":
1688 if ConfigVarTypeStrings.index('class') in filter: 1691 if ConfigVarTypeStrings.index('class') in filter:
1689 continue 1692 continue
1690 elif not valtype.startswith("PySide") and \ 1693 elif ConfigVarTypeStrings.index('instance') in filter:
1691 ConfigVarTypeStrings.index('other') in filter:
1692 continue 1694 continue
1695
1696 if valtypename not in ["MultiValueDict"] and \
1697 not valtype.startswith("numpy"):
1698 valtype = valtypestr
1699 else:
1700 try:
1701 if ConfigVarTypeStrings.index(valtype) in filter:
1702 continue
1703 except ValueError:
1704 if valtype == "classobj":
1705 if ConfigVarTypeStrings.index(
1706 'instance') in filter:
1707 continue
1708 elif valtype == "sip.methoddescriptor":
1709 if ConfigVarTypeStrings.index(
1710 'method') in filter:
1711 continue
1712 elif valtype == "sip.enumtype":
1713 if ConfigVarTypeStrings.index('class') in \
1714 filter:
1715 continue
1716 elif not valtype.startswith("PySide") and \
1717 ConfigVarTypeStrings.index('other') in \
1718 filter:
1719 continue
1693 1720
1694 try: 1721 try:
1695 if valtype not in ['list', 'tuple', 'dict', 'set', 1722 if valtype in ['list', 'tuple', 'dict', 'set',
1696 'frozenset']: 1723 'frozenset']:
1724 if valtype == 'dict':
1725 rvalue = "%d" % len(value.keys())
1726 else:
1727 rvalue = "%d" % len(value)
1728 elif valtype == "numpy.ndarray":
1729 rvalue = "%d" % value.size
1730 elif valtypename == "MultiValueDict":
1731 rvalue = "%d" % len(value.keys())
1732 valtype = "django.MultiValueDict" # shortened type
1733 else:
1697 rvalue = repr(value) 1734 rvalue = repr(value)
1698 if valtype.startswith('class') and \ 1735 if valtype.startswith('class') and \
1699 rvalue[0] in ['{', '(', '[']: 1736 rvalue[0] in ['{', '(', '[']:
1700 rvalue = "" 1737 rvalue = ""
1701 else:
1702 if valtype == 'dict':
1703 rvalue = "%d" % len(value.keys())
1704 else:
1705 rvalue = "%d" % len(value)
1706 except Exception: 1738 except Exception:
1707 rvalue = '' 1739 rvalue = ''
1708 1740
1709 if formatSequences: 1741 if formatSequences:
1710 if unicode(key) == key: 1742 if unicode(key) == key:

eric ide

mercurial