clean-up: fix PEP8 E225 missing whitespace around operator
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Tue, 15 Aug 2017 16:48:49 +0300
changeset 1742 92932cd370a4
parent 1741 dd94b9a68c61
child 1743 c3c3d1318130
clean-up: fix PEP8 E225 missing whitespace around operator
BeremizIDE.py
Beremiz_service.py
ConfigTreeNode.py
IDEFrame.py
PLCGenerator.py
PLCOpenEditor.py
ProjectController.py
canfestival/canfestival.py
canfestival/config_utils.py
controls/FolderTree.py
controls/LibraryPanel.py
controls/LogViewer.py
controls/PouInstanceVariablesPanel.py
controls/VariablePanel.py
dialogs/ArrayTypeDialog.py
dialogs/BrowseLocationsDialog.py
dialogs/DiscoveryDialog.py
dialogs/ForceVariableDialog.py
editors/ConfTreeNodeEditor.py
editors/DataTypeEditor.py
editors/DebugViewer.py
editors/ResourceEditor.py
editors/SFCViewer.py
editors/TextViewer.py
graphics/GraphicCommons.py
i18n/mki18n.py
plcopen/plcopen.py
plcopen/structures.py
py_ext/PythonFileCTNMixin.py
runtime/PLCObject.py
runtime/ServicePublisher.py
svgui/pyjs/build.py
svgui/pyjs/jsonrpc/jsonrpc.py
svgui/pyjs/jsonrpc/web2py/jsonrpc.py
svgui/pyjs/pyjs.py
svgui/svgui.py
targets/Xenomai/__init__.py
targets/toolchain_gcc.py
targets/toolchain_makefile.py
targets/typemapping.py
util/ProcessLogger.py
util/misc.py
version.py
wxglade_hmi/wxglade_hmi.py
--- a/BeremizIDE.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/BeremizIDE.py	Tue Aug 15 16:48:49 2017 +0300
@@ -115,7 +115,7 @@
             self.TimerAccessLock.acquire()
             if self.LastRefreshTimer:
                 self.LastRefreshTimer.cancel()
-                self.LastRefreshTimer=None
+                self.LastRefreshTimer = None
             self.TimerAccessLock.release()
             if current_time - self.LastRefreshTime > REFRESH_PERIOD and self.RefreshLock.acquire(False):
                 self._should_write()
@@ -148,7 +148,7 @@
             self.output.Freeze()
             self.lock.acquire()
             for s, style in self.stack:
-                if style is None: style=self.black_white
+                if style is None: style = self.black_white
                 if style != self.black_white:
                     self.output.StartStyling(self.output.GetLength(), 0xff)
 
@@ -284,7 +284,7 @@
         self._RecursiveAddMenuItems(parent, GetAddMenuItems())
 
     def _init_coll_HelpMenu_Items(self, parent):
-        handler=lambda event: {
+        handler = lambda event: {
             wx.MessageBox(version.GetCommunityHelpMsg(), _(u'Community support'), wx.OK | wx.ICON_INFORMATION)
         }
         id = wx.NewId()
@@ -877,7 +877,7 @@
         except:
             defaultpath = os.path.expanduser("~")
 
-        dialog = wx.DirDialog(self, _("Choose a project"), defaultpath, style=wx.DEFAULT_DIALOG_STYLE|
+        dialog = wx.DirDialog(self, _("Choose a project"), defaultpath, style=wx.DEFAULT_DIALOG_STYLE |
                                                                                wx.RESIZE_BORDER)
         if dialog.ShowModal() == wx.ID_OK:
             self.OpenProject(dialog.GetPath())
--- a/Beremiz_service.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/Beremiz_service.py	Tue Aug 15 16:48:49 2017 +0300
@@ -67,7 +67,7 @@
 enabletwisted = True
 havetwisted = False
 
-extensions=[]
+extensions = []
 
 for o, a in opts:
     if o == "-h":
@@ -111,7 +111,7 @@
     os.chdir(WorkingDir)
 elif len(argv) == 0:
     WorkingDir = os.getcwd()
-    argv=[WorkingDir]
+    argv = [WorkingDir]
 
 import __builtin__
 if __name__ == '__main__':
@@ -264,7 +264,7 @@
                 menu = wx.Menu()
                 menu.Append(self.TBMENU_START, _("Start PLC"))
                 menu.Append(self.TBMENU_STOP, _("Stop PLC"))
-                if self.level==1:
+                if self.level == 1:
                     menu.AppendSeparator()
                     menu.Append(self.TBMENU_CHANGE_NAME, _("Change Name"))
                     menu.Append(self.TBMENU_CHANGE_INTERFACE, _("Change IP of interface to bind"))
@@ -382,9 +382,9 @@
 
 def default_evaluator(tocall, *args, **kwargs):
     try:
-        res=(tocall(*args, **kwargs), None)
+        res = (tocall(*args, **kwargs), None)
     except Exception:
-        res=(None, sys.exc_info())
+        res = (None, sys.exc_info())
     return res
 
 
@@ -423,7 +423,7 @@
 
     def Start(self):
         pyro.initServer()
-        self.daemon=pyro.Daemon(host=self.ip_addr, port=self.port)
+        self.daemon = pyro.Daemon(host=self.ip_addr, port=self.port)
         self.plcobj = PLCObject(self.workdir, self.daemon, self.argv,
                                 self.statuschange, self.evaluator,
                                 self.pyruntimevars)
@@ -511,7 +511,7 @@
             # avoid dead lock if called from the wx mainloop
             return default_evaluator(tocall, *args, **kwargs)
         else:
-            o=type('', (object,), dict(call=(tocall, args, kwargs), res=None))
+            o = type('', (object,), dict(call=(tocall, args, kwargs), res=None))
             wx.CallAfter(wx_evaluator, o)
             wx_eval_lock.acquire()
             return o.res
@@ -598,7 +598,7 @@
 
 
 if havetwisted or havewx:
-    pyro_thread=Thread(target=pyroserver.Loop)
+    pyro_thread = Thread(target=pyroserver.Loop)
     pyro_thread.start()
 
     if havetwisted:
--- a/ConfigTreeNode.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/ConfigTreeNode.py	Tue Aug 15 16:48:49 2017 +0300
@@ -276,19 +276,19 @@
         # confnode asks for some LDFLAGS
         if CTNLDFLAGS:
             # LDFLAGS can be either string
-            if type(CTNLDFLAGS)==type(str()):
-                LDFLAGS=[CTNLDFLAGS]
+            if type(CTNLDFLAGS) == type(str()):
+                LDFLAGS = [CTNLDFLAGS]
             # or list of strings
-            elif type(CTNLDFLAGS)==type(list()):
-                LDFLAGS=CTNLDFLAGS[:]
+            elif type(CTNLDFLAGS) == type(list()):
+                LDFLAGS = CTNLDFLAGS[:]
         else:
-            LDFLAGS=[]
+            LDFLAGS = []
 
         # recurse through all children, and stack their results
         for CTNChild in self.IECSortedChildren():
             new_location = CTNChild.GetCurrentLocation()
             # How deep are we in the tree ?
-            depth=len(new_location)
+            depth = len(new_location)
             _LocationCFilesAndCFLAGS, _LDFLAGS, _extra_files = \
                 CTNChild._Generate_C(
                     # keep the same path
@@ -397,7 +397,7 @@
         # Do nothing if no change
         #if CurrentName == DesiredName: return CurrentName
         # Build a list of used Name out of parent's Children
-        AllNames=[]
+        AllNames = []
         for CTNInstance in self.CTNParent.IterChildren():
             if CTNInstance != self:
                 AllNames.append(CTNInstance.BaseParams.getName())
@@ -429,7 +429,7 @@
         return res
 
     def GetAllChannels(self):
-        AllChannels=[]
+        AllChannels = []
         for CTNInstance in self.CTNParent.IterChildren():
             if CTNInstance != self:
                 AllChannels.append(CTNInstance.BaseParams.getIEC_Channel())
--- a/IDEFrame.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/IDEFrame.py	Tue Aug 15 16:48:49 2017 +0300
@@ -509,8 +509,8 @@
         self.Panes = {}
 
         self.LeftNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORLEFTNOTEBOOK,
-              style=wx.aui.AUI_NB_TOP|wx.aui.AUI_NB_TAB_SPLIT|wx.aui.AUI_NB_TAB_MOVE|
-                    wx.aui.AUI_NB_SCROLL_BUTTONS|wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+              style=wx.aui.AUI_NB_TOP | wx.aui.AUI_NB_TAB_SPLIT | wx.aui.AUI_NB_TAB_MOVE |
+                    wx.aui.AUI_NB_SCROLL_BUTTONS | wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
         self.LeftNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND,
                 self.OnAllowNotebookDnD)
         self.AUIManager.AddPane(self.LeftNoteBook,
@@ -519,8 +519,8 @@
               BestSize(wx.Size(300, 500)).CloseButton(False))
 
         self.BottomNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORBOTTOMNOTEBOOK,
-              style=wx.aui.AUI_NB_TOP|wx.aui.AUI_NB_TAB_SPLIT|wx.aui.AUI_NB_TAB_MOVE|
-                    wx.aui.AUI_NB_SCROLL_BUTTONS|wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+              style=wx.aui.AUI_NB_TOP | wx.aui.AUI_NB_TAB_SPLIT | wx.aui.AUI_NB_TAB_MOVE |
+                    wx.aui.AUI_NB_SCROLL_BUTTONS | wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
         self.BottomNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND,
                 self.OnAllowNotebookDnD)
         self.AUIManager.AddPane(self.BottomNoteBook,
@@ -529,8 +529,8 @@
               BestSize(wx.Size(800, 300)).CloseButton(False))
 
         self.RightNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORRIGHTNOTEBOOK,
-              style=wx.aui.AUI_NB_TOP|wx.aui.AUI_NB_TAB_SPLIT|wx.aui.AUI_NB_TAB_MOVE|
-                    wx.aui.AUI_NB_SCROLL_BUTTONS|wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+              style=wx.aui.AUI_NB_TOP | wx.aui.AUI_NB_TAB_SPLIT | wx.aui.AUI_NB_TAB_MOVE |
+                    wx.aui.AUI_NB_SCROLL_BUTTONS | wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
         self.RightNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND,
                 self.OnAllowNotebookDnD)
         self.AUIManager.AddPane(self.RightNoteBook,
@@ -539,7 +539,7 @@
               BestSize(wx.Size(250, 400)).CloseButton(False))
 
         self.TabsOpened = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORTABSOPENED,
