DebugClients/Python3/DebugClientBase.py

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

eric ide

mercurial