Continued fixing code style issues detected by the extended style checker.

Sat, 11 Mar 2017 18:08:42 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 11 Mar 2017 18:08:42 +0100
changeset 5604
b047181a4a33
parent 5603
4f2dd0850803
child 5605
1950fe1a32c4

Continued fixing code style issues detected by the extended style checker.

UI/BrowserModel.py file | annotate | diff | comparison | revisions
UI/UserInterface.py file | annotate | diff | comparison | revisions
Utilities/ClassBrowsers/ClbrBaseClasses.py file | annotate | diff | comparison | revisions
Utilities/ClassBrowsers/__init__.py file | annotate | diff | comparison | revisions
Utilities/ClassBrowsers/idlclbr.py file | annotate | diff | comparison | revisions
Utilities/ClassBrowsers/jsclbr.py file | annotate | diff | comparison | revisions
Utilities/ClassBrowsers/pyclbr.py file | annotate | diff | comparison | revisions
Utilities/ClassBrowsers/rbclbr.py file | annotate | diff | comparison | revisions
Utilities/ModuleParser.py file | annotate | diff | comparison | revisions
Utilities/__init__.py file | annotate | diff | comparison | revisions
Utilities/binplistlib.py file | annotate | diff | comparison | revisions
Utilities/crypto/__init__.py file | annotate | diff | comparison | revisions
Utilities/crypto/py3AES.py file | annotate | diff | comparison | revisions
Utilities/crypto/py3PBKDF2.py file | annotate | diff | comparison | revisions
--- a/UI/BrowserModel.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/UI/BrowserModel.py	Sat Mar 11 18:08:42 2017 +0100
@@ -300,17 +300,18 @@
             return
         
         if Preferences.getUI("BrowsersListHiddenFiles"):