-              style=wx.aui.AUI_NB_DEFAULT_STYLE|wx.aui.AUI_NB_WINDOWLIST_BUTTON)
+              style=wx.aui.AUI_NB_DEFAULT_STYLE | wx.aui.AUI_NB_WINDOWLIST_BUTTON)
         self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGING,
               self.OnPouSelectedChanging)
         self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED,
--- a/PLCGenerator.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/PLCGenerator.py	Tue Aug 15 16:48:49 2017 +0300
@@ -401,7 +401,7 @@
                           format(a1 = task.getname(), a2 = config_name, a3 = resource.getname())
                     raise PLCGenException, msg
 
-                if single[0]=='[' and single[-1]==']':
+                if single[0] == '[' and single[-1] == ']':
                     SNGLKW = "MULTI"
                 else:
                     SNGLKW = "SINGLE"
--- a/PLCOpenEditor.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/PLCOpenEditor.py	Tue Aug 15 16:48:49 2017 +0300
@@ -106,7 +106,7 @@
 
     def _init_coll_FileMenu_Items(self, parent):
         AppendMenu(parent, help='', id=wx.ID_NEW,
-              kind=wx.ITEM_NORMAL, text=_(u'New') +'\tCTRL+N')
+              kind=wx.ITEM_NORMAL, text=_(u'New') + '\tCTRL+N')
         AppendMenu(parent, help='', id=wx.ID_OPEN,
               kind=wx.ITEM_NORMAL, text=_(u'Open') + '\tCTRL+O')
         AppendMenu(parent, help='', id=wx.ID_CLOSE,
@@ -162,7 +162,7 @@
         #AppendMenu(parent, help='', id=wx.ID_HELP_CONTEXT,
         #      kind=wx.ITEM_NORMAL, text=u'IEC 61131-3\tF3')
 
-        handler=lambda event: {
+        handler = lambda event: {
             wx.MessageBox(version.GetCommunityHelpMsg(), _(u'Community support'), wx.OK | wx.ICON_INFORMATION)
         }
         id = wx.NewId()
--- a/ProjectController.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/ProjectController.py	Tue Aug 15 16:48:49 2017 +0300
@@ -101,7 +101,7 @@
         self.ieclib_c_path = self.findLibCPath()
 
     def findObject(self, paths, test):
-        path=None
+        path = None
         for p in paths:
             if test(p):
                 path = p
@@ -109,20 +109,20 @@
         return path
 
     def findCmd(self):
-        cmd="iec2c"+(".exe" if wx.Platform == '__WXMSW__' else "")
-        paths=[
+        cmd = "iec2c"+(".exe" if wx.Platform == '__WXMSW__' else "")
+        paths = [
             os.path.join(base_folder, "matiec")
         ]
         path = self.findObject(paths, lambda p: os.path.isfile(os.path.join(p, cmd)))
 
         # otherwise use iec2c from PATH
         if path is not None:
-            cmd=os.path.join(path, cmd)
+            cmd = os.path.join(path, cmd)
 
         return cmd
 
     def findLibPath(self):
-        paths=[
+        paths = [
             os.path.join(base_folder, "matiec", "lib"),
             "/usr/lib/matiec"
         ]
@@ -130,8 +130,8 @@
         return path
 
     def findLibCPath(self):
-        path=None
-        paths=[
+        path = None
+        paths = [
             os.path.join(self.ieclib_path, "C"),
             self.ieclib_path]
         path = self.findObject(paths, lambda p: os.path.isfile(os.path.join(p, "iec_types.h")))
@@ -139,7 +139,7 @@
 
     def findSupportedOptions(self):
         buildcmd = "\"%s\" -h" % (self.getCmd())
-        options =["-f", "-l", "-p"]
+        options = ["-f", "-l", "-p"]
 
         buildopt = ""
         try:
@@ -204,12 +204,12 @@
             </xsd:element>"""+(("""
             <xsd:element name="Libraries" minOccurs="0">
               <xsd:complexType>
-              """+"\n".join(['<xsd:attribute name='+
-                             '"Enable_'+ libname + '_Library" '+
+              """+"\n".join(['<xsd:attribute name=' +
+                             '"Enable_' + libname + '_Library" ' +
                              'type="xsd:boolean" use="optional" default="true"/>'
                              for libname, lib in features.libraries])+"""
               </xsd:complexType>
-            </xsd:element>""") if len(features.libraries)>0 else '') + """
+            </xsd:element>""") if len(features.libraries) > 0 else '') + """
           </xsd:sequence>
           <xsd:attribute name="URI_location" type="xsd:string" use="optional" default=""/>
           <xsd:attribute name="Disable_Extensions" type="xsd:boolean" use="optional" default="false"/>
@@ -234,7 +234,7 @@
         self.IECdebug_datas = {}
         self.IECdebug_lock = Lock()
 
-        self.DebugTimer=None
+        self.DebugTimer = None
         self.ResetIECProgramsAndVariables()
 
         # In both new or load scenario, no need to save
@@ -261,7 +261,7 @@
 
     def LoadLibraries(self):
         self.Libraries = []
-        TypeStack=[]
+        TypeStack = []
         for libname, clsname in features.libraries:
             if self.BeremizRoot.Libraries is None or getattr(self.BeremizRoot.Libraries, "Enable_"+libname+"_Library"):
                 Lib = GetClassImporter(clsname)()(self, libname, TypeStack)
@@ -568,16 +568,16 @@
         return "\n".join([ lib.GetSTCode() for lib in self.Libraries ])
 
     def GetLibrariesCCode(self, buildpath):
-        if len(self.Libraries)==0:
+        if len(self.Libraries) == 0:
             return [], [], ()
         self.GetIECProgramsAndVariables()
         LibIECCflags = '"-I%s" -Wno-unused-function' % os.path.abspath(self.GetIECLibPath())
-        LocatedCCodeAndFlags=[]
-        Extras=[]
+        LocatedCCodeAndFlags = []
+        Extras = []
         for lib in self.Libraries:
-            res=lib.Generate_C(buildpath, self._VariablesList, LibIECCflags)
+            res = lib.Generate_C(buildpath, self._VariablesList, LibIECCflags)
             LocatedCCodeAndFlags.append(res[:2])
-            if len(res)>2:
+            if len(res) > 2:
                 Extras.extend(res[2:])
         return map(list, zip(*LocatedCCodeAndFlags))+[tuple(Extras)]
 
@@ -788,7 +788,7 @@
             return False
 
         # Now extract C files of stdout
-        C_files = [ fname for fname in result.splitlines() if fname[-2:]==".c" or fname[-2:]==".C" ]
+        C_files = [ fname for fname in result.splitlines() if fname[-2:] == ".c" or fname[-2:] == ".C" ]
         # remove those that are not to be compiled because included by others
         C_files.remove("POUS.c")
         if not C_files:
@@ -798,7 +798,7 @@
         C_files = map(lambda filename: os.path.join(buildpath, filename), C_files)
 
         # prepend beremiz include to configuration header
-        H_files = [ fname for fname in result.splitlines() if fname[-2:]==".h" or fname[-2:]==".H" ]
+        H_files = [ fname for fname in result.splitlines() if fname[-2:] == ".h" or fname[-2:] == ".H" ]
         H_files.remove("LOCATED_VARIABLES.h")
         H_files = map(lambda filename: os.path.join(buildpath, filename), H_files)
         for H_file in H_files:
@@ -829,13 +829,13 @@
         return self._builder
 
     def ResetBuildMD5(self):
-        builder=self.GetBuilder()
+        builder = self.GetBuilder()
         if builder is not None:
             builder.ResetBinaryCodeMD5()
         self.EnableMethod("_Transfer", False)
 
     def GetLastBuildMD5(self):
-        builder=self.GetBuilder()
+        builder = self.GetBuilder()
         if builder is not None:
             return builder.GetBinaryCodeMD5()
         else:
@@ -933,12 +933,12 @@
                         # Push this dictionnary into result.
                         self._DbgVariablesList.append(attrs)
                         # Fill in IEC<->C translation dicts
-                        IEC_path=attrs["IEC_path"]
-                        self._IECPathToIdx[IEC_path]=(Idx, attrs["type"])
+                        IEC_path = attrs["IEC_path"]
+                        self._IECPathToIdx[IEC_path] = (Idx, attrs["type"])
                         # Ignores numbers given in CSV file
                         # Idx=int(attrs["num"])
                         # Count variables only, ignore FBs
-                        Idx+=1
+                        Idx += 1
                     self._VariablesList.append(attrs)
 
                 # third section contains ticktime
@@ -965,7 +965,7 @@
         for v in self._DbgVariablesList:
             sz = DebugTypesSize.get(v["type"], 0)
             variable_decl_array += [
-                "{&(%(C_path)s), " % v+
+                "{&(%(C_path)s), " % v +
                 {
                     "EXT": "%(type)s_P_ENUM",
                     "IN":  "%(type)s_P_ENUM",
@@ -988,7 +988,7 @@
                   "VAR": "extern __IEC_%(type)s_t %(C_path)s;",
                   "FB":  "extern       %(type)s   %(C_path)s;"
               }[v["vartype"]] % v
-               for v in self._VariablesList if v["C_path"].find('.')<0]),
+               for v in self._VariablesList if v["C_path"].find('.') < 0]),
            "variable_decl_array": ",\n".join(variable_decl_array)
            }
 
@@ -1008,21 +1008,21 @@
         if not self.BeremizRoot.getDisable_Extensions():
             plc_main_code = targets.GetCode("plc_main_head.c") % {
                 "calls_prototypes": "\n".join([(
-                      "int __init_%(s)s(int argc,char **argv);\n"+
-                      "void __cleanup_%(s)s(void);\n"+
-                      "void __retrieve_%(s)s(void);\n"+
+                      "int __init_%(s)s(int argc,char **argv);\n" +
+                      "void __cleanup_%(s)s(void);\n" +
+                      "void __retrieve_%(s)s(void);\n" +
                       "void __publish_%(s)s(void);") % {'s': locstr} for locstr in locstrs]),
                 "retrieve_calls": "\n    ".join([
                       "__retrieve_%s();" % locstr for locstr in locstrs]),
                 "publish_calls": "\n    ".join([  # Call publish in reverse order
                       "__publish_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]),
                 "init_calls": "\n    ".join([
-                      "init_level=%d; " % (i+1)+
+                      "init_level=%d; " % (i+1) +
                       "if((res = __init_%s(argc,argv))){" % locstr +
                       #"printf(\"%s\"); "%locstr + #for debug
                       "return res;}" for i, locstr in enumerate(locstrs)]),
                 "cleanup_calls": "\n    ".join([
-                      "if(init_level >= %d) " % i+
+                      "if(init_level >= %d) " % i +
                       "__cleanup_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)])
                 }
         else:
@@ -1395,7 +1395,7 @@
         return ticks, buffers
 
     def RegisterDebugVarToConnector(self):
-        self.DebugTimer=None
+        self.DebugTimer = None
         Idxs = []
         self.TracedIECPath = []
         self.TracedIECTypes = []
@@ -1446,7 +1446,7 @@
         if self.IsPLCStarted():
             # Timer to prevent rapid-fire when registering many variables
             # use wx.CallAfter use keep using same thread. TODO : use wx.Timer instead
-            self.DebugTimer=Timer(0.5, wx.CallAfter, args = [self.RegisterDebugVarToConnector])
+            self.DebugTimer = Timer(0.5, wx.CallAfter, args = [self.RegisterDebugVarToConnector])
             # Rearm anti-rapid-fire timer
             self.DebugTimer.start()
 
@@ -1477,7 +1477,7 @@
         else:
             IECdebug_data[4] |= buffer_list
 
-        IECdebug_data[0][callableobj]=buffer_list
+        IECdebug_data[0][callableobj] = buffer_list
 
         self.IECdebug_lock.release()
 
@@ -1908,19 +1908,19 @@
 
     def EnableMethod(self, method, value):
         for d in self.StatusMethods:
-            if d["method"]==method:
-                d["enabled"]=value
+            if d["method"] == method:
+                d["enabled"] = value
                 return True
         return False
 
     def ShowMethod(self, method, value):
         for d in self.StatusMethods:
-            if d["method"]==method:
-                d["shown"]=value
+            if d["method"] == method:
+                d["shown"] = value
                 return True
         return False
 
     def CallMethod(self, method):
         for d in self.StatusMethods:
-            if d["method"]==method and d.get("enabled", True) and d.get("shown", True):
+            if d["method"] == method and d.get("enabled", True) and d.get("shown", True):
                 getattr(self, method)()
--- a/canfestival/canfestival.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/canfestival/canfestival.py	Tue Aug 15 16:48:49 2017 +0300
@@ -551,32 +551,32 @@
                         "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){}\n" % (nodename))
                 else:
                     format_dict["slavebootups"] += (
-                        "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){\n" % (nodename)+
-                        "    check_and_start_node(d, nodeId);\n"+
+                        "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){\n" % (nodename) +
+                        "    check_and_start_node(d, nodeId);\n" +
                         "}\n")
                 # register previously declared func as post_SlaveBootup callback for that node
                 format_dict["slavebootup_register"] += (
                     "%s_Data.post_SlaveBootup = %s_post_SlaveBootup;\n" % (nodename, nodename))
                 format_dict["pre_op"] += (
-                    "static void %s_preOperational(CO_Data* d){\n    " % (nodename)+
-                    "".join(["    masterSendNMTstateChange(d, %d, NMT_Reset_Comunication);\n" % NdId for NdId in SlaveIDs])+
+                    "static void %s_preOperational(CO_Data* d){\n    " % (nodename) +
+                    "".join(["    masterSendNMTstateChange(d, %d, NMT_Reset_Comunication);\n" % NdId for NdId in SlaveIDs]) +
                     "}\n")
                 format_dict["pre_op_register"] += (
                     "%s_Data.preOperational = %s_preOperational;\n" % (nodename, nodename))
             else:
                 # Slave node
                 align = child_data.getSync_Align()
-                align_ratio=child_data.getSync_Align_Ratio()
+                align_ratio = child_data.getSync_Align_Ratio()
                 if align > 0:
                     format_dict["post_sync"] += (
-                        "static int %s_CalCount = 0;\n" % (nodename)+
-                        "static void %s_post_sync(CO_Data* d){\n" % (nodename)+
-                        "    if(%s_CalCount < %d){\n" % (nodename, align)+
-                        "        %s_CalCount++;\n" % (nodename)+
-                        "        align_tick(-1);\n"+
-                        "    }else{\n"+
-                        "        align_tick(%d);\n" % (align_ratio)+
-                        "    }\n"+
+                        "static int %s_CalCount = 0;\n" % (nodename) +
+                        "static void %s_post_sync(CO_Data* d){\n" % (nodename) +
+                        "    if(%s_CalCount < %d){\n" % (nodename, align) +
+                        "        %s_CalCount++;\n" % (nodename) +
+                        "        align_tick(-1);\n" +
+                        "    }else{\n" +
+                        "        align_tick(%d);\n" % (align_ratio) +
+                        "    }\n" +
                         "}\n")
                     format_dict["post_sync_register"] += (
                         "%s_Data.post_sync = %s_post_sync;\n" % (nodename, nodename))
--- a/canfestival/config_utils.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/canfestival/config_utils.py	Tue Aug 15 16:48:49 2017 +0300
@@ -134,7 +134,7 @@
     @return: a tuple of value and number of parameters to add to DCF
     """
 
-    dcfdata=[]
+    dcfdata = []
     # Create entry for RPDO or TPDO parameters and Disable PDO
     #           ---- INDEX -----   --- SUBINDEX ----   ----- SIZE ------   ------ DATA ------
     dcfdata += [LE_to_BE(idx, 2) + LE_to_BE(0x01, 1) + LE_to_BE(0x04, 4) + LE_to_BE(0x80000000 + cobid, 4)]
--- a/controls/FolderTree.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/controls/FolderTree.py	Tue Aug 15 16:48:49 2017 +0300
@@ -57,11 +57,11 @@
         main_sizer = wx.BoxSizer(wx.VERTICAL)
 
         self.Tree = wx.TreeCtrl(self,
-              style=wx.TR_HAS_BUTTONS|
-                    wx.TR_SINGLE|
-                    wx.SUNKEN_BORDER|
-                    wx.TR_HIDE_ROOT|
-                    wx.TR_LINES_AT_ROOT|
+              style=wx.TR_HAS_BUTTONS   |
+                    wx.TR_SINGLE        |
+                    wx.SUNKEN_BORDER    |
+                    wx.TR_HIDE_ROOT     |
+                    wx.TR_LINES_AT_ROOT |
                     wx.TR_EDIT_LABELS)
         if wx.Platform == '__WXMSW__':
             self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeItemExpanded, self.Tree)
