--- a/eric6/DebugClients/Python/DebugClientBase.py Sun Dec 06 12:46:00 2020 +0100 +++ b/eric6/DebugClients/Python/DebugClientBase.py Sun Dec 06 17:43:11 2020 +0100 @@ -27,7 +27,7 @@ import DebugVariables from DebugBase import setRecursionLimit, printerr # __IGNORE_WARNING__ from AsyncFile import AsyncFile, AsyncPendingWrite -from DebugConfig import ConfigQtNames, ConfigVarTypeStrings +from DebugConfig import ConfigQtNames, SpecialAttributes from FlexCompleter import Completer from DebugUtilities import prepareJsonCommand from BreakpointWatch import Breakpoint, Watch @@ -1409,8 +1409,8 @@ @type int @param scope 1 to report global variables, 0 for local variables @type int - @param filterList the indices of variable types to be filtered - @type list of int + @param filterList list of variable types to be filtered + @type list of str """ if self.currentThread is None: return @@ -1458,7 +1458,7 @@ @type int @param scope 1 to report global variables, 0 for local variables @type int - @param filterList the indices of variable types to be filtered + @param filterList list of variable types to be filtered @type list of int """ if self.currentThread is None: @@ -1714,10 +1714,10 @@ Variables are only added to the list, if their name do not match any of the filter expressions. @type int - @param filterList the indices of variable types to be filtered. + @param filterList list of variable types to be filtered. Variables are only added to the list, if their type is not contained in the filter list. - @type list of int + @type list of str @return A tuple consisting of a list of formatted variables. Each variable entry is a tuple of three elements, the variable name, its type and value. @@ -1748,15 +1748,25 @@ continue # filter hidden attributes (filter #0) - if 0 in filterList and str(key)[:2] == '__': + if '__' in filterList and str(key)[:2] == '__': continue # special handling for '__builtins__' (it's way too big) if key == '__builtins__': rvalue = '<module builtins (built-in)>' valtype = 'module' - if ConfigVarTypeStrings.index(valtype) in filterList: + if valtype in filterList: continue + elif ( + key in SpecialAttributes and + "special_attributes" in filterList + ): + continue + elif ( + key == "__hash__" and + "builtin_function_or_method" in filterList + ): + continue else: isQt = False # valtypestr, e.g. class 'PyQt5.QtCore.QPoint' @@ -1767,37 +1777,43 @@ # Strip 'instance' to be equal with Python 3 if valtype == "instancemethod": valtype = "method" - elif valtype == "type" or valtype == "classobj": + elif valtype in ("type", "classobj"): valtype = "class" + elif valtype == "method-wrapper": + valtype = "builtin_function_or_method" # valtypename, e.g. QPoint valtypename = type(value).__name__ - try: - if ConfigVarTypeStrings.index(valtype) in filterList: - continue - except ValueError: - if valtype in ("sip.enumtype", "sip.wrappertype"): - if ConfigVarTypeStrings.index('class') in filterList: - continue - elif (valtype == "sip.methoddescriptor" or - valtype == "method_descriptor"): - if ConfigVarTypeStrings.index('method') in filterList: - continue - elif valtype in ("numpy.ndarray", "array.array"): - if ConfigVarTypeStrings.index('list') in filterList: - continue - elif valtypename == "MultiValueDict": - if ConfigVarTypeStrings.index('dict') in filterList: - continue - elif ConfigVarTypeStrings.index('instance') in filterList: - continue - - isQt = valtype.startswith(ConfigQtNames) - if (not valtypestr.startswith('type ') and - valtypename not in ("ndarray", "MultiValueDict", - "array", "defaultdict") and - not isQt): - valtype = valtypestr + if valtype in filterList: + continue + elif ( + valtype in ("sip.enumtype", "sip.wrappertype") and + 'class' in filterList + ): + continue + elif ( + valtype in ( + "sip.methoddescriptor", "method_descriptor") and + 'method' in filterList + ): + continue + elif ( + valtype in ("numpy.ndarray", "array.array") and + 'list' in filterList + ): + continue + elif valtypename == "MultiValueDict" and 'dict' in filterList: + continue + elif 'instance' in filterList: + continue + + isQt = valtype.startswith(ConfigQtNames) + # TODO: see if this is still needed +# if (not valtypestr.startswith('type ') and +# valtypename not in ("ndarray", "MultiValueDict", +# "array", "defaultdict") and +# not isQt): +# valtype = valtypestr try: if valtype in self.arrayTypes: