Sun, 06 Dec 2020 17:53:05 +0100
Merged with the default branch.
--- a/docs/changelog Sat Dec 05 18:25:31 2020 +0100 +++ b/docs/changelog Sun Dec 06 17:53:05 2020 +0100 @@ -1,5 +1,8 @@ Change Log ---------- +Version 20.12.1: +- bug fixes + Version 20.12: - bug fixes
--- a/eric6/DebugClients/Python/DebugClientBase.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/DebugClients/Python/DebugClientBase.py Sun Dec 06 17:53:05 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 @@ -1468,8 +1468,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 @@ -1517,7 +1517,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: @@ -1773,10 +1773,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. @@ -1807,15 +1807,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' @@ -1826,37 +1836,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:
--- a/eric6/DebugClients/Python/DebugConfig.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/DebugClients/Python/DebugConfig.py Sun Dec 06 17:53:05 2020 +0100 @@ -7,20 +7,11 @@ Module defining type strings for the different Python types. """ -# -# Keep this list in sync with Debugger.Config.ConfigVarTypeFilters -# -ConfigVarTypeStrings = [ - '__', 'NoneType', 'type', - 'bool', 'int', 'long', 'float', 'complex', - 'str', 'unicode', 'tuple', 'list', - 'dict', 'dict-proxy', 'set', 'file', 'xrange', - 'slice', 'buffer', 'class', 'instance', - 'method', 'property', 'generator', - 'function', 'builtin_function_or_method', 'code', 'module', - 'ellipsis', 'traceback', 'frame', 'other', 'frozenset', 'bytes', -] +SpecialAttributes = ( + "__bases__", "__class__", "__dict__", "__doc__", "__mro__", "__name__", + "__qualname__", +) BatchSize = 200 ConfigQtNames = ( 'PyQt5.', 'PySide2.', 'Shiboken.EnumType'
--- a/eric6/DebugClients/Python/DebugVariables.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/DebugClients/Python/DebugVariables.py Sun Dec 06 17:53:05 2020 +0100 @@ -138,9 +138,9 @@ """ if isinstance(key, str): key = repr(key) - # Special handling for Python2 unicode strings and bytes object - # Raw and f-Strings are always converted to (unicode) str - if key[0] in 'ub': + # Special handling for bytes object + # Raw and f-Strings are always converted to str + if key[0] == 'b': key = key[1:] return key # __IGNORE_WARNING_M834__ @@ -652,11 +652,6 @@ pass # not available on all Python versions try: - _TypeMap.append((unicode, None)) # __IGNORE_WARNING__ - except Exception: # secok - pass # not available on all Python versions - - try: import array _TypeMap.append((array.array, arrayResolver)) except ImportError:
--- a/eric6/Debugger/Config.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/Debugger/Config.py Sun Dec 06 17:53:05 2020 +0100 @@ -9,7 +9,7 @@ from PyQt5.QtCore import QT_TRANSLATE_NOOP -# Variables type definition +# Variable type definitions ConfigVarTypeDispStrings = { '__': QT_TRANSLATE_NOOP('Variable Types', 'Hidden Attributes'), 'NoneType': QT_TRANSLATE_NOOP('Variable Types', 'None'), @@ -20,7 +20,6 @@ 'float': QT_TRANSLATE_NOOP('Variable Types', 'Float'), 'complex': QT_TRANSLATE_NOOP('Variable Types', 'Complex'), 'str': QT_TRANSLATE_NOOP('Variable Types', 'String'), - 'unicode': QT_TRANSLATE_NOOP('Variable Types', 'Unicode String'), 'tuple': QT_TRANSLATE_NOOP('Variable Types', 'Tuple'), 'list': QT_TRANSLATE_NOOP('Variable Types', 'List/Array'), 'dict': QT_TRANSLATE_NOOP('Variable Types', 'Dictionary/Hash/Map'), @@ -45,42 +44,6 @@ 'traceback': QT_TRANSLATE_NOOP('Variable Types', 'Traceback'), 'frame': QT_TRANSLATE_NOOP('Variable Types', 'Frame'), 'bytes': QT_TRANSLATE_NOOP('Variable Types', 'Bytes'), + "special_attributes": QT_TRANSLATE_NOOP( + 'Variable Types', "Special Attributes"), } - - -ConfigVarTypeFilters = { - '__': 0, - 'NoneType': 1, - 'type': 2, - 'bool': 3, - 'int': 4, - 'long': 5, - 'float': 6, - 'complex': 7, - 'str': 8, - 'unicode': 9, # Not used anymore but keep to avoid reassignment - 'tuple': 10, - 'list': 11, - 'dict': 12, - 'dict-proxy': 13, - 'set': 14, - 'file': 15, - 'xrange': 16, - 'slice': 17, - 'buffer': 18, - 'class': 19, - 'instance': 20, - 'method': 21, - 'property': 22, - 'generator': 23, - 'function': 24, - 'builtin_function_or_method': 25, - 'code': 26, - 'module': 27, - 'ellipsis': 28, - 'traceback': 29, - 'frame': 30, - 'other': 31, # Not used anymore but keep to avoid reassignment - 'frozenset': 32, - 'bytes': 33, -}
--- a/eric6/Debugger/DebugServer.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/Debugger/DebugServer.py Sun Dec 06 17:53:05 2020 +0100 @@ -1406,7 +1406,7 @@ @param scope the scope of the variables (0 = local, 1 = global) @type int @param filterList list of variable types to filter out - @type list of int + @type list of str @param framenr framenumber of the variables to retrieve @type int """ @@ -1423,7 +1423,7 @@ @param scope the scope of the variables (0 = local, 1 = global) @type int @param filterList list of variable types to filter out - @type list of int + @type list of str @param var list encoded name of variable to retrieve @type list of str @param framenr framenumber of the variables to retrieve
--- a/eric6/Debugger/DebugUI.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/Debugger/DebugUI.py Sun Dec 06 17:53:05 2020 +0100 @@ -122,10 +122,10 @@ self.__continue, self.__step, self.__stepOver, self.__stepOut, self.__stepQuit, self.__runToCursor, self.__moveInstructionPointer ] - self.localsVarFilter, self.globalsVarFilter = ( + self.__localsVarFilterList, self.__globalsVarFilterList = ( Preferences.getVarFilters()) self.debugViewer.setVariablesFilter( - self.globalsVarFilter, self.localsVarFilter) + self.__globalsVarFilterList, self.__localsVarFilterList) # Connect the signals emitted by the debug-server debugServer.clientGone.connect(self.__clientGone) @@ -164,12 +164,13 @@ Public method to get the variables filter for a scope. @param scope flag indicating global (True) or local (False) scope - @return filters list (list of integers) + @return filters list + @rtype list of str """ if scope: - return self.globalsVarFilter[:] + return self.__globalsVarFilterList[:] else: - return self.localsVarFilter[:] + return self.__localsVarFilterList[:] def initActions(self): """ @@ -1325,8 +1326,8 @@ @type str """ self.debugServer.remoteClientVariables( - debuggerId, 0, self.localsVarFilter) - + debuggerId, 0, self.__localsVarFilterList) + def __getClientVariables(self, debuggerId): """ Private method to request the global and local variables. @@ -1340,7 +1341,7 @@ """ # get globals first self.debugServer.remoteClientVariables( - debuggerId, 1, self.globalsVarFilter) + debuggerId, 1, self.__globalsVarFilterList) # the local variables are requested once we have received the globals def __clientVariables(self, scope, variables, debuggerId): @@ -1363,7 +1364,7 @@ # now get the local variables self.debugServer.remoteClientVariables( self.getSelectedDebuggerId(), - 0, self.localsVarFilter) + 0, self.__localsVarFilterList) elif scope == 0: self.debugViewer.showVariables(variables, False) elif scope == -1: @@ -1504,11 +1505,14 @@ """ from .VariablesFilterDialog import VariablesFilterDialog dlg = VariablesFilterDialog(self.ui, 'Filter Dialog', True) - dlg.setSelection(self.localsVarFilter, self.globalsVarFilter) + dlg.setSelection(self.__localsVarFilterList, + self.__globalsVarFilterList) if dlg.exec() == QDialog.Accepted: - self.localsVarFilter, self.globalsVarFilter = dlg.getSelection() + self.__localsVarFilterList, self.__globalsVarFilterList = ( + dlg.getSelection() + ) self.debugViewer.setVariablesFilter( - self.globalsVarFilter, self.localsVarFilter) + self.__globalsVarFilterList, self.__localsVarFilterList) def __configureExceptionsFilter(self): """
--- a/eric6/Debugger/DebugViewer.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/Debugger/DebugViewer.py Sun Dec 06 17:53:05 2020 +0100 @@ -518,11 +518,12 @@ Public slot to set the local variables filter. @param globalsFilter filter list for global variable types - (list of int) - @param localsFilter filter list for local variable types (list of int) + @type list of str + @param localsFilter filter list for local variable types + @type list of str """ - self.globalsFilter = globalsFilter - self.localsFilter = localsFilter + self.__globalsFilter = globalsFilter + self.__localsFilter = localsFilter def __showSource(self): """ @@ -544,7 +545,8 @@ self.framenr = frmnr if self.debugServer.isDebugging(): self.debugServer.remoteClientVariables( - self.getSelectedDebuggerId(), 0, self.localsFilter, frmnr) + self.getSelectedDebuggerId(), 0, self.__localsFilter, + frmnr) if self.__autoViewSource: self.__showSource() @@ -558,7 +560,7 @@ self.debugServer.remoteClientSetFilter( self.getSelectedDebuggerId(), 1, filterStr) self.debugServer.remoteClientVariables( - self.getSelectedDebuggerId(), 2, self.globalsFilter) + self.getSelectedDebuggerId(), 2, self.__globalsFilter) def setLocalsFilter(self): """ @@ -570,7 +572,7 @@ self.getSelectedDebuggerId(), 0, filterStr) if self.currentStack: self.debugServer.remoteClientVariables( - self.getSelectedDebuggerId(), 0, self.localsFilter, + self.getSelectedDebuggerId(), 0, self.__localsFilter, self.framenr) def handleDebuggingStarted(self):
--- a/eric6/Debugger/DebuggerInterfaceNone.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/Debugger/DebuggerInterfaceNone.py Sun Dec 06 17:53:05 2020 +0100 @@ -329,7 +329,7 @@ @param scope the scope of the variables (0 = local, 1 = global) @type int @param filterList list of variable types to filter out - @type list of int + @type list of str @param framenr framenumber of the variables to retrieve @type int @param maxSize maximum size the formatted value of a variable will @@ -347,7 +347,7 @@ @param scope the scope of the variables (0 = local, 1 = global) @type int @param filterList list of variable types to filter out - @type list of int + @type list of str @param var list encoded name of variable to retrieve @type list of str @param framenr framenumber of the variables to retrieve (int)
--- a/eric6/Debugger/DebuggerInterfacePython.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/Debugger/DebuggerInterfacePython.py Sun Dec 06 17:53:05 2020 +0100 @@ -1066,7 +1066,7 @@ @param scope the scope of the variables (0 = local, 1 = global) @type int @param filterList list of variable types to filter out - @type list of int + @type list of str @param framenr framenumber of the variables to retrieve @type int @param maxSize maximum size the formatted value of a variable will @@ -1091,7 +1091,7 @@ @param scope the scope of the variables (0 = local, 1 = global) @type int @param filterList list of variable types to filter out - @type list of int + @type list of str @param var list encoded name of variable to retrieve @type list of str @param framenr framenumber of the variables to retrieve @@ -1328,7 +1328,7 @@ encoding=Preferences.getSystem("StringEncoding")) logging.debug("<Debug-Server> %s", line) -## print("Server: ", line) ##debug + print("Server: ", line) ##debug self.__handleJsonCommand(line, sock)
--- a/eric6/Debugger/VariablesFilterDialog.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/Debugger/VariablesFilterDialog.py Sun Dec 06 17:53:05 2020 +0100 @@ -10,7 +10,7 @@ from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QListWidgetItem -from Debugger.Config import ConfigVarTypeDispStrings, ConfigVarTypeFilters +from Debugger.Config import ConfigVarTypeDispStrings import Preferences from .Ui_VariablesFilterDialog import Ui_VariablesFilterDialog @@ -44,7 +44,7 @@ for widget in self.localsList, self.globalsList: for varType, varTypeStr in ConfigVarTypeDispStrings.items(): itm = QListWidgetItem(self.tr(varTypeStr), widget) - itm.setData(Qt.UserRole, ConfigVarTypeFilters[varType]) + itm.setData(Qt.UserRole, varType) itm.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) itm.setCheckState(Qt.Unchecked) widget.addItem(itm) @@ -56,8 +56,10 @@ """ Public slot to retrieve the current selections. - @return A tuple of lists of integer values. The first list is the - locals variables filter, the second the globals variables filter. + @return tuple of lists containing the variable filters. The first list + is the locals variables filter, the second the globals variables + filter. + @rtype tuple of (list of str, list of str) """ lList = [] for row in range(self.localsList.count()): @@ -76,8 +78,10 @@ """ Public slot to set the current selection. - @param lList local variables filter (list of int) - @param gList global variables filter (list of int) + @param lList local variables filter + @type list of str + @param gList global variables filter + @type list of str """ for row in range(self.localsList.count()): itm = self.localsList.item(row)
--- a/eric6/Debugger/VariablesViewer.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/Debugger/VariablesViewer.py Sun Dec 06 17:53:05 2020 +0100 @@ -195,7 +195,7 @@ elif dtype == "Shiboken.EnumType": self.hasChildren = True - elif dtype in ['str', 'unicode']: + elif dtype == 'str': if VariableItem.rx_nonprintable.search(dvalue) is None: try: dvalue = ast.literal_eval(dvalue)
--- a/eric6/Globals/__init__.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/Globals/__init__.py Sun Dec 06 17:53:05 2020 +0100 @@ -318,9 +318,13 @@ # step 2: try the qt5_applications package if not path: - import qt5_applications - path = os.path.join(os.path.dirname(qt5_applications.__file__), - "Qt", "bin") + try: + import qt5_applications + path = os.path.join(os.path.dirname(qt5_applications.__file__), + "Qt", "bin") + except ImportError: + # qt5-applications is not installed; just go to the next step + pass # step 3: determine from used Python interpreter (designer is test object) if not path:
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityContext.py Sat Dec 05 18:25:31 2020 +0100 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityContext.py Sun Dec 06 17:53:05 2020 +0100 @@ -146,10 +146,9 @@ @property def stringVal(self): """ - Public method to get the value of a standalone unicode or string - object. + Public method to get the value of a standalone string object. - @return value of a standalone unicode or string object + @return value of a standalone string object @rtype str """ return self.__context.get('str')