-            filter = QDir.Filters(
+            dirFilter = QDir.Filters(
                 QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot)
         else:
-            filter = QDir.Filters(QDir.AllEntries | QDir.NoDot | QDir.NoDotDot)
+            dirFilter = QDir.Filters(
+                QDir.AllEntries | QDir.NoDot | QDir.NoDotDot)
         
         for itm in self.watchedItems[path]:
             oldCnt = itm.childCount()
             
             qdir = QDir(itm.dirName())
             
-            entryInfoList = qdir.entryInfoList(filter)
+            entryInfoList = qdir.entryInfoList(dirFilter)
             
             # step 1: check for new entries
             children = itm.children()
@@ -531,11 +532,12 @@
         qdir = QDir(parentItem.dirName())
         
         if Preferences.getUI("BrowsersListHiddenFiles"):
-            filter = QDir.Filters(
+            dirFilter = QDir.Filters(
                 QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot)
         else:
-            filter = QDir.Filters(QDir.AllEntries | QDir.NoDot | QDir.NoDotDot)
-        entryInfoList = qdir.entryInfoList(filter)
+            dirFilter = QDir.Filters(
+                QDir.AllEntries | QDir.NoDot | QDir.NoDotDot)
+        entryInfoList = qdir.entryInfoList(dirFilter)
         if len(entryInfoList) > 0:
             if repopulate:
                 self.beginInsertRows(
@@ -552,8 +554,8 @@
                         Preferences.getUI("BrowsersFileFilters").split(";")
                     if fileFilters:
                         fn = f.fileName()
-                        if any([fnmatch.fnmatch(fn, ff.strip())
-                                for ff in fileFilters]):
+                        if any(fnmatch.fnmatch(fn, ff.strip())
+                               for ff in fileFilters):
                             continue
                     node = BrowserFileItem(
                         parentItem,
@@ -606,13 +608,13 @@
         moduleName = parentItem.moduleName()
         fileName = parentItem.fileName()
         try:
-            dict = Utilities.ClassBrowsers.readmodule(
+            dictionary = Utilities.ClassBrowsers.readmodule(
                 moduleName, [parentItem.dirName()],
                 parentItem.isPython2File() or parentItem.isPython3File())
         except ImportError:
             return
         
-        keys = list(dict.keys())
+        keys = list(dictionary.keys())
         if len(keys) > 0:
             if repopulate:
                 self.beginInsertRows(
@@ -622,7 +624,7 @@
                 if key.startswith("@@"):
                     # special treatment done later
                     continue
-                cl = dict[key]
+                cl = dictionary[key]
                 try:
                     if cl.module == moduleName:
                         node = BrowserClassItem(parentItem, cl, fileName)
@@ -633,12 +635,12 @@
                 node = BrowserCodingItem(
                     parentItem,
                     QCoreApplication.translate("BrowserModel", "Coding: {0}")
-                    .format(dict["@@Coding@@"].coding))
+                    .format(dictionary["@@Coding@@"].coding))
                 self._addItem(node, parentItem)
             if "@@Globals@@" in keys:
                 node = BrowserGlobalsItem(
                     parentItem,
-                    dict["@@Globals@@"].globals,
+                    dictionary["@@Globals@@"].globals,
                     QCoreApplication.translate("BrowserModel", "Globals"))
                 self._addItem(node, parentItem)
             if "@@Import@@" in keys or "@@ImportFrom@@" in keys:
@@ -648,7 +650,7 @@
                 self._addItem(node, parentItem)
                 if "@@Import@@" in keys:
                     for importedModule in \
-                            dict["@@Import@@"].getImports().values():
+                            dictionary["@@Import@@"].getImports().values():
                         m_node = BrowserImportItem(
                             node,
                             importedModule.importedModuleName,
--- a/UI/UserInterface.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/UI/UserInterface.py	Sat Mar 11 18:08:42 2017 +0100
@@ -3266,47 +3266,47 @@
         editor = MiniEditor(parent=self)
         editor.show()
         
-    def addE5Actions(self, actions, type):
+    def addE5Actions(self, actions, actionType):
         """
         Public method to add actions to the list of actions.
         
         @param actions list of actions to be added (list of E5Action)
-        @param type string denoting the action set to get.
+        @param actionType string denoting the action set to add to.
             It must be one of "ui" or "wizards".
         """
-        if type == 'ui':
+        if actionType == 'ui':
             self.actions.extend(actions)
-        elif type == 'wizards':
+        elif actionType == 'wizards':
             self.wizardsActions.extend(actions)
         
-    def removeE5Actions(self, actions, type='ui'):
+    def removeE5Actions(self, actions, actionType='ui'):
         """
         Public method to remove actions from the list of actions.
         
         @param actions list of actions (list of E5Action)
-        @param type string denoting the action set to get.
+        @param actionType string denoting the action set to remove from.
             It must be one of "ui" or "wizards".
         """
         for act in actions:
             try:
-                if type == 'ui':
+                if actionType == 'ui':
                     self.actions.remove(act)
-                elif type == 'wizards':
+                elif actionType == 'wizards':
                     self.wizardsActions.remove(act)
             except ValueError:
                 pass
         
-    def getActions(self, type):
+    def getActions(self, actionType):
         """
         Public method to get a list of all actions.
         
-        @param type string denoting the action set to get.
+        @param actionType string denoting the action set to get.
             It must be one of "ui" or "wizards".
         @return list of all actions (list of E5Action)
         """
-        if type == 'ui':
+        if actionType == 'ui':
             return self.actions[:]
-        elif type == 'wizards':
+        elif actionType == 'wizards':
             return self.wizardsActions[:]
         else:
             return []
@@ -5350,21 +5350,21 @@
             if not single or self.helpWindow is None:
                 if WEBENGINE_AVAILABLE:
                     from WebBrowser.WebBrowserWindow import WebBrowserWindow
-                    help = WebBrowserWindow(home, '.', None, 'web_browser',
-                                            True, searchWord=searchWord)
+                    browser = WebBrowserWindow(home, '.', None, 'web_browser',
+                                               True, searchWord=searchWord)
                 elif WEBKIT_AVAILABLE:
                     from Helpviewer.HelpWindow import HelpWindow
-                    help = HelpWindow(home, '.', None, 'help viewer', True,
-                                      searchWord=searchWord)
+                    browser = HelpWindow(home, '.', None, 'help viewer', True,
+                                         searchWord=searchWord)
 
                 if QApplication.desktop().width() > 400 and \
                    QApplication.desktop().height() > 500:
-                    help.show()
+                    browser.show()
                 else:
-                    help.showMaximized()
+                    browser.showMaximized()
                 
                 if single:
-                    self.helpWindow = help
+                    self.helpWindow = browser
                     try:
                         self.helpWindow.webBrowserWindowClosed.connect(
                             self.__helpClosed)
--- a/Utilities/ClassBrowsers/ClbrBaseClasses.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/ClassBrowsers/ClbrBaseClasses.py	Sat Mar 11 18:08:42 2017 +0100
@@ -214,20 +214,20 @@
     """
     Class to represent a class.
     """
-    def __init__(self, module, name, super, file, lineno):
+    def __init__(self, module, name, superClasses, file, lineno):
         """
         Constructor
         
         @param module name of the module containing this class
         @param name name of this class
-        @param super list of class names this class is inherited from
+        @param superClasses list of class names this class is inherited from
         @param file filename containing this class
         @param lineno linenumber of the class definition
         """
         ClbrBase.__init__(self, module, name, file, lineno)
-        if super is None:
-            super = []
-        self.super = super
+        if superClasses is None:
+            superClasses = []
+        self.super = superClasses
 
 
 class Module(ClbrBase):
--- a/Utilities/ClassBrowsers/__init__.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/ClassBrowsers/__init__.py	Sat Mar 11 18:08:42 2017 +0100
@@ -57,29 +57,29 @@
     
     if ext in __extensions["IDL"]:
         from . import idlclbr
-        dict = idlclbr.readmodule_ex(module, path)
+        dictionary = idlclbr.readmodule_ex(module, path)
         idlclbr._modules.clear()
     elif ext in __extensions["Ruby"]:
         from . import rbclbr
-        dict = rbclbr.readmodule_ex(module, path)
+        dictionary = rbclbr.readmodule_ex(module, path)
         rbclbr._modules.clear()
     elif ext in __extensions["JavaScript"] and sys.version_info[0] == 3:
         from . import jsclbr
-        dict = jsclbr.readmodule_ex(module, path)
+        dictionary = jsclbr.readmodule_ex(module, path)
         jsclbr._modules.clear()
     elif ext in Preferences.getPython("PythonExtensions") or \
         ext in Preferences.getPython("Python3Extensions") or \
             isPyFile:
         from . import pyclbr
-        dict = pyclbr.readmodule_ex(module, path, isPyFile=isPyFile)
+        dictionary = pyclbr.readmodule_ex(module, path, isPyFile=isPyFile)
         pyclbr._modules.clear()
     else:
         # try Python if it is without extension
         from . import pyclbr
-        dict = pyclbr.readmodule_ex(module, path)
+        dictionary = pyclbr.readmodule_ex(module, path)
         pyclbr._modules.clear()
     
-    return dict
+    return dictionary
 
 
 def find_module(name, path, isPyFile=False):
--- a/Utilities/ClassBrowsers/idlclbr.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/ClassBrowsers/idlclbr.py	Sat Mar 11 18:08:42 2017 +0100
@@ -127,17 +127,19 @@
     """
     Class to represent a CORBA IDL interface.
     """
-    def __init__(self, module, name, super, file, lineno):
+    def __init__(self, module, name, superClasses, file, lineno):
         """
         Constructor
         
         @param module name of the module containing this class
         @param name name of this interface
-        @param super list of interface names this interface is inherited from
+        @param superClasses list of interface names this interface is
+            inherited from
         @param file filename containing this interface
         @param lineno linenumber of the interface definition
         """
-        ClbrBaseClasses.Class.__init__(self, module, name, super, file, lineno)
+        ClbrBaseClasses.Class.__init__(self, module, name, superClasses, file,
+                                       lineno)
         VisibilityMixin.__init__(self)
 
 
@@ -190,7 +192,7 @@
     """
     global _modules
     
-    dict = {}
+    dictionary = {}
     dict_counts = {}
 
     if module in _modules:
@@ -205,18 +207,18 @@
         f.close()
     if type not in SUPPORTED_TYPES:
         # not CORBA IDL source, can't do anything with this module
-        _modules[module] = dict
-        return dict
+        _modules[module] = dictionary
+        return dictionary
 
-    _modules[module] = dict
+    _modules[module] = dictionary
     classstack = []  # stack of (class, indent) pairs
     indent = 0
     try:
         src = Utilities.readEncodedFile(file)[0]
     except (UnicodeError, IOError):
         # can't do anything with this module
-        _modules[module] = dict
-        return dict
+        _modules[module] = dictionary
+        return dictionary
 
     lineno, last_lineno_pos = 1, 0
     lastGlobalEntry = None
@@ -267,7 +269,7 @@
                         meth_name, dict_counts[meth_name])
                 else:
                     dict_counts[meth_name] = 0
-                dict[meth_name] = f
+                dictionary[meth_name] = f
             if not classstack:
                 if lastGlobalEntry:
                     lastGlobalEntry.setEndLine(lineno - 1)
@@ -306,7 +308,7 @@
             cur_class = Interface(module, class_name, inherit,
                                   file, lineno)
             if not classstack:
-                dict[class_name] = cur_class
+                dictionary[class_name] = cur_class
             else:
                 cls = classstack[-1][0]
                 cls._addclass(class_name, cur_class)
@@ -336,7 +338,7 @@
             # remember this module
             cur_class = Module(module, module_name, file, lineno)
             if not classstack:
-                dict[module_name] = cur_class
+                dictionary[module_name] = cur_class
                 if lastGlobalEntry:
                     lastGlobalEntry.setEndLine(lineno - 1)
                 lastGlobalEntry = cur_class
@@ -378,4 +380,4 @@
         else:
             assert 0, "regexp _getnext found something unexpected"
 
-    return dict
+    return dictionary
--- a/Utilities/ClassBrowsers/jsclbr.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/ClassBrowsers/jsclbr.py	Sat Mar 11 18:08:42 2017 +0100
@@ -284,7 +284,7 @@
     """
     global _modules
     
-    dict = {}
+    dictionary = {}
 
     if module in _modules:
         # we've seen this file before...
@@ -298,18 +298,18 @@
         f.close()
     if type not in SUPPORTED_TYPES:
         # not CORBA IDL source, can't do anything with this module
-        _modules[module] = dict
-        return dict
+        _modules[module] = dictionary
+        return dictionary
 
-    _modules[module] = dict
+    _modules[module] = dictionary
     try:
         src = Utilities.readEncodedFile(file)[0]
     except (UnicodeError, IOError):
         # can't do anything with this module
-        _modules[module] = dict
-        return dict
+        _modules[module] = dictionary
+        return dictionary
     
     visitor = Visitor(src, module, file)
-    dict = visitor.parse()
-    _modules[module] = dict
-    return dict
+    dictionary = visitor.parse()
+    _modules[module] = dictionary
+    return dictionary
--- a/Utilities/ClassBrowsers/pyclbr.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/ClassBrowsers/pyclbr.py	Sat Mar 11 18:08:42 2017 +0100
@@ -157,17 +157,18 @@
     """
     Class to represent a Python class.
     """
-    def __init__(self, module, name, super, file, lineno):
+    def __init__(self, module, name, superClasses, file, lineno):
         """
         Constructor
         
         @param module name of the module containing this class
         @param name name of this class
-        @param super list of class names this class is inherited from
+        @param superClasses list of class names this class is inherited from
         @param file filename containing this class
         @param lineno linenumber of the class definition
         """
-        ClbrBaseClasses.Class.__init__(self, module, name, super, file, lineno)
+        ClbrBaseClasses.Class.__init__(self, module, name, superClasses, file,
+                                       lineno)
         VisibilityMixin.__init__(self)
 
 
@@ -340,7 +341,7 @@
     """
     global _modules
     
-    dict = {}
+    dictionary = {}
     dict_counts = {}
 
     if module in _modules:
@@ -348,8 +349,8 @@
         return _modules[module]
     if module in sys.builtin_module_names:
         # this is a built-in module
-        _modules[module] = dict
-        return dict
+        _modules[module] = dictionary
+        return dictionary
 
     # search the path for the module
     f = None
@@ -364,10 +365,10 @@
         f, file, (suff, mode, type) = \
             ClassBrowsers.find_module(module, fullpath, isPyFile)
     if module.endswith(".py") and type == imp.PKG_DIRECTORY:
-        return dict
+        return dictionary
     if type == imp.PKG_DIRECTORY:
-        dict['__path__'] = [file]
-        _modules[module] = dict
+        dictionary['__path__'] = [file]
+        _modules[module] = dictionary
         path = [file] + path
         f, file, (suff, mode, type) = \
             ClassBrowsers.find_module('__init__', [file])
@@ -375,10 +376,10 @@
         f.close()
     if type not in SUPPORTED_TYPES:
         # not Python source, can't do anything with this module
-        _modules[module] = dict
-        return dict
+        _modules[module] = dictionary
+        return dictionary
 
-    _modules[module] = dict
+    _modules[module] = dictionary
     classstack = []  # stack of (class, indent) pairs
     conditionalsstack = []  # stack of indents of conditional defines
     deltastack = []
@@ -388,8 +389,8 @@
         src = Utilities.readEncodedFile(file)[0]
     except (UnicodeError, IOError):
         # can't do anything with this module
-        _modules[module] = dict
-        return dict
+        _modules[module] = dictionary
+        return dictionary
 
     lineno, last_lineno_pos = 1, 0
     lastGlobalEntry = None
@@ -470,7 +471,7 @@
                         meth_name, dict_counts[meth_name])
                 else:
                     dict_counts[meth_name] = 0
-                dict[meth_name] = f
+                dictionary[meth_name] = f
             if not classstack:
                 if lastGlobalEntry:
                     lastGlobalEntry.setEndLine(lineno - 1)
@@ -508,9 +509,9 @@
                 names = []
                 for n in inherit.split(','):
                     n = n.strip()
-                    if n in dict:
+                    if n in dictionary:
                         # we know this super class
-                        n = dict[n]
+                        n = dictionary[n]
                     else:
                         c = n.split('.')
                         if len(c) > 1:
@@ -537,7 +538,7 @@
                         class_name, dict_counts[class_name])
                 else:
                     dict_counts[class_name] = 0
-                dict[class_name] = cur_class
+                dictionary[class_name] = cur_class
             else:
                 classstack[-1][0]._addclass(class_name, cur_class)
             if not classstack:
@@ -567,10 +568,10 @@
             last_lineno_pos = start
             if thisindent == 0:
                 # global variable
-                if "@@Globals@@" not in dict:
-                    dict["@@Globals@@"] = ClbrBaseClasses.ClbrBase(
+                if "@@Globals@@" not in dictionary:
+                    dictionary["@@Globals@@"] = ClbrBaseClasses.ClbrBase(
                         module, "Globals", file, lineno)
-                dict["@@Globals@@"]._addglobal(
+                dictionary["@@Globals@@"]._addglobal(
                     Attribute(module, variable_name, file, lineno))
                 if lastGlobalEntry:
                     lastGlobalEntry.setEndLine(lineno - 1)
@@ -591,7 +592,7 @@
             lineno = lineno + src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             pubs = Publics(module, file, lineno, idents)
-            dict['__all__'] = pubs
+            dictionary['__all__'] = pubs
         
         elif m.start("Import") >= 0:
             # import module
@@ -600,10 +601,10 @@
                      .replace("\\", "").split(',')]
             lineno = lineno + src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
-            if "@@Import@@" not in dict:
-                dict["@@Import@@"] = Imports(module, file)
+            if "@@Import@@" not in dictionary:
+                dictionary["@@Import@@"] = Imports(module, file)
             for name in names:
-                dict["@@Import@@"].addImport(name, [], lineno)
+                dictionary["@@Import@@"].addImport(name, [], lineno)
         
         elif m.start("ImportFrom") >= 0:
             # from module import stuff
@@ -619,9 +620,9 @@
                      .split(',')]
             lineno = lineno + src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
-            if "@@Import@@" not in dict:
-                dict["@@Import@@"] = Imports(module, file)
-            dict["@@Import@@"].addImport(mod, names, lineno)
+            if "@@Import@@" not in dictionary:
+                dictionary["@@Import@@"] = Imports(module, file)
+            dictionary["@@Import@@"].addImport(mod, names, lineno)
         
         elif m.start("ConditionalDefine") >= 0:
             # a conditional function/method definition
@@ -639,26 +640,26 @@
             coding = m.group("Coding")
             lineno = lineno + src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
-            if "@@Coding@@" not in dict:
-                dict["@@Coding@@"] = ClbrBaseClasses.Coding(
+            if "@@Coding@@" not in dictionary:
+                dictionary["@@Coding@@"] = ClbrBaseClasses.Coding(
                     module, file, lineno, coding)
         
         else:
             assert 0, "regexp _getnext found something unexpected"
 
-    if '__all__' in dict:
+    if '__all__' in dictionary:
         # set visibility of all top level elements
-        pubs = dict['__all__']
-        for key in list(list(dict.keys())):
+        pubs = dictionary['__all__']
+        for key in dictionary.keys():
             if key == '__all__' or key.startswith("@@"):
                 continue
             if key in pubs.identifiers:
-                dict[key].setPublic()
+                dictionary[key].setPublic()
             else:
-                dict[key].setPrivate()
-        del dict['__all__']
+                dictionary[key].setPrivate()
+        del dictionary['__all__']
     
-    return dict
+    return dictionary
 
 
 def _indent(ws):
--- a/Utilities/ClassBrowsers/rbclbr.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/ClassBrowsers/rbclbr.py	Sat Mar 11 18:08:42 2017 +0100
@@ -180,17 +180,18 @@
     """
     Class to represent a Ruby class.
     """
-    def __init__(self, module, name, super, file, lineno):
+    def __init__(self, module, name, superClasses, file, lineno):
         """
         Constructor
         
         @param module name of the module containing this class
         @param name name of this class
-        @param super list of class names this class is inherited from
+        @param superClasses list of class names this class is inherited from
         @param file filename containing this class
         @param lineno linenumber of the class definition
         """
-        ClbrBaseClasses.Class.__init__(self, module, name, super, file, lineno)
+        ClbrBaseClasses.Class.__init__(self, module, name, superClasses, file,
+                                       lineno)
         VisibilityMixin.__init__(self)
 
 
@@ -260,7 +261,7 @@
     """
     global _modules
     
-    dict = {}
+    dictionary = {}
     dict_counts = {}
 
     if module in _modules:
@@ -275,10 +276,10 @@
         f.close()
     if type not in SUPPORTED_TYPES:
         # not Ruby source, can't do anything with this module
-        _modules[module] = dict
-        return dict
+        _modules[module] = dictionary
+        return dictionary
 
-    _modules[module] = dict
+    _modules[module] = dictionary
     classstack = []  # stack of (class, indent) pairs
     acstack = []    # stack of (access control, indent) pairs
     indent = 0
@@ -286,8 +287,8 @@
         src = Utilities.readEncodedFile(file)[0]
     except (UnicodeError, IOError):
         # can't do anything with this module
-        _modules[module] = dict
-        return dict
+        _modules[module] = dictionary
+        return dictionary
 
     lineno, last_lineno_pos = 1, 0
     cur_obj = None
@@ -356,7 +357,7 @@
                         meth_name, dict_counts[meth_name])
                 else:
                     dict_counts[meth_name] = 0
-                dict[meth_name] = f
+                dictionary[meth_name] = f
             if not classstack:
                 if lastGlobalEntry:
                     lastGlobalEntry.setEndLine(lineno - 1)
@@ -398,10 +399,10 @@
             cur_class = Class(module, class_name, inherit,
                               file, lineno)
             if not classstack:
-                if class_name in dict:
-                    cur_class = dict[class_name]
+                if class_name in dictionary:
+                    cur_class = dictionary[class_name]
                 else:
-                    dict[class_name] = cur_class
+                    dictionary[class_name] = cur_class
             else:
                 cls = classstack[-1][0]
                 if class_name in cls.classes:
@@ -439,10 +440,10 @@
             # remember this class
             cur_class = Module(module, module_name, file, lineno)
             if not classstack:
-                if module_name in dict:
-                    cur_class = dict[module_name]
+                if module_name in dictionary:
+                    cur_class = dictionary[module_name]
                 else:
-                    dict[module_name] = cur_class
+                    dictionary[module_name] = cur_class
             else:
                 cls = classstack[-1][0]
                 if module_name in cls.classes:
@@ -582,11 +583,11 @@
             coding = m.group("Coding")
             lineno = lineno + src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
-            if "@@Coding@@" not in dict:
-                dict["@@Coding@@"] = ClbrBaseClasses.Coding(
+            if "@@Coding@@" not in dictionary:
+                dictionary["@@Coding@@"] = ClbrBaseClasses.Coding(
                     module, file, lineno, coding)
 
         else:
             assert 0, "regexp _getnext found something unexpected"
 
-    return dict
+    return dictionary
--- a/Utilities/ModuleParser.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/ModuleParser.py	Sat Mar 11 18:08:42 2017 +0100
@@ -392,13 +392,13 @@
     """
     Class to represent a Python module.
     """
-    def __init__(self, name, file=None, type=None):
+    def __init__(self, name, file=None, moduleType=None):
         """
         Constructor
         
         @param name name of this module (string)
         @param file filename of file containing this module (string)
-        @param type type of this module
+        @param moduleType type of this module
         """
         self.name = name
         self.file = file
@@ -413,10 +413,10 @@
         self.imports = []
         self.from_imports = {}
         self.package = '.'.join(name.split('.')[:-1])
-        self.type = type
-        if type in [imp.PY_SOURCE, PTL_SOURCE]:
+        self.type = moduleType
+        if moduleType in [imp.PY_SOURCE, PTL_SOURCE]:
             self._getnext = _py_getnext
-        elif type == RB_SOURCE:
+        elif moduleType == RB_SOURCE:
             self._getnext = _rb_getnext
         else:
             self._getnext = None
@@ -495,18 +495,18 @@
         elif self.type == RB_SOURCE:
             self.__rb_scan(src)
     
-    def __py_setVisibility(self, object):
+    def __py_setVisibility(self, objectRef):
         """
         Private method to set the visibility of an object.
         
-        @param object reference to the object (Attribute, Class or Function)
+        @param objectRef reference to the object (Attribute, Class or Function)
         """
-        if object.name.startswith('__'):
-            object.setPrivate()
-        elif object.name.startswith('_'):
-            object.setProtected()
+        if objectRef.name.startswith('__'):
+            objectRef.setPrivate()
+        elif objectRef.name.startswith('_'):
+            objectRef.setProtected()
         else:
-            object.setPublic()
+            objectRef.setPublic()
     
     def __py_scan(self, src):
         """
@@ -1224,36 +1224,36 @@
         if self.type in [imp.PY_SOURCE, PTL_SOURCE]:
             py3ExtList = Preferences.getDebugger("Python3Extensions").split()
             if self.file.endswith(tuple(py3ExtList)):
-                type = "Python3"
+                moduleType = "Python3"
             else:
-                type = "Python2"
+                moduleType = "Python2"
         elif self.type == RB_SOURCE:
-            type = "Ruby"
+            moduleType = "Ruby"
         else:
-            type = ""
-        return type
+            moduleType = ""
+        return moduleType
 
 
 class Class(VisibilityBase):
     """
     Class to represent a Python class.
     """
-    def __init__(self, module, name, super, file, lineno):
+    def __init__(self, module, name, superClasses, file, lineno):
         """
         Constructor
         
         @param module name of module containing this class (string)
         @param name name of the class (string)
-        @param super list of classnames this class is inherited from
+        @param superClasses list of classnames this class is inherited from
                 (list of strings)
         @param file name of file containing this class (string)
         @param lineno linenumber of the class definition (integer)
         """
         self.module = module
         self.name = name
-        if super is None:
-            super = []
-        self.super = super
+        if superClasses is None:
+            superClasses = []
+        self.super = superClasses
         self.methods = {}
         self.attributes = {}
         self.globals = {}
@@ -1521,22 +1521,22 @@
     f = None
     if inpackage:
         try:
-            f, file, (suff, mode, type) = find_module(
+            f, file, (suff, mode, moduleType) = find_module(
                 module, path, _extensions)
         except ImportError:
             f = None
     if f is None:
         fullpath = list(path) + sys.path
-        f, file, (suff, mode, type) = find_module(
+        f, file, (suff, mode, moduleType) = find_module(
             module, fullpath, _extensions)
     if f:
         f.close()
-    if type not in SUPPORTED_TYPES:
+    if moduleType not in SUPPORTED_TYPES:
         # not supported source, can't do anything with this module
         _modules[modname] = Module(modname, None, None)
         return _modules[modname]
     
-    mod = Module(modname, file, type)
+    mod = Module(modname, file, moduleType)
     try:
         src = Utilities.readEncodedFile(file)[0]
         mod.scan(src)
--- a/Utilities/__init__.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/__init__.py	Sat Mar 11 18:08:42 2017 +0100
@@ -201,10 +201,9 @@
     f = open(filename, "rb")
     text = f.read()
     f.close()
-    hash = str(QCryptographicHash.hash(
-               QByteArray(text), QCryptographicHash.Md5).toHex(),
-               encoding="ASCII")
-    return decode(text) + (hash, )
+    hashStr = str(QCryptographicHash.hash(
+        QByteArray(text), QCryptographicHash.Md5).toHex(), encoding="ASCII")
+    return decode(text) + (hashStr, )
 
 
 def decode(text):
@@ -460,16 +459,16 @@
 }
 
 
-def escape_entities(m, map=_escape_map):
+def escape_entities(m, escmap=_escape_map):
     """
     Function to encode html entities.
     
     @param m the match object
-    @param map the map of entities to encode
+    @param escmap the map of entities to encode
     @return the converted text (string)
     """
     char = m.group()
-    text = map.get(char)
+    text = escmap.get(char)
     if text is None:
         text = "&#{0:d};".format(ord(char))
     return text
@@ -527,8 +526,8 @@
     @return the converted text (string)
     """
     char = m.group()
-    ord = int(char[2:-1])
-    return chr(ord)
+    ordinal = int(char[2:-1])
+    return chr(ordinal)
 
 
 def html_udecode(text, pattern=_uunescape):
@@ -825,8 +824,8 @@
         return False
     
     dirs = path.split(os.pathsep)
-    for dir in dirs:
-        if os.access(os.path.join(dir, file), os.X_OK):
+    for directory in dirs:
+        if os.access(os.path.join(directory, file), os.X_OK):
             return True
     
     return False
@@ -942,8 +941,8 @@
         return ""
         
     dirs = path.split(os.pathsep)
-    for dir in dirs:
-        exe = os.path.join(dir, file)
+    for directory in dirs:
+        exe = os.path.join(directory, file)
         if os.access(exe, os.X_OK):
             return exe
             
@@ -977,8 +976,8 @@
     # environment variable not defined
     if path is not None:
         dirs = path.split(os.pathsep)
-        for dir in dirs:
-            exe = os.path.join(dir, file)
+        for directory in dirs:
+            exe = os.path.join(directory, file)
             if os.access(exe, os.X_OK) and exe not in paths:
                 paths.append(exe)
     
@@ -1020,9 +1019,9 @@
         return ""
         
     dirs = path.split(os.pathsep)
-    for dir in dirs:
+    for directory in dirs:
         for filename in filenames:
-            exe = os.path.join(dir, filename)
+            exe = os.path.join(directory, filename)
             if os.access(exe, os.X_OK):
                 return exe
     
@@ -1575,12 +1574,12 @@
     @return the requested entry or the default value, if the entry wasn't
         found (string or None)
     """
-    filter = QRegExp("^{0}[ \t]*=".format(key))
+    filterRe = QRegExp("^{0}[ \t]*=".format(key))
     if isWindowsPlatform():
-        filter.setCaseSensitivity(Qt.CaseInsensitive)
+        filterRe.setCaseSensitivity(Qt.CaseInsensitive)
     
     entries = [e for e in QProcess.systemEnvironment()
-               if filter.indexIn(e) != -1]
+               if filterRe.indexIn(e) != -1]
     if not entries:
         return default
     
@@ -1596,12 +1595,12 @@
     @param key key of the requested environment entry (string)
     @return flag indicating the presence of the requested entry (boolean)
     """
-    filter = QRegExp("^{0}[ \t]*=".format(key))
+    filterRe = QRegExp("^{0}[ \t]*=".format(key))
     if isWindowsPlatform():
-        filter.setCaseSensitivity(Qt.CaseInsensitive)
+        filterRe.setCaseSensitivity(Qt.CaseInsensitive)
     
     entries = [e for e in QProcess.systemEnvironment()
-               if filter.indexIn(e) != -1]
+               if filterRe.indexIn(e) != -1]
     return len(entries) > 0
 
 ###############################################################################
--- a/Utilities/binplistlib.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/binplistlib.py	Sat Mar 11 18:08:42 2017 +0100
@@ -344,7 +344,7 @@
         result = None
         tmp_byte = self.contents[self.currentOffset:self.currentOffset + 1]
         marker_byte = unpack("!B", tmp_byte)[0]
-        format = (marker_byte >> 4) & 0x0f
+        formatNibble = (marker_byte >> 4) & 0x0f
         extra = marker_byte & 0x0f
         self.currentOffset += 1
         
@@ -355,7 +355,7 @@
             return extra
         
         # bool, null, or fill byte
-        if format == 0b0000:
+        if formatNibble == 0b0000:
             if extra == 0b0000:
                 result = None
             elif extra == 0b1000:
@@ -369,61 +369,61 @@
                     "Invalid object found at offset: {0}".format(
                         self.currentOffset - 1))
         # int
-        elif format == 0b0001:
+        elif formatNibble == 0b0001:
             extra = proc_extra(extra)
             result = self.readInteger(pow(2, extra))
         # real
-        elif format == 0b0010:
+        elif formatNibble == 0b0010:
             extra = proc_extra(extra)
             result = self.readReal(extra)
         # date
-        elif format == 0b0011 and extra == 0b0011:
+        elif formatNibble == 0b0011 and extra == 0b0011:
             result = self.readDate()
         # data
-        elif format == 0b0100:
+        elif formatNibble == 0b0100:
             extra = proc_extra(extra)
             result = self.readData(extra)
         # ascii string
-        elif format == 0b0101:
+        elif formatNibble == 0b0101:
             extra = proc_extra(extra)
             result = self.readAsciiString(extra)
         # Unicode string
-        elif format == 0b0110:
+        elif formatNibble == 0b0110:
             extra = proc_extra(extra)
             result = self.readUnicode(extra)
         # uid
-        elif format == 0b1000:
+        elif formatNibble == 0b1000:
             result = self.readUid(extra)
         # array
-        elif format == 0b1010:
+        elif formatNibble == 0b1010:
             extra = proc_extra(extra)
             result = self.readArray(extra)
         # set
-        elif format == 0b1100:
+        elif formatNibble == 0b1100:
             extra = proc_extra(extra)
             result = set(self.readArray(extra))
         # dict
-        elif format == 0b1101:
+        elif formatNibble == 0b1101:
             extra = proc_extra(extra)
             result = self.readDict(extra)
         else:
             raise InvalidPlistException(
                 "Invalid object found: {{format: {0}, extra: {1}}}".format(
-                    bin(format), bin(extra)))
+                    bin(formatNibble), bin(extra)))
         return result
     
-    def readInteger(self, bytes):
+    def readInteger(self, length):
         """
         Public method to read an Integer object.
         
-        @param bytes length of the object (integer)
+        @param length length of the object (integer)
         @return integer object
         """
         result = 0
         original_offset = self.currentOffset
-        data = self.contents[self.currentOffset:self.currentOffset + bytes]
-        result = self.getSizedInteger(data, bytes)
-        self.currentOffset = original_offset + bytes
+        data = self.contents[self.currentOffset:self.currentOffset + length]
+        result = self.getSizedInteger(data, length)
+        self.currentOffset = original_offset + length
         return result
     
     def readReal(self, length):
@@ -565,25 +565,25 @@
         """
         return Uid(self.readInteger(length + 1))
     
-    def getSizedInteger(self, data, bytes):
+    def getSizedInteger(self, data, length):
         """
         Public method to read an integer of a specific size.
         
         @param data data to extract the integer from (bytes)
-        @param bytes length of the integer (integer)
+        @param length length of the integer (integer)
         @return read integer (integer)
         @exception InvalidPlistException raised to indicate an invalid
             plist file
         """
         result = 0
         # 1, 2, and 4 byte integers are unsigned
-        if bytes == 1:
+        if length == 1:
             result = unpack('>B', data)[0]
-        elif bytes == 2:
+        elif length == 2:
             result = unpack('>H', data)[0]
-        elif bytes == 4:
+        elif length == 4:
             result = unpack('>L', data)[0]
-        elif bytes == 8:
+        elif length == 8:
             result = unpack('>q', data)[0]
         else:
             raise InvalidPlistException(
@@ -762,7 +762,7 @@
                 n.append(self.wrapRoot(value))
             return HashableWrapper(n)
         elif isinstance(root, tuple):
-            n = tuple([self.wrapRoot(value) for value in root])
+            n = tuple(self.wrapRoot(value) for value in root)
             return HashableWrapper(n)
         else:
             return root
@@ -901,13 +901,13 @@
             position the object was written to shall be recorded (boolean)
         @return new output
         """
-        def proc_variable_length(format, length):
+        def proc_variable_length(formatNibble, length):
             result = ''
             if length > 0b1110:
-                result += pack('!B', (format << 4) | 0b1111)
+                result += pack('!B', (formatNibble << 4) | 0b1111)
                 result = self.writeObject(length, result)
             else:
-                result += pack('!B', (format << 4) | length)
+                result += pack('!B', (formatNibble << 4) | length)
             return result
         
         if setReferencePosition:
@@ -925,8 +925,8 @@
             output += pack('!B', (0b1000 << 4) | size - 1)
             output += self.binaryInt(obj)
         elif isinstance(obj, int):
-            bytes = self.intSize(obj)
-            root = math.log(bytes, 2)
+            length = self.intSize(obj)
+            root = math.log(length, 2)
             output += pack('!B', (0b0001 << 4) | int(root))
             output += self.binaryInt(obj)
         elif isinstance(obj, float):
@@ -943,9 +943,9 @@
             output += obj
         elif isinstance(obj, str):
             # Python 3 uses unicode strings only
-            bytes = obj.encode('utf_16_be')
-            output += proc_variable_length(0b0110, len(bytes) / 2)
-            output += bytes
+            length = obj.encode('utf_16_be')
+            output += proc_variable_length(0b0110, len(length) / 2)
+            output += length
         elif isinstance(obj, HashableWrapper):
             obj = obj.value
             if isinstance(obj, (set, list, tuple)):
@@ -1016,26 +1016,26 @@
         result = pack('>d', obj)
         return result
     
-    def binaryInt(self, obj, bytes=None):
+    def binaryInt(self, obj, length=None):
         """
         Public method to pack an integer object.
         
         @param obj integer to be packed
-        @param bytes length the integer should be packed into (integer)
+        @param length length the integer should be packed into (integer)
         @return serialized object (bytes)
         @exception InvalidPlistException raised to indicate an invalid
             plist file
         """
         result = ''
-        if bytes is None:
-            bytes = self.intSize(obj)
-        if bytes == 1:
+        if length is None:
+            length = self.intSize(obj)
+        if length == 1:
             result += pack('>B', obj)
-        elif bytes == 2:
+        elif length == 2:
             result += pack('>H', obj)
-        elif bytes == 4:
+        elif length == 4:
             result += pack('>L', obj)
-        elif bytes == 8:
+        elif length == 8:
             result += pack('>q', obj)
         else:
             raise InvalidPlistException(
--- a/Utilities/crypto/__init__.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/crypto/__init__.py	Sat Mar 11 18:08:42 2017 +0100
@@ -120,8 +120,8 @@
         masterPW = pwDecode(MasterPassword)
     
     from .py3PBKDF2 import hashPasswordTuple
-    digestname, iterations, salt, hash = hashPasswordTuple(masterPW)
-    key = hash[:32]
+    digestname, iterations, salt, pwHash = hashPasswordTuple(masterPW)
+    key = pwHash[:32]
     from .py3AES import encryptData
     try:
         cipher = encryptData(key, pw.encode("utf-8"))
@@ -273,9 +273,9 @@
     from .py3AES import encryptData
     from .py3PBKDF2 import hashPasswordTuple
     
-    digestname, iterations, salt, hash = \
+    digestname, iterations, salt, pwHash = \
         hashPasswordTuple(password, iterations=hashIterations)
-    key = hash[:keyLength]
+    key = pwHash[:keyLength]
     try:
         cipher = encryptData(key, data)
     except ValueError:
--- a/Utilities/crypto/py3AES.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/crypto/py3AES.py	Sat Mar 11 18:08:42 2017 +0100
@@ -608,11 +608,11 @@
         "CBC": 2,
     }
 
-    def __extractBytes(self, input, start, end, mode):
+    def __extractBytes(self, inputData, start, end, mode):
         """
         Private method to extract a range of bytes from the input.
         
-        @param input input data (bytes)
+        @param inputData input data (bytes)
         @param start start index (integer)
         @param end end index (integer)
         @param mode mode of operation (0, 1, 2)
@@ -630,21 +630,21 @@
         while len(ar) < end - start:
             ar.append(0)
         while i < end:
-            ar[j] = input[i]
+            ar[j] = inputData[i]
             j += 1
             i += 1
         return ar
 
-    def encrypt(self, input, mode, key, size, IV):
+    def encrypt(self, inputData, mode, key, size, IV):
         """
         Public method to perform the encryption operation.
         
-        @param input data to be encrypted (bytes)
+        @param inputData data to be encrypted (bytes)
         @param mode mode of operation (0, 1 or 2)
         @param key key to be used (bytes)
         @param size length of the key (16, 24 or 32)
         @param IV initialisation vector (bytearray)
-        @return tuple with mode of operation, length of the input and
+        @return tuple with mode of operation, length of the input data and
             the encrypted data (integer, integer, bytes)
         @exception ValueError key size is invalid or decrypted data is invalid
         """
@@ -661,13 +661,13 @@
         cipherOut = bytearray()
         # char firstRound
         firstRound = True
-        if input:
-            for j in range(int(math.ceil(float(len(input)) / 16))):
+        if inputData:
+            for j in range(int(math.ceil(float(len(inputData)) / 16))):
                 start = j * 16
                 end = j * 16 + 16
-                if end > len(input):
-                    end = len(input)
-                plaintext = self.__extractBytes(input, start, end, mode)
+                if end > len(inputData):
+                    end = len(inputData)
+                plaintext = self.__extractBytes(inputData, start, end, mode)
                 if mode == self.ModeOfOperation["CFB"]:
                     if firstRound:
                         output = self.aes.encrypt(IV, key, size)
@@ -715,7 +715,7 @@
                     # always 16 bytes because of the padding for CBC
                     for k in range(16):
                         cipherOut.append(ciphertext[k])
-        return mode, len(input), bytes(cipherOut)
+        return mode, len(inputData), bytes(cipherOut)
 
     # Mode of Operation Decryption
     # cipherIn - Encrypted String
--- a/Utilities/crypto/py3PBKDF2.py	Sat Mar 11 14:35:22 2017 +0100
+++ b/Utilities/crypto/py3PBKDF2.py	Sat Mar 11 18:08:42 2017 +0100
@@ -36,10 +36,10 @@
     @param digestMod hash function
     @return hashed password (bytes)
     """
-    hash = password
+    pwHash = password
     for i in range(iterations):
-        hash = hmac.new(salt, hash, digestMod).digest()
-    return hash
+        pwHash = hmac.new(salt, pwHash, digestMod).digest()
+    return pwHash
 
 
 def hashPasswordTuple(password, digestMod=hashlib.sha512, iterations=10000,
@@ -56,9 +56,9 @@
     """
     salt = os.urandom(saltSize)
     password = password.encode("utf-8")
-    hash = pbkdf2(password, salt, iterations, digestMod)
+    pwHash = pbkdf2(password, salt, iterations, digestMod)
     digestname = digestMod.__name__.replace("openssl_", "")
-    return digestname, iterations, salt, hash
+    return digestname, iterations, salt, pwHash
 
 
 def hashPassword(password, digestMod=hashlib.sha512, iterations=10000,
@@ -72,22 +72,22 @@
     @param saltSize size of the salt (integer)
     @return hashed password entry according to PBKDF2 specification (string)
     """
-    digestname, iterations, salt, hash = \
+    digestname, iterations, salt, pwHash = \
         hashPasswordTuple(password, digestMod, iterations, saltSize)
     return Delimiter.join([
         digestname,
         str(iterations),
         base64.b64encode(salt).decode("ascii"),
-        base64.b64encode(hash).decode("ascii")
+        base64.b64encode(pwHash).decode("ascii")
     ])
 
 
-def verifyPassword(password, hash):
+def verifyPassword(password, pwHash):
     """
     Module function to verify a password against a hash encoded password.
     
     @param password clear text password (string)
-    @param hash hash encoded password in the form
+    @param pwHash hash encoded password in the form
         'digestmod$iterations$salt$hashed_password' as produced by the
         hashPassword function (string)
     @return flag indicating a successfull verification (boolean)
@@ -95,7 +95,7 @@
         digest is not one of the known ones
     """
     try:
-        digestname, iterations, salt, pwHash = hash.split(Delimiter)
+        digestname, iterations, salt, pwHash = pwHash.split(Delimiter)
     except ValueError:
         raise ValueError(
             "Expected hash encoded password in format "
@@ -105,7 +105,7 @@
     if digestname not in Hashes.keys():
         raise ValueError(
             "Unsupported hash algorithm '{0}' for hash encoded password '{1}'."
-            .format(digestname, hash))
+            .format(digestname, pwHash))
     
     iterations = int(iterations)
     salt = base64.b64decode(salt.encode("ascii"))
@@ -135,7 +135,7 @@
     if digestname not in Hashes.keys():
         raise ValueError(
             "Unsupported hash algorithm '{0}' for hash parameters '{1}'."
-            .format(digestname, hash))
+            .format(digestname, hashParameters))
     
     iterations = int(iterations)
     salt = base64.b64decode(salt.encode("ascii"))

eric ide

mercurial