--- a/controls/LibraryPanel.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/controls/LibraryPanel.py	Tue Aug 15 16:48:49 2017 +0300
@@ -84,10 +84,10 @@
         # window
         self.Tree = wx.TreeCtrl(splitter_window,
               size=wx.Size(0, 0),
-              style=wx.TR_HAS_BUTTONS|
-                    wx.TR_SINGLE|
-                    wx.SUNKEN_BORDER|
-                    wx.TR_HIDE_ROOT|
+              style=wx.TR_HAS_BUTTONS |
+                    wx.TR_SINGLE      |
+                    wx.SUNKEN_BORDER  |
+                    wx.TR_HIDE_ROOT   |
                     wx.TR_LINES_AT_ROOT)
         self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeItemSelected, self.Tree)
         self.Tree.Bind(wx.EVT_CHAR, self.OnKeyDown)
@@ -343,7 +343,7 @@
                 same_inputs = reduce(
                     lambda x, y: x and y,
                     map(
-                        lambda x: x[0]==x[1] or x[0]=='ANY' or x[1]=='ANY',
+                        lambda x: x[0] == x[1] or x[0] == 'ANY' or x[1] == 'ANY',
                         zip(type_inputs,
                             (inputs[:type_extension]
                              if type_extension is not None
--- a/controls/LogViewer.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/controls/LogViewer.py	Tue Aug 15 16:48:49 2017 +0300
@@ -558,10 +558,10 @@
         self.MessageScrollBar.RefreshThumbPosition()
 
     def IsPLCLogEmpty(self):
-        empty=True
+        empty = True
         for level, prev in zip(xrange(LogLevelsCount), self.previous_log_count):
             if prev is not None:
-                empty=False
+                empty = False
                 break
         return empty
 
--- a/controls/PouInstanceVariablesPanel.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/controls/PouInstanceVariablesPanel.py	Tue Aug 15 16:48:49 2017 +0300
@@ -140,11 +140,11 @@
 
         self.VariablesList = CustomTreeCtrlWithRightImage(self,
               style=wx.SUNKEN_BORDER,
-              agwStyle=CT.TR_NO_BUTTONS|
-                       CT.TR_SINGLE|
-                       CT.TR_HAS_VARIABLE_ROW_HEIGHT|
-                       CT.TR_HIDE_ROOT|
-                       CT.TR_NO_LINES|
+              agwStyle=CT.TR_NO_BUTTONS              |
+                       CT.TR_SINGLE                  |
+                       CT.TR_HAS_VARIABLE_ROW_HEIGHT |
+                       CT.TR_HIDE_ROOT               |
+                       CT.TR_NO_LINES                |
                        getattr(CT, "TR_ALIGN_WINDOWS_RIGHT", CT.TR_ALIGN_WINDOWS))
         self.VariablesList.SetIndent(0)
         self.VariablesList.SetSpacing(5)
--- a/controls/VariablePanel.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/controls/VariablePanel.py	Tue Aug 15 16:48:49 2017 +0300
@@ -511,10 +511,10 @@
             l = wx.ALIGN_LEFT
             c = wx.ALIGN_CENTER
 
-            #                      Num   Name    Class   Type    Loc     Init    Option   Doc
-            self.ColSizes       = [40,   80,     100,    80,     110,    120,    100,     160]
-            self.ColAlignements = [c,    l,      l,      l,      l,      l,      l,       l]
-            self.ColFixedSizeFlag=[True, False,  True,   False,  True,   True,   True,    False]
+            #                        Num   Name    Class   Type    Loc     Init    Option   Doc
+            self.ColSizes         = [40,   80,     100,    80,     110,    120,    100,     160]
+            self.ColAlignements   = [c,    l,      l,      l,      l,      l,      l,       l]
+            self.ColFixedSizeFlag = [True, False,  True,   False,  True,   True,   True,    False]
 
         else:
             # this is an element that cannot have located variables
@@ -533,10 +533,10 @@
             l = wx.ALIGN_LEFT
             c = wx.ALIGN_CENTER
 
-            #                      Num   Name    Class   Type    Init    Option   Doc
-            self.ColSizes       = [40,   80,     100,    80,     120,    100,     160]
-            self.ColAlignements = [c,    l,      l,      l,      l,      l,       l]
-            self.ColFixedSizeFlag=[True, False,  True,   False,  True,   True,    False]
+            #                        Num   Name    Class   Type    Init    Option   Doc
+            self.ColSizes         = [40,   80,     100,    80,     120,    100,     160]
+            self.ColAlignements   = [c,    l,      l,      l,      l,      l,       l]
+            self.ColFixedSizeFlag = [True, False,  True,   False,  True,   True,    False]
 
         self.PanelWidthMin = sum(self.ColSizes)
 
--- a/dialogs/ArrayTypeDialog.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/dialogs/ArrayTypeDialog.py	Tue Aug 15 16:48:49 2017 +0300
@@ -59,8 +59,8 @@
         top_sizer.AddWindow(self.BaseType, 1, flag=wx.GROW)
 
         self.Dimensions = CustomEditableListBox(self, label=_("Dimensions:"),
-              style=wx.gizmos.EL_ALLOW_NEW|
-                    wx.gizmos.EL_ALLOW_EDIT|
+              style=wx.gizmos.EL_ALLOW_NEW  |
+                    wx.gizmos.EL_ALLOW_EDIT |
                     wx.gizmos.EL_ALLOW_DELETE)
         for func in ["_OnLabelEndEdit",
                      "_OnAddButton",
--- a/dialogs/BrowseLocationsDialog.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/dialogs/BrowseLocationsDialog.py	Tue Aug 15 16:48:49 2017 +0300
@@ -133,7 +133,7 @@
             ("VAR_INPUT",     LOCATION_VAR_INPUT),
             ("VAR_OUTPUT",    LOCATION_VAR_OUTPUT),
             ("VAR_LOCAL",     LOCATION_VAR_MEMORY)]:
-            self.TreeImageDict[itemtype]=self.TreeImageList.Add(GetBitmap(imgname))
+            self.TreeImageDict[itemtype] = self.TreeImageList.Add(GetBitmap(imgname))
 
         # Assign icon list to TreeCtrls
         self.LocationsTree.SetImageList(self.TreeImageList)
--- a/dialogs/DiscoveryDialog.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/dialogs/DiscoveryDialog.py	Tue Aug 15 16:48:49 2017 +0300
@@ -136,7 +136,7 @@
 
         self.ZeroConfInstance = Zeroconf()
         self.RefreshList()
-        self.LatestSelection=None
+        self.LatestSelection = None
 
     def __del__(self):
         if self.Browser is not None: self.Browser.cancel()
--- a/dialogs/ForceVariableDialog.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/dialogs/ForceVariableDialog.py	Tue Aug 15 16:48:49 2017 +0300
@@ -174,14 +174,14 @@
 
         self.Bind(wx.EVT_BUTTON, self.OnOK,
               self.GetSizer().GetItem(2).GetSizer().GetItem(1).GetSizer().GetAffirmativeButton())
-        self.ValueTextCtrl=self.GetSizer().GetItem(1).GetWindow()
+        self.ValueTextCtrl = self.GetSizer().GetItem(1).GetWindow()
         if self.IEC_Type == "BOOL":
             self.ToggleButton = wx.ToggleButton(self, label=_("Toggle value"))
-            value=GetTypeValue[self.IEC_Type](defaultValue)
+            value = GetTypeValue[self.IEC_Type](defaultValue)
             if value is not None:
                 self.ToggleButton.SetValue(value)
 
-            border=self.GetSizer().GetItem(1).GetBorder()
+            border = self.GetSizer().GetItem(1).GetBorder()
             self.GetSizer().Insert(before=2, item=self.ToggleButton,
                                    border=border,
                                    flag=wx.LEFT|wx.RIGHT|wx.EXPAND)
@@ -190,7 +190,7 @@
         self.Fit()
 
     def ToggleBoolValue(self, event):
-        value=self.ToggleButton.GetValue()
+        value = self.ToggleButton.GetValue()
         self.ValueTextCtrl.SetValue(unicode(value))
 
     def OnOK(self, event):
--- a/editors/ConfTreeNodeEditor.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/editors/ConfTreeNodeEditor.py	Tue Aug 15 16:48:49 2017 +0300
@@ -99,7 +99,7 @@
 
         pos_x = (width-bw)/2+dw      # adjust for bitmap and text to centre
         pos_y = (height-bh-th)/2+dy
-        if bmp !=None:
+        if bmp != None:
             dc.DrawBitmap(bmp, pos_x, pos_y, hasMask)  # draw bitmap if available
             pos_x = (width-tw)/2+dw      # adjust for bitmap and text to centre
             pos_y += bh + 2
@@ -296,8 +296,8 @@
         self.Thaw()
 
     def GenerateMethodButtonSizer(self):
-        normal_bt_font=wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = faces["helv"])
-        mouseover_bt_font=wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, underline=True, faceName = faces["helv"])
+        normal_bt_font    = wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = faces["helv"])
+        mouseover_bt_font = wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = faces["helv"], underline=True)
 
         msizer = wx.BoxSizer(wx.HORIZONTAL)
 
--- a/editors/DataTypeEditor.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/editors/DataTypeEditor.py	Tue Aug 15 16:48:49 2017 +0300
@@ -261,8 +261,8 @@
         enumerated_panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
 
         self.EnumeratedValues = CustomEditableListBox(self.EnumeratedPanel,
-              label=_("Values:"), style=wx.gizmos.EL_ALLOW_NEW|
-                                        wx.gizmos.EL_ALLOW_EDIT|
+              label=_("Values:"), style=wx.gizmos.EL_ALLOW_NEW  |
+                                        wx.gizmos.EL_ALLOW_EDIT |
                                         wx.gizmos.EL_ALLOW_DELETE)
         setattr(self.EnumeratedValues, "_OnLabelEndEdit", self.OnEnumeratedValueEndEdit)
         for func in ["_OnAddButton", "_OnDelButton", "_OnUpButton", "_OnDownButton"]:
@@ -323,8 +323,8 @@
               flag=wx.ALL)
 
         self.ArrayDimensions = CustomEditableListBox(self.ArrayPanel,
-              label=_("Dimensions:"), style=wx.gizmos.EL_ALLOW_NEW|
-                                            wx.gizmos.EL_ALLOW_EDIT|
+              label=_("Dimensions:"), style=wx.gizmos.EL_ALLOW_NEW  |
+                                            wx.gizmos.EL_ALLOW_EDIT |
                                             wx.gizmos.EL_ALLOW_DELETE)
         for func in ["_OnLabelEndEdit", "_OnAddButton", "_OnDelButton",
                      "_OnUpButton", "_OnDownButton"]:
--- a/editors/DebugViewer.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/editors/DebugViewer.py	Tue Aug 15 16:48:49 2017 +0300
@@ -256,7 +256,7 @@
         self.TimerAccessLock.acquire()
         if self.LastRefreshTimer is not None:
             self.LastRefreshTimer.cancel()
-            self.LastRefreshTimer=None
+            self.LastRefreshTimer = None
         self.TimerAccessLock.release()
 
         # Only try to refresh DebugViewer if it is visible on screen and not
--- a/editors/ResourceEditor.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/editors/ResourceEditor.py	Tue Aug 15 16:48:49 2017 +0300
@@ -450,7 +450,7 @@
                 message = _("\"%s\" is not a valid identifier!") % value
             elif value.upper() in IEC_KEYWORDS:
                 message = _("\"%s\" is a keyword. It can't be used!") % value
-            elif value.upper() in [var["Name"].upper() for i, var in enumerate(self.TasksTable.data) if i!=row]:
+            elif value.upper() in [var["Name"].upper() for i, var in enumerate(self.TasksTable.data) if i != row]:
                 message = _("A task with the same name already exists!")
             if message is not None:
                 event.Veto()
@@ -485,7 +485,7 @@
                 message = _("\"%s\" is not a valid identifier!") % value
             elif value.upper() in IEC_KEYWORDS:
                 message = _("\"%s\" is a keyword. It can't be used!") % value
-            elif value.upper() in [var["Name"].upper() for i, var in enumerate(self.InstancesTable.data) if i!=row]:
+            elif value.upper() in [var["Name"].upper() for i, var in enumerate(self.InstancesTable.data) if i != row]:
                 message = _("An instance with the same name already exists!")
             if message is not None:
                 event.Veto()
--- a/editors/SFCViewer.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/editors/SFCViewer.py	Tue Aug 15 16:48:49 2017 +0300
@@ -342,7 +342,7 @@
 
     # This method check the IEC 61131-3 compatibility between two SFC blocks
     def BlockCompatibility(self, startblock = None, endblock = None, direction = None):
-        if startblock!= None and endblock != None and (isinstance(startblock, SFC_Objects)\
+        if startblock != None and endblock != None and (isinstance(startblock, SFC_Objects)\
                                                                or isinstance(endblock, SFC_Objects)):
             # Full "SFC_StandardRules" table would be symmetrical and
             # to avoid duplicate records and minimize the table only upper part is defined.
--- a/editors/TextViewer.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/editors/TextViewer.py	Tue Aug 15 16:48:49 2017 +0300
@@ -138,8 +138,8 @@
         self.Editor.SetTabWidth(2)
         self.Editor.SetUseTabs(0)
 
-        self.Editor.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT|
-                                    wx.stc.STC_MOD_BEFOREDELETE|
+        self.Editor.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT |
+                                    wx.stc.STC_MOD_BEFOREDELETE |
                                     wx.stc.STC_PERFORMED_USER)
 
         self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyleNeeded, id=ID_TEXTVIEWERTEXTCTRL)
--- a/graphics/GraphicCommons.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/graphics/GraphicCommons.py	Tue Aug 15 16:48:49 2017 +0300
@@ -1377,7 +1377,7 @@
     def ConnectionAvailable(self, direction=None, exclude=True):
         wire_nums = len(self.Wires)
 
-        connector_free = (wire_nums<= 0)
+        connector_free = (wire_nums <= 0)
         connector_max_used = ((wire_nums > 0) and self.OneConnected)
         if (self.Parent.CurrentLanguage in ["SFC", "LD"]) and (self.Type == "BOOL"):
             connector_max_used = False;
--- a/i18n/mki18n.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/i18n/mki18n.py	Tue Aug 15 16:48:49 2017 +0300
@@ -88,8 +88,8 @@
 # ----------------
 #
 
-__author__ = "Pierre Rouleau"
-__version__= "$Revision: 1.5 $"
+__author__  = "Pierre Rouleau"
+__version__ = "$Revision: 1.5 $"
 
 # -----------------------------------------------------------------------------
 
@@ -278,7 +278,7 @@
     languageDict = getlanguageDict()
 
     for langCode in languageDict.keys():
-        if (langCode == 'en') and (forceEnglish==0):
+        if (langCode == 'en') and (forceEnglish == 0):
             pass
         else:
             langPOfileName = "%s_%s.po" % (applicationName, langCode)
@@ -383,7 +383,7 @@
    # translate the path separators
    directory = unixpath(directory)
    # build a list of all directory elements
-   aList = filter(lambda x: len(x)>0, directory.split('/'))
+   aList = filter(lambda x: len(x) > 0, directory.split('/'))
    theLen = len(aList)
    # if the first element is a Windows-style disk drive
    # concatenate it with the first directory
--- a/plcopen/plcopen.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/plcopen/plcopen.py	Tue Aug 15 16:48:49 2017 +0300
@@ -139,12 +139,12 @@
     test_result = []
     result = criteria["pattern"].search(text)
     while result is not None:
-        prev_pos=result.endpos
+        prev_pos = result.endpos
         start = TextLenInRowColumn(text[:result.start()])
         end = TextLenInRowColumn(text[:result.end() - 1])
         test_result.append((start, end, "\n".join(lines[start[0]:end[0] + 1])))
         result = criteria["pattern"].search(text, result.end())
-        if result is not None and prev_pos==result.endpos:
+        if result is not None and prev_pos == result.endpos:
             break
     return test_result
 
--- a/plcopen/structures.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/plcopen/structures.py	Tue Aug 15 16:48:49 2017 +0300
@@ -124,7 +124,7 @@
     fields = [True, True]
     while(fields[1]):
         fields = table.pop(0)
-        variable_from_csv = dict([(champ, val) for champ, val in zip(variables, fields[1:]) if champ!=''])
+        variable_from_csv = dict([(champ, val) for champ, val in zip(variables, fields[1:]) if champ != ''])
         standard_funtions_input_variables[variable_from_csv['name']] = variable_from_csv['type']
     return standard_funtions_input_variables
 
--- a/py_ext/PythonFileCTNMixin.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/py_ext/PythonFileCTNMixin.py	Tue Aug 15 16:48:49 2017 +0300
@@ -102,7 +102,7 @@
         varinfos = map(lambda variable: {
                     "name": variable.getname(),
                     "desc": repr(variable.getdesc()),
-                    "onchangecode": '"'+variable.getonchange()+\
+                    "onchangecode": '"'+variable.getonchange() + \
                                          "('"+variable.getname()+"')\"" \
                                      if variable.getonchange() else '""',
                     "onchange": repr(variable.getonchange()) \
@@ -236,7 +236,7 @@
     __SET_VAR(__%(name)s_notifier->,CODE,,__STRING_LITERAL(%(onchangelen)d,%(onchangecode)s));
 """
         vardec = "\n".join([(vardecfmt + vardeconchangefmt
-                             if varinfo["onchange"] else vardecfmt)% varinfo
+                             if varinfo["onchange"] else vardecfmt) % varinfo
                             for varinfo in varinfos])
         varret = "\n".join([varretfmt % varinfo for varinfo in varinfos])
         varpub = "\n".join([(varpubonchangefmt if varinfo["onchange"] else
--- a/runtime/PLCObject.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/runtime/PLCObject.py	Tue Aug 15 16:48:49 2017 +0300
@@ -46,7 +46,7 @@
         tb = tb.tb_next
     return tb
 
-lib_ext ={
+lib_ext = {
      "linux2": ".so",
      "win32":  ".dll",
      }.get(sys.platform, "")
@@ -83,14 +83,14 @@
     def AutoLoad(self):
         # Get the last transfered PLC if connector must be restart
         try:
-            self.CurrentPLCFilename=open(
+            self.CurrentPLCFilename = open(
                              self._GetMD5FileName(),
                              "r").read().strip() + lib_ext
             if self.LoadPLC():
                 self.PLCStatus = "Stopped"
         except Exception, e:
             self.PLCStatus = "Empty"
-            self.CurrentPLCFilename=None
+            self.CurrentPLCFilename = None
 
     def StatusChange(self):
         if self.statuschange is not None:
@@ -112,7 +112,7 @@
     def GetLogCount(self, level):
         if self._GetLogCount is not None:
             return int(self._GetLogCount(level))
-        elif self._loading_error is not None and level==0:
+        elif self._loading_error is not None and level == 0:
             return 1
 
     def GetLogMessage(self, level, msgid):
@@ -129,7 +129,7 @@
             if sz and sz <= maxsz:
                 self._log_read_buffer[sz] = '\x00'
                 return self._log_read_buffer.value, tick.value, tv_sec.value, tv_nsec.value
-        elif self._loading_error is not None and level==0:
+        elif self._loading_error is not None and level == 0:
             return self._loading_error, 0, 0, 0
         return None
 
@@ -329,7 +329,7 @@
     def PythonThreadProc(self):
         self.StartSem.release()
         res, cmd, blkid = "None", "None", ctypes.c_void_p()
-        compile_cache={}
+        compile_cache = {}
         while True:
             # print "_PythonIterator(", res, ")",
             cmd = self._PythonIterator(res, blkid)
@@ -338,19 +338,19 @@
             if cmd is None:
                 break
             try:
-                self.python_runtime_vars["FBID"]=FBID
-                ccmd, AST =compile_cache.get(FBID, (None, None))
-                if ccmd is None or ccmd!=cmd:
+                self.python_runtime_vars["FBID"] = FBID
+                ccmd, AST = compile_cache.get(FBID, (None, None))
+                if ccmd is None or ccmd != cmd:
                     AST = compile(cmd, '<plc>', 'eval')
-                    compile_cache[FBID]=(cmd, AST)
+                    compile_cache[FBID] = (cmd, AST)
                 result, exp = self.evaluator(eval, AST, self.python_runtime_vars)
                 if exp is not None:
                     res = "#EXCEPTION : "+str(exp[1])
                     self.LogMessage(1, ('PyEval@0x%x(Code="%s") Exception "%s"') % (FBID, cmd,
                         '\n'.join(traceback.format_exception(*exp))))
                 else:
-                    res=str(result)
-                self.python_runtime_vars["FBID"]=None
+                    res = str(result)
+                self.python_runtime_vars["FBID"] = None
             except Exception, e:
                 res = "#EXCEPTION : "+str(e)
                 self.LogMessage(1, ('PyEval@0x%x(Code="%s") Exception "%s"') % (FBID, cmd, str(e)))
@@ -364,7 +364,7 @@
                 self.PLCStatus = "Started"
                 self.StatusChange()
                 self.PythonRuntimeCall("start")
-                self.StartSem=Semaphore(0)
+                self.StartSem = Semaphore(0)
                 self.PythonThread = Thread(target=self.PythonThreadProc)
                 self.PythonThread.start()
                 self.StartSem.acquire()
@@ -477,7 +477,7 @@
                 # keep a copy of requested idx
                 self._ResetDebugVariables()
                 for idx, iectype, force in idxs:
-                    if force !=None:
+                    if force != None:
                         c_type, unpack_func, pack_func = \
                             TypeTranslator.get(iectype,
                                                     (None, None, None))
--- a/runtime/ServicePublisher.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/runtime/ServicePublisher.py	Tue Aug 15 16:48:49 2017 +0300
@@ -67,7 +67,7 @@
                                   self.ip_32b,
                                   self.port,
                                   properties = self.serviceproperties))
-        self.retrytimer=None
+        self.retrytimer = None
 
     def UnRegisterService(self):
         if self.retrytimer is not None:
--- a/svgui/pyjs/build.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/svgui/pyjs/build.py	Tue Aug 15 16:48:49 2017 +0300
@@ -45,7 +45,7 @@
 
 
 # .cache.html files produces look like this
-CACHE_HTML_PAT=re.compile('^[a-z]*.[0-9a-f]{32}\.cache\.html$')
+CACHE_HTML_PAT = re.compile('^[a-z]*.[0-9a-f]{32}\.cache\.html$')
 
 # ok these are the three "default" library directories, containing
 # the builtins (str, List, Dict, ord, round, len, range etc.)
@@ -637,7 +637,7 @@
     while deps:
         l_deps = len(deps)
         #print l_deps
-        if l_deps==last_len:
+        if l_deps == last_len:
             for m, dl in deps.items():
                 for d in dl:
                     if m in deps.get(d, []):
--- a/svgui/pyjs/jsonrpc/jsonrpc.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/svgui/pyjs/jsonrpc/jsonrpc.py	Tue Aug 15 16:48:49 2017 +0300
@@ -6,7 +6,7 @@
 class JSONRPCServiceBase:
 
     def __init__(self):
-        self.methods={}
+        self.methods = {}
 
     def response(self, id, result):
         return simplejson.dumps({'version': '1.1', 'id': id,
@@ -28,14 +28,14 @@
         id, method, params = data["id"], data["method"], data["params"]
         if method in self.methods:
             try:
-                result =self.methods[method](*params)
+                result = self.methods[method](*params)
                 return self.response(id, result)
             except BaseException:
                 etype, eval, etb = sys.exc_info()
-                return self.error(id, 100, '%s: %s' %(etype.__name__, eval))
+                return self.error(id, 100, '%s: %s' % (etype.__name__, eval))
             except:
                 etype, eval, etb = sys.exc_info()
-                return self.error(id, 100, 'Exception %s: %s' %(etype, eval))
+                return self.error(id, 100, 'Exception %s: %s' % (etype, eval))
         else:
             return self.error(id, 100, 'method "%s" does not exist' % method)
 
--- a/svgui/pyjs/jsonrpc/web2py/jsonrpc.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/svgui/pyjs/jsonrpc/web2py/jsonrpc.py	Tue Aug 15 16:48:49 2017 +0300
@@ -7,6 +7,6 @@
         return self.process(request.body.read())
 
     def __call__(self, func):
-        self.methods[func.__name__]=func
+        self.methods[func.__name__] = func
         return func
 
--- a/svgui/pyjs/pyjs.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/svgui/pyjs/pyjs.py	Tue Aug 15 16:48:49 2017 +0300
@@ -52,43 +52,43 @@
 
 UU = ""
 
-PYJSLIB_BUILTIN_FUNCTIONS=("cmp",
-                           "map",
-                           "filter",
-                           "dir",
-                           "getattr",
-                           "setattr",
-                           "hasattr",
-                           "int",
-                           "float",
-                           "str",
-                           "repr",
-                           "range",
-                           "len",
-                           "hash",
-                           "abs",
-                           "ord",
-                           "chr",
-                           "enumerate",
-                           "min",
-                           "max",
-                           "bool",
-                           "type",
-                           "isinstance")
-
-PYJSLIB_BUILTIN_CLASSES=("BaseException",
-                         "Exception",
-                         "StandardError",
-                         "StopIteration",
-                         "AttributeError",
-                         "TypeError",
-                         "KeyError",
-                         "LookupError",
-                         "list",
-                         "dict",
-                         "object",
-                         "tuple",
-                        )
+PYJSLIB_BUILTIN_FUNCTIONS = ("cmp",
+                             "map",
+                             "filter",
+                             "dir",
+                             "getattr",
+                             "setattr",
+                             "hasattr",
+                             "int",
+                             "float",
+                             "str",
+                             "repr",
+                             "range",
+                             "len",
+                             "hash",
+                             "abs",
+                             "ord",
+                             "chr",
+                             "enumerate",
+                             "min",
+                             "max",
+                             "bool",
+                             "type",
+                             "isinstance")
+
+PYJSLIB_BUILTIN_CLASSES = ("BaseException",
+                           "Exception",
+                           "StandardError",
+                           "StopIteration",
+                           "AttributeError",
+                           "TypeError",
+                           "KeyError",
+                           "LookupError",
+                           "list",
+                           "dict",
+                           "object",
+                           "tuple",
+)
 
 
 def pyjs_builtin_remap(name):
@@ -106,7 +106,7 @@
 # XXX: this is a hack: these should be dealt with another way
 # however, console is currently the only global name which is causing
 # problems.
-PYJS_GLOBAL_VARS=("console")
+PYJS_GLOBAL_VARS = ("console")
 
 # This is taken from the django project.
 # Escape every ASCII character with a value less than 32.
@@ -404,7 +404,7 @@
 
                 default_name = arg_names[default_pos]
                 print >>self.output, "    if (typeof %s == 'undefined')" % (default_name)
-                print >>self.output, "        %s=__kwargs.%s;"% (default_name, default_name)
+                print >>self.output, "        %s=__kwargs.%s;" % (default_name, default_name)
                 default_pos += 1
 
             #self._default_args_handler(node, arg_names, current_klass)
@@ -714,7 +714,7 @@
         if isinstance(v.expr, ast.Getattr):
             call_name = self._getattr2(v.expr, current_klass, v.attrname + "." + attr_name)
         elif isinstance(v.expr, ast.Name) and v.expr.name in self.module_imports():
-            call_name = UU+v.expr.name + '.__' +v.attrname+".prototype.__class__."+attr_name
+            call_name = UU+v.expr.name + '.__' + v.attrname+".prototype.__class__."+attr_name
         else:
             obj = self.expr(v.expr, current_klass)
             call_name = obj + "." + v.attrname + "." + attr_name
@@ -1747,7 +1747,7 @@
 
 def main():
     import sys
-    if len(sys.argv)<2:
+    if len(sys.argv) < 2:
         print >> sys.stderr, usage % sys.argv[0]
         sys.exit(1)
     file_name = os.path.abspath(sys.argv[1])
--- a/svgui/svgui.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/svgui/svgui.py	Tue Aug 15 16:48:49 2017 +0300
@@ -90,7 +90,7 @@
 
         res = ([], "", False)
 
-        svgfile=self._getSVGpath()
+        svgfile = self._getSVGpath()
         if os.path.exists(svgfile):
             res += (("gui.svg", file(svgfile, "rb")),)
 
@@ -100,7 +100,7 @@
 
         svguilibpath = os.path.join(self._getBuildPath(), "svguilib.js")
         svguilibfile = open(svguilibpath, 'w')
-        fpath=paths.AbsDir(__file__)
+        fpath = paths.AbsDir(__file__)
         svguilibfile.write(translate(os.path.join(fpath, "pyjs", "lib", "sys.py"), "sys"))
         svguilibfile.write(open(os.path.join(fpath, "pyjs", "lib", "_pyjs.js"), 'r').read())
         svguilibfile.write(translate(os.path.join(fpath, "pyjs", "lib", "pyjslib.py"), "pyjslib"))
--- a/targets/Xenomai/__init__.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/targets/Xenomai/__init__.py	Tue Aug 15 16:48:49 2017 +0300
@@ -30,7 +30,7 @@
     extension = ".so"
     def getXenoConfig(self, flagsname):
         """ Get xeno-config from target parameters """
-        xeno_config=self.CTRInstance.GetTarget().getcontent().getXenoConfig()
+        xeno_config = self.CTRInstance.GetTarget().getcontent().getXenoConfig()
         if xeno_config:
             from util.ProcessLogger import ProcessLogger
             status, result, err_result = ProcessLogger(self.CTRInstance.logger,
--- a/targets/toolchain_gcc.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/targets/toolchain_gcc.py	Tue Aug 15 16:48:49 2017 +0300
@@ -186,7 +186,7 @@
 
                         status, result, err_result = ProcessLogger(
                                self.CTRInstance.logger,
-                               "\"%s\" -c \"%s\" -o \"%s\" %s %s"%
+                               "\"%s\" -c \"%s\" -o \"%s\" %s %s" %
                                    (self.compiler, CFile, objectfilename, Builder_CFLAGS, CFLAGS)
                                ).spin()
 
@@ -215,7 +215,7 @@
 
             status, result, err_result = ProcessLogger(
                    self.CTRInstance.logger,
-                   "\"%s\" %s -o \"%s\" %s"%
+                   "\"%s\" %s -o \"%s\" %s" %
                        (self.linker,
                         listobjstring,
                         self.exe_path,
--- a/targets/toolchain_makefile.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/targets/toolchain_makefile.py	Tue Aug 15 16:48:49 2017 +0300
@@ -84,7 +84,7 @@
         return reduce(operator.concat, map(self.concat_deps, deps), src)
 
     def build(self):
-        srcfiles= []
+        srcfiles = []
         cflags = []
         wholesrcdata = ""
         for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS:
--- a/targets/typemapping.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/targets/typemapping.py	Tue Aug 15 16:48:49 2017 +0300
@@ -55,7 +55,7 @@
                       lambda t, x: t(x.days * 24 * 3600 + x.seconds, x.microseconds*1000))
 
 SameEndianessTypeTranslator = {
-    "BOOL":       _t(c_uint8,  lambda x: x.value!=0),
+    "BOOL":       _t(c_uint8,  lambda x: x.value != 0),
     "STEP":       _t(c_uint8),
     "TRANSITION": _t(c_uint8),
     "ACTION":     _t(c_uint8),
@@ -86,7 +86,7 @@
     # TODO
     }
 
-TypeTranslator=SameEndianessTypeTranslator
+TypeTranslator = SameEndianessTypeTranslator
 
 # Construct debugger natively supported types
 DebugTypesSize =  dict([(key, sizeof(t)) for key, (t, p, u) in SameEndianessTypeTranslator.iteritems() if t is not None])
--- a/util/ProcessLogger.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/util/ProcessLogger.py	Tue Aug 15 16:48:49 2017 +0300
@@ -115,7 +115,7 @@
         self.finishsem = Semaphore(0)
         self.endlock = Lock()
 
-        popenargs= {
+        popenargs = {
                "cwd":    os.getcwd() if cwd is None else cwd,
                "stdin":  subprocess.PIPE,
                "stdout": subprocess.PIPE,
@@ -156,7 +156,7 @@
         self.outlen += 1
         if not self.no_stdout:
             self.logger.write(v)
-        if (self.keyword and v.find(self.keyword)!=-1) or (self.outlimit and self.outlen > self.outlimit):
+        if (self.keyword and v.find(self.keyword) != -1) or (self.outlimit and self.outlen > self.outlimit):
             self.endlog()
 
     def errors(self, v):
@@ -198,9 +198,9 @@
             ctypes.windll.kernel32.CloseHandle(handle)
         else:
             if gently:
-                sig=SIGTERM
+                sig = SIGTERM
             else:
-                sig=SIGKILL
+                sig = SIGKILL
             try:
                 os.kill(self.Proc.pid, sig)
             except:
--- a/util/misc.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/util/misc.py	Tue Aug 15 16:48:49 2017 +0300
@@ -44,9 +44,9 @@
 
 
 def GetClassImporter(classpath):
-    if type(classpath)==str:
+    if type(classpath) == str:
         def fac():
-            mod=__import__(classpath.rsplit('.', 1)[0])
+            mod = __import__(classpath.rsplit('.', 1)[0])
             return reduce(getattr, classpath.split('.')[1:], mod)
         return fac
     else:
--- a/version.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/version.py	Tue Aug 15 16:48:49 2017 +0300
@@ -42,7 +42,7 @@
 
 def GetAppRevision():
     rev = None
-    app_dir=paths.AbsDir(__file__)
+    app_dir = paths.AbsDir(__file__)
     try:
         pipe = subprocess.Popen(
             ["hg", "id", "-i"],
@@ -103,9 +103,9 @@
     '')
 
     # read license file
-    path=paths.AbsDir(__file__)
+    path = paths.AbsDir(__file__)
     license_path = os.path.join(path, "COPYING")
-    license=''
+    license = ''
     if os.path.exists(license_path):
         with open(license_path) as f:
             info.License += f.read()
--- a/wxglade_hmi/wxglade_hmi.py	Tue Aug 15 16:01:18 2017 +0300
+++ b/wxglade_hmi/wxglade_hmi.py	Tue Aug 15 16:48:49 2017 +0300
@@ -65,7 +65,7 @@
         except ImportError:
             pass
 
-        defLibDir="/usr/share/wxglade"
+        defLibDir = "/usr/share/wxglade"
         if os.path.isdir(defLibDir):
             path = defLibDir
 
@@ -89,7 +89,7 @@
 
         hmi_frames = []
 
-        wxgfile_path=self._getWXGLADEpath()
+        wxgfile_path = self._getWXGLADEpath()
         if os.path.exists(wxgfile_path):
             wxgfile = open(wxgfile_path, 'r')
             wxgtree = minidom.parse(wxgfile)
@@ -104,7 +104,7 @@
                             hnode.firstChild.data for hnode in
                             node.getElementsByTagName("handler")]})
 
-            hmipyfile_path=os.path.join(self._getBuildPath(), "hmi.py")
+            hmipyfile_path = os.path.join(self._getBuildPath(), "hmi.py")
             if wx.Platform == '__WXMSW__':
                 wxgfile_path = "\"%s\"" % wxgfile_path
                 wxghmipyfile_path = "\"%s\"" % hmipyfile_path
@@ -120,7 +120,7 @@
             define_hmi = ""
 
         declare_hmi = "\n".join(["%(name)s = None\n" % x +
-                          "\n".join(["%(class)s.%(h)s = %(h)s"%
+                          "\n".join(["%(class)s.%(h)s = %(h)s" %
                             dict(x, h=h) for h in x['handlers']])
                                 for x in hmi_frames])
         global_hmi = ("global %s\n" % ",".join(