clean-up: fix PEP8 E231 missing whitespace after ':' or ','
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Tue, 15 Aug 2017 15:50:30 +0300
changeset 1740 b789b695b5c6
parent 1739 ec153828ded2
child 1741 dd94b9a68c61
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Beremiz.py
BeremizIDE.py
Beremiz_service.py
CodeFileTreeNode.py
ConfigTreeNode.py
IDEFrame.py
PLCControler.py
PLCGenerator.py
PLCOpenEditor.py
ProjectController.py
c_ext/c_ext.py
canfestival/canfestival.py
canfestival/config_utils.py
connectors/WAMP/__init__.py
connectors/__init__.py
controls/CustomTable.py
controls/DebugVariablePanel/DebugVariableGraphicViewer.py
controls/LogViewer.py
controls/PouInstanceVariablesPanel.py
controls/ProjectPropertiesPanel.py
controls/VariablePanel.py
dialogs/ActionBlockDialog.py
dialogs/BlockPreviewDialog.py
dialogs/ConnectionDialog.py
dialogs/DiscoveryDialog.py
dialogs/FBDVariableDialog.py
dialogs/FindInPouDialog.py
dialogs/PouActionDialog.py
dialogs/PouTransitionDialog.py
dialogs/SFCStepDialog.py
dialogs/SearchInProjectDialog.py
docutil/docpdf.py
docutil/docsvg.py
editors/CodeFileEditor.py
editors/ConfTreeNodeEditor.py
editors/LDViewer.py
editors/ResourceEditor.py
editors/SFCViewer.py
editors/Viewer.py
graphics/FBD_Objects.py
graphics/GraphicCommons.py
graphics/SFC_Objects.py
i18n/mki18n.py
plcopen/definitions.py
plcopen/plcopen.py
plcopen/structures.py
py_ext/PythonEditor.py
py_ext/PythonFileCTNMixin.py
py_ext/py_ext.py
runtime/NevowServer.py
runtime/PLCObject.py
runtime/ServicePublisher.py
runtime/WampClient.py
svgui/pyjs/jsonrpc/django/jsonrpc.py
svgui/pyjs/jsonrpc/jsonrpc.py
svgui/pyjs/jsonrpc/web2py/jsonrpc.py
svgui/pyjs/lib/pyjslib.py
svgui/pyjs/pyjs.py
svgui/svgui.py
svgui/svgui_server.py
targets/__init__.py
targets/toolchain_gcc.py
targets/toolchain_makefile.py
targets/typemapping.py
util/ProcessLogger.py
util/Zeroconf.py
util/misc.py
util/paths.py
version.py
wxglade_hmi/wxglade_hmi.py
xmlclass/xsdschema.py
--- a/Beremiz.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/Beremiz.py	Tue Aug 15 15:50:30 2017 +0300
@@ -43,7 +43,7 @@
         self.splashPath = self.Bpath("images", "splash.png")
 
     def Bpath(self, *args):
-        return os.path.join(self.app_dir,*args)
+        return os.path.join(self.app_dir, *args)
 
     def ShowSplashScreen(self):
         from wx.lib.agw.advancedsplash import AdvancedSplash
@@ -56,7 +56,7 @@
             self.splash.Show()
             self.splash.ProcessEvent(wx.PaintEvent())
         else:
-            for i in range(0,30):
+            for i in range(0, 30):
                 wx.Yield()
                 time.sleep(0.01);
 
@@ -162,7 +162,7 @@
                 global updateinfo
                 try:
                     import urllib2
-                    updateinfo = urllib2.urlopen(self.updateinfo_url,None).read()
+                    updateinfo = urllib2.urlopen(self.updateinfo_url, None).read()
                 except:
                     updateinfo = _("update info unavailable.")
 
@@ -181,7 +181,7 @@
         import version
         import tempfile
         logpath = tempfile.gettempdir()+os.sep+'Beremiz'
-        BeremizIDE.AddExceptHook(logpath,version.app_version)
+        BeremizIDE.AddExceptHook(logpath, version.app_version)
 
     def ShowUI(self):
         self.frame = BeremizIDE.Beremiz(None, self.projectOpen, self.buildpath)
--- a/BeremizIDE.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/BeremizIDE.py	Tue Aug 15 15:50:30 2017 +0300
@@ -39,7 +39,7 @@
 
 
 def Bpath(*args):
-    return os.path.join(beremiz_dir,*args)
+    return os.path.join(beremiz_dir, *args)
 
 
 
@@ -85,7 +85,7 @@
         'size': 10,
     }
 
-from threading import Lock,Timer,currentThread
+from threading import Lock, Timer, currentThread
 MainThread = currentThread().ident
 REFRESH_PERIOD = 0.1
 from time import time as gettime
@@ -111,7 +111,7 @@
 
     def write(self, s, style = None):
         if self.lock.acquire():
-            self.stack.append((s,style))
+            self.stack.append((s, style))
             self.lock.release()
             current_time = gettime()
             self.TimerAccessLock.acquire()
@@ -180,10 +180,10 @@
             self.rising_timer = newtime
 
     def write_warning(self, s):
-        self.write(s,self.red_white)
+        self.write(s, self.red_white)
 
     def write_error(self, s):
-        self.write(s,self.red_yellow)
+        self.write(s, self.red_yellow)
 
     def writeyield(self, s):
         self.write(s)
@@ -319,20 +319,20 @@
         self.Bind(wx.EVT_MENU, self.SwitchFullScrMode, id=keyID)
         accels += [wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F12, keyID)]
 
-        for method,shortcut in [("Stop",     wx.WXK_F4),
-                                ("Run",      wx.WXK_F5),
-                                ("Transfer", wx.WXK_F6),
-                                ("Connect",  wx.WXK_F7),
-                                ("Build",    wx.WXK_F11)]:
-            def OnMethodGen(obj,meth):
+        for method, shortcut in [("Stop",     wx.WXK_F4),
+                                 ("Run",      wx.WXK_F5),
+                                 ("Transfer", wx.WXK_F6),
+                                 ("Connect",  wx.WXK_F7),
+                                 ("Build",    wx.WXK_F11)]:
+            def OnMethodGen(obj, meth):
                 def OnMethod(evt):
                     if obj.CTR is not None:
                        obj.CTR.CallMethod('_'+meth)
                     wx.CallAfter(self.RefreshStatusToolBar)
                 return OnMethod
             newid = wx.NewId()
-            self.Bind(wx.EVT_MENU, OnMethodGen(self,method), id=newid)
-            accels += [wx.AcceleratorEntry(wx.ACCEL_NORMAL, shortcut,newid)]
+            self.Bind(wx.EVT_MENU, OnMethodGen(self, method), id=newid)
+            accels += [wx.AcceleratorEntry(wx.ACCEL_NORMAL, shortcut, newid)]
 
         self.SetAcceleratorTable(wx.AcceleratorTable(accels))
 
@@ -405,7 +405,7 @@
         self.__init_execute_path()
 
         IDEFrame.__init__(self, parent, debug)
-        self.Log = LogPseudoFile(self.LogConsole,self.SelectTab)
+        self.Log = LogPseudoFile(self.LogConsole, self.SelectTab)
 
         self.local_runtime = None
         self.runtime_port = None
@@ -487,7 +487,7 @@
                     sys.executable,
                     Bpath("Beremiz_service.py"),
                     self.runtime_port,
-                    {False: "-x 0", True:"-x 1"}[taskbaricon],
+                    {False: "-x 0", True: "-x 1"}[taskbaricon],
                     self.local_runtime_tmpdir),
                 no_gui=False,
                 timeout=500, keyword = self.local_runtime_tmpdir,
@@ -729,7 +729,7 @@
         if self.CTR is not None:
 
             for confnode_method in self.CTR.StatusMethods:
-                if "method" in confnode_method and confnode_method.get("shown",True):
+                if "method" in confnode_method and confnode_method.get("shown", True):
                     id = wx.NewId()
                     StatusToolBar.AddSimpleTool(id,
                         GetBitmap(confnode_method.get("bitmap", "Unknown")),
@@ -1093,7 +1093,7 @@
 
 def Display_Exception_Dialog(e_type, e_value, e_tb, bug_report_path):
     trcbck_lst = []
-    for i,line in enumerate(traceback.extract_tb(e_tb)):
+    for i, line in enumerate(traceback.extract_tb(e_tb)):
         trcbck = " " + str(i+1) + ". "
         if line[0].find(os.getcwd()) == -1:
             trcbck += "file : " + str(line[0]) + ",   "
@@ -1145,7 +1145,7 @@
 
 def AddExceptHook(path, app_version='[No version]'):  #, ignored_exceptions=[]):
 
-    def save_bug_report(e_type, e_value, e_traceback, bug_report_path,date):
+    def save_bug_report(e_type, e_value, e_traceback, bug_report_path, date):
         info = {
             'app-title': wx.GetApp().GetAppName(),  # app_title
             'app-version': app_version,
--- a/Beremiz_service.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/Beremiz_service.py	Tue Aug 15 15:50:30 2017 +0300
@@ -119,7 +119,7 @@
 
 
 def Bpath(*args):
-    return os.path.join(beremiz_dir,*args)
+    return os.path.join(beremiz_dir, *args)
 
 
 def SetupI18n():
@@ -127,7 +127,7 @@
     import gettext
 
     # Get folder containing translation files
-    localedir = os.path.join(beremiz_dir,"locale")
+    localedir = os.path.join(beremiz_dir, "locale")
     # Get the default language
     langid = wx.LANGUAGE_DEFAULT
     # Define translation domain (name of translation files)
@@ -343,7 +343,7 @@
 
             def _LiveShellLocals(self):
                 if self.pyroserver.plcobj is not None:
-                    return {"locals":self.pyroserver.plcobj.python_runtime_vars}
+                    return {"locals": self.pyroserver.plcobj.python_runtime_vars}
                 else:
                     return {}
 
@@ -385,7 +385,7 @@
 
 def default_evaluator(tocall, *args, **kwargs):
     try:
-        res=(tocall(*args,**kwargs), None)
+        res=(tocall(*args, **kwargs), None)
     except Exception:
         res=(None, sys.exc_info())
     return res
@@ -430,7 +430,7 @@
         self.plcobj = PLCObject(self.workdir, self.daemon, self.argv,
                                 self.statuschange, self.evaluator,
                                 self.pyruntimevars)
-        uri = self.daemon.connect(self.plcobj,"PLCObject")
+        uri = self.daemon.connect(self.plcobj, "PLCObject")
 
         print _("Pyro port :"), self.port
         print _("Pyro object's uri :"), uri
@@ -499,12 +499,12 @@
     main_thread = currentThread()
 
     def statuschangeTskBar(status):
-        wx.CallAfter(taskbar_instance.UpdateIcon,status)
+        wx.CallAfter(taskbar_instance.UpdateIcon, status)
 
     statuschange.append(statuschangeTskBar)
 
     def wx_evaluator(obj, *args, **kwargs):
-        tocall,args,kwargs = obj.call
+        tocall, args, kwargs = obj.call
         obj.res = default_evaluator(tocall, *args, **kwargs)
         wx_eval_lock.release()
 
@@ -514,8 +514,8 @@
             # 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))
-            wx.CallAfter(wx_evaluator,o)
+            o=type('', (object,), dict(call=(tocall, args, kwargs), res=None))
+            wx.CallAfter(wx_evaluator, o)
             wx_eval_lock.acquire()
             return o.res
 
@@ -537,7 +537,7 @@
 
 def LogException(*exp):
     if pyroserver.plcobj is not None:
-        pyroserver.plcobj.LogMessage(0,'\n'.join(traceback.format_exception(*exp)))
+        pyroserver.plcobj.LogMessage(0, '\n'.join(traceback.format_exception(*exp)))
     else:
         traceback.print_exception(*exp)
 
@@ -611,7 +611,7 @@
 else:
     try:
         pyroserver.Loop()
-    except KeyboardInterrupt,e:
+    except KeyboardInterrupt, e:
         pass
 pyroserver.Quit()
 sys.exit(0)
--- a/CodeFileTreeNode.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/CodeFileTreeNode.py	Tue Aug 15 15:50:30 2017 +0300
@@ -184,7 +184,7 @@
     def OnCTNSave(self, from_project_path=None):
         filepath = self.CodeFileName()
 
-        xmlfile = open(filepath,"w")
+        xmlfile = open(filepath, "w")
         xmlfile.write(etree.tostring(
             self.CodeFile,
             pretty_print=True,
--- a/ConfigTreeNode.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/ConfigTreeNode.py	Tue Aug 15 15:50:30 2017 +0300
@@ -99,7 +99,7 @@
     def ConfNodePath(self):
         return os.path.join(self.CTNParent.ConfNodePath(), self.CTNType)
 
-    def CTNPath(self,CTNName=None,project_path=None):
+    def CTNPath(self, CTNName=None, project_path=None):
         if not CTNName:
             CTNName = self.CTNName()
         if not project_path:
@@ -195,7 +195,7 @@
 
             # generate XML for base XML parameters controller of the confnode
             if self.MandatoryParams:
-                BaseXMLFile = open(self.ConfNodeBaseXmlFilePath(),'w')
+                BaseXMLFile = open(self.ConfNodeBaseXmlFilePath(), 'w')
                 BaseXMLFile.write(etree.tostring(
                     self.MandatoryParams[1],
                     pretty_print=True,
@@ -205,7 +205,7 @@
 
             # generate XML for XML parameters controller of the confnode
             if self.CTNParams:
-                XMLFile = open(self.ConfNodeXmlFilePath(),'w')
+                XMLFile = open(self.ConfNodeXmlFilePath(), 'w')
                 XMLFile.write(etree.tostring(
                     self.CTNParams[1],
                     pretty_print=True,
@@ -258,8 +258,8 @@
             }, ...]
         @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND
         """
-        self.GetCTRoot().logger.write_warning(".".join(map(lambda x:str(x), self.GetCurrentLocation())) + " -> Nothing to do\n")
-        return [],"",False
+        self.GetCTRoot().logger.write_warning(".".join(map(lambda x: str(x), self.GetCurrentLocation())) + " -> Nothing to do\n")
+        return [], "", False
 
     def _Generate_C(self, buildpath, locations):
         # Generate confnodes [(Cfiles, CFLAGS)], LDFLAGS, DoCalls, extra_files
@@ -309,7 +309,7 @@
 
     def IECSortedChildren(self):
         # reorder children by IEC_channels
-        ordered = [(chld.BaseParams.getIEC_Channel(),chld) for chld in self.IterChildren()]
+        ordered = [(chld.BaseParams.getIEC_Channel(), chld) for chld in self.IterChildren()]
         if ordered:
             ordered.sort()
             return zip(*ordered)[1]
@@ -524,7 +524,7 @@
         # reorganize self.CTNChildrenTypes tuples from (name, CTNClass, Help)
         # to ( name, (CTNClass, Help)), an make a dict
         transpose = zip(*self.CTNChildrenTypes)
-        CTNChildrenTypes = dict(zip(transpose[0],zip(transpose[1],transpose[2])))
+        CTNChildrenTypes = dict(zip(transpose[0], zip(transpose[1], transpose[2])))
         # Check that adding this confnode is allowed
         try:
             CTNClass, CTNHelp = CTNChildrenTypes[CTNType]
--- a/IDEFrame.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/IDEFrame.py	Tue Aug 15 15:50:30 2017 +0300
@@ -257,7 +257,7 @@
     for tab in tabs:
         if tab["pos"][0] == rect.x:
             others = [t for t in tabs if t != tab]
-            others.sort(lambda x,y: cmp(x["pos"][0], y["pos"][0]))
+            others.sort(lambda x, y: cmp(x["pos"][0], y["pos"][0]))
             for other in others:
                 if (other["pos"][1] == tab["pos"][1] and
                     other["size"][1] == tab["size"][1] and
@@ -272,7 +272,7 @@
 
         elif tab["pos"][1] == rect.y:
             others = [t for t in tabs if t != tab]
-            others.sort(lambda x,y: cmp(x["pos"][1], y["pos"][1]))
+            others.sort(lambda x, y: cmp(x["pos"][1], y["pos"][1]))
             for other in others:
                 if (other["pos"][0] == tab["pos"][0] and
                     other["size"][0] == tab["size"][0] and
@@ -1465,7 +1465,7 @@
             event.Skip()
         return OnTabsOpenedDClick
 
-    def SwitchFullScrMode(self,evt):
+    def SwitchFullScrMode(self, evt):
         pane = self.AUIManager.GetPane(self.TabsOpened)
         if pane.IsMaximized():
             self.AUIManager.RestorePane(pane)
--- a/PLCControler.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/PLCControler.py	Tue Aug 15 15:50:30 2017 +0300
@@ -96,7 +96,7 @@
 
 
 def GetUneditableNames():
-    _ = lambda x:x
+    _ = lambda x: x
     return [_("User-defined POUs"), _("Functions"), _("Function Blocks"),
             _("Programs"), _("Data Types"), _("Transitions"), _("Actions"),
             _("Configurations"), _("Resources"), _("Properties")]
@@ -695,13 +695,27 @@
         project = self.GetProject(debug)
         if project is not None:
             infos = {"name": project.getname(), "type": ITEM_PROJECT}
-            datatypes = {"name": DATA_TYPES, "type": ITEM_DATATYPES, "values":[]}
+            datatypes = {"name": DATA_TYPES, "type": ITEM_DATATYPES, "values": []}
             for datatype in project.getdataTypes():
                 datatypes["values"].append({"name": datatype.getname(), "type": ITEM_DATATYPE,
                     "tagname": self.ComputeDataTypeName(datatype.getname()), "values": []})
-            pou_types = {"function": {"name": FUNCTIONS, "type": ITEM_FUNCTION, "values":[]},
-                         "functionBlock": {"name": FUNCTION_BLOCKS, "type": ITEM_FUNCTIONBLOCK, "values":[]},
-                         "program": {"name": PROGRAMS, "type": ITEM_PROGRAM, "values":[]}}
+            pou_types = {
+                "function": {
+                    "name":   FUNCTIONS,
+                    "type":   ITEM_FUNCTION,
+                    "values": []
+                },
+                "functionBlock": {
+                    "name":   FUNCTION_BLOCKS,
+                    "type":   ITEM_FUNCTIONBLOCK,
+                    "values": []
+                },
+                "program": {
+                    "name":   PROGRAMS,
+                    "type":   ITEM_PROGRAM,
+                    "values": []
+                }
+            }
             for pou in project.getpous():
                 pou_type = pou.getpouType()
                 pou_infos = {"name": pou.getname(), "type": ITEM_POU,
@@ -1544,7 +1558,7 @@
         self.TotalTypes.extend(addedcat)
         for cat in addedcat:
             for desc in cat["list"]:
-                BlkLst = self.TotalTypesDict.setdefault(desc["name"],[])
+                BlkLst = self.TotalTypesDict.setdefault(desc["name"], [])
                 BlkLst.append((section["name"], desc))
 
     # Function that clear the confnode list
@@ -1596,7 +1610,7 @@
     # Function that returns the block definition associated to the block type given
     def GetBlockType(self, typename, inputs = None, debug = False):
         result_blocktype = None
-        for sectioname, blocktype in self.TotalTypesDict.get(typename,[]):
+        for sectioname, blocktype in self.TotalTypesDict.get(typename, []):
             if inputs is not None and inputs != "undefined":
                 block_inputs = tuple([var_type for name, var_type, modifier in blocktype["inputs"]])
                 if reduce(lambda x, y: x and y, map(lambda x: x[0] == "ANY" or self.IsOfType(*x), zip(inputs, block_inputs)), True):
@@ -1634,7 +1648,7 @@
         project = self.GetProject(debug)
         if project is not None:
             pou_type = None
-            if words[0] in ["P","T","A"]:
+            if words[0] in ["P", "T", "A"]:
                 name = words[1]
                 pou_type = self.GetPouType(name, debug)
             filter = (["function"]
@@ -1658,11 +1672,11 @@
         project = self.GetProject(debug)
         words = tagname.split("::")
         name = None
-        if project is not None and words[0] in ["P","T","A"]:
+        if project is not None and words[0] in ["P", "T", "A"]:
             name = words[1]
         blocktypes = []
         for blocks in self.TotalTypesDict.itervalues():
-            for sectioname,block in blocks:
+            for sectioname, block in blocks:
                 if block["type"] == "functionBlock":
                     blocktypes.append(block["name"])
         if project is not None:
@@ -1773,7 +1787,7 @@
         TypeHierarchy_list has a rough order to it (e.g. SINT, INT, DINT, ...),
         which makes it easy for a user to find a type in a menu.
         '''
-        return [x for x,y in TypeHierarchy_list if not x.startswith("ANY")]
+        return [x for x, y in TypeHierarchy_list if not x.startswith("ANY")]
 
     def IsOfType(self, typename, reference, debug = False):
         if reference is None or typename == reference:
@@ -2174,7 +2188,7 @@
     # Return edited element name
     def GetEditedElementName(self, tagname):
         words = tagname.split("::")
-        if words[0] in ["P","C","D"]:
+        if words[0] in ["P", "C", "D"]:
             return words[1]
         else:
             return words[2]
@@ -2183,7 +2197,7 @@
     # Return edited element name and type
     def GetEditedElementType(self, tagname, debug = False):
         words = tagname.split("::")
-        if words[0] in ["P","T","A"]:
+        if words[0] in ["P", "T", "A"]:
             return words[1], self.GetPouType(words[1], debug)
         return None, None
 
@@ -2201,7 +2215,7 @@
     # Return the edited element variables
     def GetEditedElementInterfaceVars(self, tagname, tree=False, debug = False):
         words = tagname.split("::")
-        if words[0] in ["P","T","A"]:
+        if words[0] in ["P", "T", "A"]:
             project = self.GetProject(debug)
             if project is not None:
                 pou = project.getpou(words[1])
@@ -2259,7 +2273,7 @@
     # Return the names of the pou elements
     def GetEditedElementVariables(self, tagname, debug = False):
         words = tagname.split("::")
-        if words[0] in ["P","T","A"]:
+        if words[0] in ["P", "T", "A"]:
             return self.GetProjectPouVariableNames(words[1], debug)
         elif words[0] in ["C", "R"]:
             names = self.GetConfigurationVariableNames(words[1], debug)
@@ -2302,7 +2316,7 @@
             names.update(dict([(varname.upper(), True)
                                for varname in self.GetEditedElementVariables(tagname, debug)]))
             words = tagname.split("::")
-            if words[0] in ["P","T","A"]:
+            if words[0] in ["P", "T", "A"]:
                 element = self.GetEditedElement(tagname, debug)
                 if element is not None and element.getbodyType() not in ["ST", "IL"]:
                     for instance in element.getinstances():
@@ -2494,7 +2508,7 @@
             var_type_obj.setcontent(derived_type)
         return var_type_obj
 
-    def AddEditedElementPouVar(self, tagname, var_type, name,**args):
+    def AddEditedElementPouVar(self, tagname, var_type, name, **args):
         if self.Project is not None:
             words = tagname.split("::")
             if words[0] in ['P', 'T', 'A']:
--- a/PLCGenerator.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/PLCGenerator.py	Tue Aug 15 15:50:30 2017 +0300
@@ -160,7 +160,7 @@
                                  ("%s" % min_value, (tagname, "lower")),
                                  ("..", ()),
                                  ("%s" % max_value, (tagname, "upper")),
-                                 (")",())]
+                                 (")", ())]
             # Data type is an enumerated type
             elif basetype_content_type == "enum":
                 values = [[(value.getname(), (tagname, "value", i))]
@@ -521,7 +521,7 @@
         self.ComputedConnectors = {}
         self.ConnectionTypes = {}
         self.RelatedConnections = []
-        self.SFCNetworks = {"Steps":{}, "Transitions":{}, "Actions":{}}
+        self.SFCNetworks = {"Steps": {}, "Transitions": {}, "Actions": {}}
         self.SFCComputedBlocks = []
         self.ActionNumber = 0
         self.Program = []
@@ -898,7 +898,7 @@
             body = body[0]
         body_content = body.getcontent()
         body_type = body_content.getLocalTag()
-        if body_type in ["IL","ST"]:
+        if body_type in ["IL", "ST"]:
             text = body_content.getanyText()
             self.ParentGenerator.GeneratePouProgramInText(text.upper())
             self.Program = [(ReIndentText(text, len(self.CurrentIndent)),
--- a/PLCOpenEditor.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/PLCOpenEditor.py	Tue Aug 15 15:50:30 2017 +0300
@@ -405,9 +405,9 @@
 Max_Traceback_List_Size = 20
 
 
-def Display_Exception_Dialog(e_type,e_value,e_tb):
+def Display_Exception_Dialog(e_type, e_value, e_tb):
     trcbck_lst = []
-    for i,line in enumerate(traceback.extract_tb(e_tb)):
+    for i, line in enumerate(traceback.extract_tb(e_tb)):
         trcbck = " " + str(i+1) + _(". ")
         if line[0].find(os.getcwd()) == -1:
             trcbck += _("file : ") + str(line[0]) + _(",   ")
@@ -472,7 +472,7 @@
         if str(e_value).startswith("!!!"):
             Display_Error_Dialog(e_value)
         elif ex not in ignored_exceptions:
-            result = Display_Exception_Dialog(e_type,e_value,e_traceback)
+            result = Display_Exception_Dialog(e_type, e_value, e_traceback)
             if result:
                 ignored_exceptions.append(ex)
                 info = {
@@ -495,7 +495,7 @@
                     if 'self' in exception_locals:
                         info['self'] = format_namespace(exception_locals['self'].__dict__)
 
-                output = open(path+os.sep+"bug_report_"+time.strftime("%Y_%m_%d__%H-%M-%S")+".txt",'w')
+                output = open(path+os.sep+"bug_report_"+time.strftime("%Y_%m_%d__%H-%M-%S")+".txt", 'w')
                 lst = info.keys()
                 lst.sort()
                 for a in lst:
--- a/ProjectController.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/ProjectController.py	Tue Aug 15 15:50:30 2017 +0300
@@ -70,7 +70,7 @@
 
 def ExtractChildrenTypesFromCatalog(catalog):
     children_types = []
-    for n,d,h,c in catalog:
+    for n, d, h, c in catalog:
         if isinstance(c, ListType):
             children_types.extend(ExtractChildrenTypesFromCatalog(c))
         else:
@@ -80,7 +80,7 @@
 
 def ExtractMenuItemsFromCatalog(catalog):
     menu_items = []
-    for n,d,h,c in catalog:
+    for n, d, h, c in catalog:
         if isinstance(c, ListType):
             children = ExtractMenuItemsFromCatalog(c)
         else:
@@ -113,7 +113,7 @@
         paths=[
             os.path.join(base_folder, "matiec")
         ]
-        path = self.findObject(paths, lambda p:os.path.isfile(os.path.join(p, cmd)))
+        path = self.findObject(paths, lambda p: os.path.isfile(os.path.join(p, cmd)))
 
         # otherwise use iec2c from PATH
         if path is not None:
@@ -126,7 +126,7 @@
             os.path.join(base_folder, "matiec", "lib"),
             "/usr/lib/matiec"
         ]
-        path = self.findObject(paths, lambda p:os.path.isfile(os.path.join(p, "ieclib.txt")))
+        path = self.findObject(paths, lambda p: os.path.isfile(os.path.join(p, "ieclib.txt")))
         return path
 
     def findLibCPath(self):
@@ -134,7 +134,7 @@
         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")))
+        path = self.findObject(paths, lambda p: os.path.isfile(os.path.join(p, "iec_types.h")))
         return path
 
     def findSupportedOptions(self):
@@ -146,7 +146,7 @@
             # Invoke compiler. Output files are listed to stdout, errors to stderr
             status, result, err_result = ProcessLogger(None, buildcmd,
                 no_stdout=True, no_stderr=True).spin()
-        except Exception,e:
+        except Exception, e:
             return buildopt
 
         for opt in options:
@@ -207,7 +207,7 @@
               """+"\n".join(['<xsd:attribute name='+
                              '"Enable_'+ libname + '_Library" '+
                              'type="xsd:boolean" use="optional" default="true"/>'
-                             for libname,lib in features.libraries])+"""
+                             for libname, lib in features.libraries])+"""
               </xsd:complexType>
             </xsd:element>""") if len(features.libraries)>0 else '') + """
           </xsd:sequence>
@@ -262,7 +262,7 @@
     def LoadLibraries(self):
         self.Libraries = []
         TypeStack=[]
-        for libname,clsname in features.libraries:
+        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)
                 TypeStack.append(Lib.GetTypes())
@@ -569,17 +569,17 @@
 
     def GetLibrariesCCode(self, buildpath):
         if len(self.Libraries)==0:
-            return [],[],()
+            return [], [], ()
         self.GetIECProgramsAndVariables()
         LibIECCflags = '"-I%s" -Wno-unused-function' % os.path.abspath(self.GetIECLibPath())
         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:
                 Extras.extend(res[2:])
-        return map(list,zip(*LocatedCCodeAndFlags))+[tuple(Extras)]
+        return map(list, zip(*LocatedCCodeAndFlags))+[tuple(Extras)]
 
     # Update PLCOpenEditor ConfNode Block types from loaded confnodes
     def RefreshConfNodesBlockLists(self):
@@ -668,10 +668,10 @@
 
     def GetLocations(self):
         locations = []
-        filepath = os.path.join(self._getBuildPath(),"LOCATED_VARIABLES.h")
+        filepath = os.path.join(self._getBuildPath(), "LOCATED_VARIABLES.h")
         if os.path.isfile(filepath):
             # IEC2C compiler generate a list of located variables : LOCATED_VARIABLES.h
-            location_file = open(os.path.join(self._getBuildPath(),"LOCATED_VARIABLES.h"))
+            location_file = open(os.path.join(self._getBuildPath(), "LOCATED_VARIABLES.h"))
             # each line of LOCATED_VARIABLES.h declares a located variable
             lines = [line.strip() for line in location_file.readlines()]
             # This regular expression parses the lines genereated by IEC2C
@@ -683,7 +683,7 @@
                     # Get the resulting dict
                     resdict = result.groupdict()
                     # rewrite string for variadic location as a tuple of integers
-                    resdict['LOC'] = tuple(map(int,resdict['LOC'].split(',')))
+                    resdict['LOC'] = tuple(map(int, resdict['LOC'].split(',')))
                     # set located size to 'X' if not given
                     if not resdict['SIZE']:
                         resdict['SIZE'] = 'X'
@@ -752,7 +752,7 @@
             # Invoke compiler. Output files are listed to stdout, errors to stderr
             status, result, err_result = ProcessLogger(self.logger, buildcmd,
                 no_stdout=True, no_stderr=True).spin()
-        except Exception,e:
+        except Exception, e:
             self.logger.write_error(buildcmd + "\n")
             self.logger.write_error(repr(e) + "\n")
             return False
@@ -797,12 +797,12 @@
             self.logger.write_error(_("Error : At least one configuration and one resource must be declared in PLC !\n"))
             return False
         # transform those base names to full names with path
-        C_files = map(lambda filename:os.path.join(buildpath, filename), C_files)
+        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.remove("LOCATED_VARIABLES.h")
-        H_files = map(lambda filename:os.path.join(buildpath, filename), H_files)
+        H_files = map(lambda filename: os.path.join(buildpath, filename), H_files)
         for H_file in H_files:
             with file(H_file, 'r') as original: data = original.read()
             with file(H_file, 'w') as modified: modified.write('#include "beremiz.h"\n' + data)
@@ -825,7 +825,7 @@
         targetclass = targets.GetBuilder(targetname)
 
         # if target already
-        if self._builder is None or not isinstance(self._builder,targetclass):
+        if self._builder is None or not isinstance(self._builder, targetclass):
             # Get classname instance
             self._builder = targetclass(self)
         return self._builder
@@ -883,7 +883,7 @@
         """
         if self._ProgramList is None or self._VariablesList is None:
             try:
-                csvfile = os.path.join(self._getBuildPath(),"VARIABLES.csv")
+                csvfile = os.path.join(self._getBuildPath(), "VARIABLES.csv")
                 # describes CSV columns
                 ProgramsListAttributeName = ["num", "C_path", "type"]
                 VariablesListAttributeName = ["num", "vartype", "IEC_path", "C_path", "type"]
@@ -894,7 +894,7 @@
 
                 # Separate sections
                 ListGroup = []
-                for line in open(csvfile,'r').xreadlines():
+                for line in open(csvfile, 'r').xreadlines():
                     strippedline = line.strip()
                     if strippedline.startswith("//"):
                         # Start new section
@@ -906,9 +906,9 @@
                 # first section contains programs
                 for line in ListGroup[0]:
                     # Split and Maps each field to dictionnary entries
-                    attrs = dict(zip(ProgramsListAttributeName,line.strip().split(';')))
+                    attrs = dict(zip(ProgramsListAttributeName, line.strip().split(';')))
                     # Truncate "C_path" to remove conf an resources names
-                    attrs["C_path"] = '__'.join(attrs["C_path"].split(".",2)[1:])
+                    attrs["C_path"] = '__'.join(attrs["C_path"].split(".", 2)[1:])
                     # Push this dictionnary into result.
                     self._ProgramList.append(attrs)
 
@@ -917,9 +917,9 @@
                 Idx = 0
                 for line in ListGroup[1]:
                     # Split and Maps each field to dictionnary entries
-                    attrs = dict(zip(VariablesListAttributeName,line.strip().split(';')))
+                    attrs = dict(zip(VariablesListAttributeName, line.strip().split(';')))
                     # Truncate "C_path" to remove conf an resources names
-                    parts = attrs["C_path"].split(".",2)
+                    parts = attrs["C_path"].split(".", 2)
                     if len(parts) > 2:
                         config_FB = config_FBs.get(tuple(parts[:2]))
                         if config_FB:
@@ -947,7 +947,7 @@
                 if len(ListGroup) > 2:
                     self._Ticktime = int(ListGroup[2][0])
 
-            except Exception,e:
+            except Exception, e:
                 self.logger.write_error(_("Cannot open/parse VARIABLES.csv!\n"))
                 self.logger.write_error(traceback.format_exc())
                 self.ResetIECProgramsAndVariables()
@@ -968,24 +968,28 @@
             sz = DebugTypesSize.get(v["type"], 0)
             variable_decl_array += [
                 "{&(%(C_path)s), " % v+
-                {"EXT":"%(type)s_P_ENUM",
-                 "IN":"%(type)s_P_ENUM",
-                 "MEM":"%(type)s_O_ENUM",
-                 "OUT":"%(type)s_O_ENUM",
-                 "VAR":"%(type)s_ENUM"}[v["vartype"]] % v +
-                 "}"]
+                {
+                    "EXT": "%(type)s_P_ENUM",
+                    "IN":  "%(type)s_P_ENUM",
+                    "MEM": "%(type)s_O_ENUM",
+                    "OUT": "%(type)s_O_ENUM",
+                    "VAR": "%(type)s_ENUM"
+                }[v["vartype"]] % v +
+                "}"]
             bofs += sz
         debug_code = targets.GetCode("plc_debug.c") % {
-           "buffer_size":bofs,
+           "buffer_size": bofs,
            "programs_declarations":
                "\n".join(["extern %(type)s %(C_path)s;" % p for p in self._ProgramList]),
-           "extern_variables_declarations":"\n".join([
-              {"EXT":"extern __IEC_%(type)s_p %(C_path)s;",
-               "IN":"extern __IEC_%(type)s_p %(C_path)s;",
-               "MEM":"extern __IEC_%(type)s_p %(C_path)s;",
-               "OUT":"extern __IEC_%(type)s_p %(C_path)s;",
-               "VAR":"extern __IEC_%(type)s_t %(C_path)s;",
-               "FB":"extern %(type)s %(C_path)s;"}[v["vartype"]] % v
+           "extern_variables_declarations": "\n".join([
+              {
+                  "EXT": "extern __IEC_%(type)s_p %(C_path)s;",
+                  "IN":  "extern __IEC_%(type)s_p %(C_path)s;",
+                  "MEM": "extern __IEC_%(type)s_p %(C_path)s;",
+                  "OUT": "extern __IEC_%(type)s_p %(C_path)s;",
+                  "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]),
            "variable_decl_array": ",\n".join(variable_decl_array)
            }
@@ -999,38 +1003,38 @@
         """
         # filter location that are related to code that will be called
         # in retreive, publish, init, cleanup
-        locstrs = map(lambda x:"_".join(map(str,x)),
-           [loc for loc,Cfiles,DoCalls in self.LocationCFilesAndCFLAGS if loc and DoCalls])
+        locstrs = map(lambda x: "_".join(map(str, x)),
+           [loc for loc, Cfiles, DoCalls in self.LocationCFilesAndCFLAGS if loc and DoCalls])
 
         # Generate main, based on template
         if not self.BeremizRoot.getDisable_Extensions():
             plc_main_code = targets.GetCode("plc_main_head.c") % {
-                "calls_prototypes":"\n".join([(
+                "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"+
-                      "void __publish_%(s)s(void);") % {'s':locstr} for locstr in locstrs]),
-                "retrieve_calls":"\n    ".join([
+                      "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_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_calls": "\n    ".join([
                       "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([
+                      "return res;}" for i, locstr in enumerate(locstrs)]),
+                "cleanup_calls": "\n    ".join([
                       "if(init_level >= %d) " % i+
                       "__cleanup_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)])
                 }
         else:
             plc_main_code = targets.GetCode("plc_main_head.c") % {
-                "calls_prototypes":"\n",
-                "retrieve_calls":"\n",
-                "publish_calls":"\n",
-                "init_calls":"\n",
-                "cleanup_calls":"\n"
-                }
+                "calls_prototypes": "\n",
+                "retrieve_calls":   "\n",
+                "publish_calls":    "\n",
+                "init_calls":       "\n",
+                "cleanup_calls":    "\n"
+            }
         plc_main_code += targets.GetTargetCode(self.GetTarget().getcontent().getLocalTag())
         plc_main_code += targets.GetCode("plc_main_tail.c")
         return plc_main_code
@@ -1130,14 +1134,14 @@
         # Recreate directory
         os.mkdir(extrafilespath)
         # Then write the files
-        for fname,fobject in ExtraFiles:
-            fpath = os.path.join(extrafilespath,fname)
+        for fname, fobject in ExtraFiles:
+            fpath = os.path.join(extrafilespath, fname)
             open(fpath, "wb").write(fobject.read())
         # Now we can forget ExtraFiles (will close files object)
         del ExtraFiles
 
         # Header file for extensions
-        open(os.path.join(buildpath,"beremiz.h"), "w").write(targets.GetHeader())
+        open(os.path.join(buildpath, "beremiz.h"), "w").write(targets.GetHeader())
 
         # Template based part of C code generation
         # files are stacked at the beginning, as files of confnode tree root
@@ -1145,16 +1149,16 @@
            # debugger code
            (self.Generate_plc_debugger, "plc_debugger.c", "Debugger"),
            # init/cleanup/retrieve/publish, run and align code
-           (self.Generate_plc_main,"plc_main.c","Common runtime")]:
+           (self.Generate_plc_main, "plc_main.c", "Common runtime")]:
             try:
                 # Do generate
                 code = generator()
                 if code is None:
                      raise
-                code_path = os.path.join(buildpath,filename)
+                code_path = os.path.join(buildpath, filename)
                 open(code_path, "w").write(code)
                 # Insert this file as first file to be compiled at root confnode
-                self.LocationCFilesAndCFLAGS[0][1].insert(0,(code_path, self.plcCFLAGS))
+                self.LocationCFilesAndCFLAGS[0][1].insert(0, (code_path, self.plcCFLAGS))
             except Exception, exc:
                 self.logger.write_error(name+_(" generation failed !\n"))
                 self.logger.write_error(traceback.format_exc())
@@ -1336,19 +1340,19 @@
             status = "Disconnected"
         if(self.previous_plcstate != status):
             for args in {
-                     "Started":     [("_Run", False),
+                    "Started":      [("_Run", False),
                                      ("_Stop", True)],
-                     "Stopped":     [("_Run", True),
+                    "Stopped":      [("_Run", True),
                                      ("_Stop", False)],
-                     "Empty":       [("_Run", False),
+                    "Empty":        [("_Run", False),
                                      ("_Stop", False)],
-                     "Broken":      [],
-                     "Disconnected":[("_Run", False),
+                    "Broken":       [],
+                    "Disconnected": [("_Run", False),
                                      ("_Stop", False),
                                      ("_Transfer", False),
                                      ("_Connect", True),
                                      ("_Disconnect", False)],
-                   }.get(status,[]):
+            }.get(status, []):
                 self.ShowMethod(*args)
             self.previous_plcstate = status
             if self.AppFrame is not None:
@@ -1402,7 +1406,7 @@
         if self._connector is not None:
             self.IECdebug_lock.acquire()
             IECPathsToPop = []
-            for IECPath,data_tuple in self.IECdebug_datas.iteritems():
+            for IECPath, data_tuple in self.IECdebug_datas.iteritems():
                 WeakCallableDict, data_log, status, fvalue, buffer_list = data_tuple
                 if len(WeakCallableDict) == 0:
                     # Callable Dict is empty.
@@ -1410,7 +1414,7 @@
                     IECPathsToPop.append(IECPath)
                 elif IECPath != "__tick__":
                     # Convert
-                    Idx, IEC_Type = self._IECPathToIdx.get(IECPath,(None,None))
+                    Idx, IEC_Type = self._IECPathToIdx.get(IECPath, (None, None))
                     if Idx is not None:
                         if IEC_Type in DebugTypesSize:
                             Idxs.append((Idx, IEC_Type, fvalue, IECPath))
@@ -1446,12 +1450,12 @@
         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()
 
     def GetDebugIECVariableType(self, IECPath):
-        Idx, IEC_Type = self._IECPathToIdx.get(IECPath,(None,None))
+        Idx, IEC_Type = self._IECPathToIdx.get(IECPath, (None, None))
         return IEC_Type
 
     def SubscribeDebugIECVariable(self, IECPath, callableobj, buffer_list=False):
@@ -1489,7 +1493,7 @@
         self.IECdebug_lock.acquire()
         IECdebug_data = self.IECdebug_datas.get(IECPath, None)
         if IECdebug_data is not None:
-            IECdebug_data[0].pop(callableobj,None)
+            IECdebug_data[0].pop(callableobj, None)
             if len(IECdebug_data[0]) == 0:
                 self.IECdebug_datas.pop(IECPath)
             else:
@@ -1543,7 +1547,7 @@
         if data_tuple is not None:
             WeakCallableDict, data_log, status, fvalue, buffer_list = data_tuple
             #data_log.append((debug_tick, value))
-            for weakcallable,buffer_list in WeakCallableDict.iteritems():
+            for weakcallable, buffer_list in WeakCallableDict.iteritems():
                 function = getattr(weakcallable, function_name, None)
                 if function is not None:
                     if buffer_list:
@@ -1756,7 +1760,7 @@
 
             #self.logger.write(_("PLC is %s\n")%status)
 
-            if self.previous_plcstate in ["Started","Stopped"]:
+            if self.previous_plcstate in ["Started", "Stopped"]:
                 if self.DebugAvailable() and self.GetIECProgramsAndVariables():
                     self.logger.write(_("Debugger ready\n"))
                     self._connect_debug()
--- a/c_ext/c_ext.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/c_ext/c_ext.py	Tue Aug 15 15:50:30 2017 +0300
@@ -119,10 +119,10 @@
         text += "\n}\n\n"
 
         Gen_Cfile_path = os.path.join(buildpath, "CFile_%s.c" % location_str)
-        cfile = open(Gen_Cfile_path,'w')
+        cfile = open(Gen_Cfile_path, 'w')
         cfile.write(text)
         cfile.close()
 
         matiec_CFLAGS = '"-I%s"' % os.path.abspath(self.GetCTRoot().GetIECLibPath())
 
-        return [(Gen_Cfile_path, str(self.CExtension.getCFLAGS() + matiec_CFLAGS))],str(self.CExtension.getLDFLAGS()),True
+        return [(Gen_Cfile_path, str(self.CExtension.getCFLAGS() + matiec_CFLAGS))], str(self.CExtension.getLDFLAGS()), True
--- a/canfestival/canfestival.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/canfestival/canfestival.py	Tue Aug 15 15:50:30 2017 +0300
@@ -235,7 +235,7 @@
         res = eds_utils.GenerateEDSFile(os.path.join(buildpath, "Slave_%s.eds" % prefix), slave)
         if res:
             raise Exception, res
-        return [(Gen_OD_path,local_canfestival_config.getCFLAGS(CanFestivalPath))],"",False
+        return [(Gen_OD_path, local_canfestival_config.getCFLAGS(CanFestivalPath))], "", False
 
     def LoadPrevious(self):
         self.LoadCurrentPrevious()
@@ -445,7 +445,7 @@
         Gen_OD_path = os.path.join(buildpath, "OD_%s.c" % prefix )
         # Create a new copy of the model with DCF loaded with PDO mappings for desired location
         try:
-            master, pointers = config_utils.GenerateConciseDCF(locations, current_location, self, self.CanFestivalNode.getSync_TPDOs(),"OD_%s" % prefix)
+            master, pointers = config_utils.GenerateConciseDCF(locations, current_location, self, self.CanFestivalNode.getSync_TPDOs(), "OD_%s" % prefix)
         except config_utils.PDOmappingException, e:
             raise Exception, e.message
         # Do generate C file.
@@ -457,7 +457,7 @@
         dump(master, file)
         file.close()
 
-        return [(Gen_OD_path,local_canfestival_config.getCFLAGS(CanFestivalPath))],"",False
+        return [(Gen_OD_path, local_canfestival_config.getCFLAGS(CanFestivalPath))], "", False
 
     def LoadPrevious(self):
         self.Manager.LoadCurrentPrevious()
@@ -480,8 +480,8 @@
     </xsd:schema>
     """
 
-    CTNChildrenTypes = [("CanOpenNode",_NodeListCTN, "CanOpen Master"),
-                       ("CanOpenSlave",_SlaveCTN, "CanOpen Slave")]
+    CTNChildrenTypes = [("CanOpenNode",  _NodeListCTN, "CanOpen Master"),
+                        ("CanOpenSlave", _SlaveCTN,    "CanOpen Slave" )]
     def GetParamsAttributes(self, path = None):
         infos = ConfigTreeNode.GetParamsAttributes(self, path = path)
         for element in infos:
@@ -510,7 +510,7 @@
             can_driver_name = ""
 
 
-        format_dict = {"locstr": "_".join(map(str,self.GetCurrentLocation())),
+        format_dict = {"locstr": "_".join(map(str, self.GetCurrentLocation())),
                        "candriver": can_driver_name,
                        "nodes_includes": "",
                        "board_decls": "",
@@ -528,7 +528,7 @@
                        "pre_op_register": "",
                        }
         for child in self.IECSortedChildren():
-            childlocstr = "_".join(map(str,child.GetCurrentLocation()))
+            childlocstr = "_".join(map(str, child.GetCurrentLocation()))
             nodename = "OD_%s" % childlocstr
 
             # Try to get Slave Node
@@ -557,13 +557,13 @@
                         "}\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))
+                    "%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])+
                     "}\n")
                 format_dict["pre_op_register"] += (
-                    "%s_Data.preOperational = %s_preOperational;\n" % (nodename,nodename))
+                    "%s_Data.preOperational = %s_preOperational;\n" % (nodename, nodename))
             else:
                 # Slave node
                 align = child_data.getSync_Align()
@@ -580,7 +580,7 @@
                         "    }\n"+
                         "}\n")
                     format_dict["post_sync_register"] += (
-                        "%s_Data.post_sync = %s_post_sync;\n" % (nodename,nodename))
+                        "%s_Data.post_sync = %s_post_sync;\n" % (nodename, nodename))
                 format_dict["nodes_init"] += 'NODE_SLAVE_INIT(%s, %s)\n    ' % (
                        nodename,
                        child_data.getNodeId())
@@ -596,18 +596,18 @@
             format_dict["nodes_close"] += 'NODE_CLOSE(%s)\n    ' % (nodename)
             format_dict["nodes_stop"] += 'NODE_STOP(%s)\n    ' % (nodename)
 
-        filename = paths.AbsNeighbourFile(__file__,"cf_runtime.c")
+        filename = paths.AbsNeighbourFile(__file__, "cf_runtime.c")
         cf_main = open(filename).read() % format_dict
         cf_main_path = os.path.join(buildpath, "CF_%(locstr)s.c" % format_dict)
-        f = open(cf_main_path,'w')
+        f = open(cf_main_path, 'w')
         f.write(cf_main)
         f.close()
 
-        res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))],local_canfestival_config.getLDFLAGS(CanFestivalPath), True
+        res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))], local_canfestival_config.getLDFLAGS(CanFestivalPath), True
 
         if can_driver is not None:
-            can_driver_path = os.path.join(CanFestivalPath,"drivers",can_driver,can_driver_name)
+            can_driver_path = os.path.join(CanFestivalPath, "drivers", can_driver, can_driver_name)
             if os.path.exists(can_driver_path):
-                res += ((can_driver_name, file(can_driver_path,"rb")),)
+                res += ((can_driver_name, file(can_driver_path, "rb")),)
 
         return res
--- a/canfestival/config_utils.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/canfestival/config_utils.py	Tue Aug 15 15:50:30 2017 +0300
@@ -25,10 +25,25 @@
 from types import *
 
 # Translation between IEC types and Can Open types
-IECToCOType = {"BOOL":0x01, "SINT":0x02, "INT":0x03,"DINT":0x04,"LINT":0x10,
-               "USINT":0x05,"UINT":0x06,"UDINT":0x07,"ULINT":0x1B,"REAL":0x08,
-               "LREAL":0x11,"STRING":0x09,"BYTE":0x05,"WORD":0x06,"DWORD":0x07,
-               "LWORD":0x1B,"WSTRING":0x0B}
+IECToCOType = {
+    "BOOL":    0x01,
+    "SINT":    0x02,
+    "INT":     0x03,
+    "DINT":    0x04,
+    "LINT":    0x10,
+    "USINT":   0x05,
+    "UINT":    0x06,
+    "UDINT":   0x07,
+    "ULINT":   0x1B,
+    "REAL":    0x08,
+    "LREAL":   0x11,
+    "STRING":  0x09,
+    "BYTE":    0x05,
+    "WORD":    0x06,
+    "DWORD":   0x07,
+    "LWORD":   0x1B,
+    "WSTRING": 0x0B
+}
 
 # Constants for PDO types
 RPDO = 1
@@ -42,7 +57,7 @@
 VariableIncrement = 0x100
 VariableStartIndex = {TPDO: 0x2000, RPDO: 0x4000}
 VariableDirText = {TPDO: "__I", RPDO: "__Q"}
-VariableTypeOffset = dict(zip(["","X","B","W","D","L"], range(6)))
+VariableTypeOffset = dict(zip(["", "X", "B", "W", "D", "L"], range(6)))
 
 TrashVariables = [(1, 0x01), (8, 0x05), (16, 0x06), (32, 0x07), (64, 0x1B)]
 
@@ -222,10 +237,10 @@
             RPDOnumber, TPDOnumber = self.RemoveUsedNodeCobId(node)
 
             # Get Slave's default SDO server parameters
-            RSDO_cobid = node.GetEntry(0x1200,0x01)
+            RSDO_cobid = node.GetEntry(0x1200, 0x01)
             if not RSDO_cobid:
                 RSDO_cobid = 0x600 + nodeid
-            TSDO_cobid = node.GetEntry(0x1200,0x02)
+            TSDO_cobid = node.GetEntry(0x1200, 0x02)
             if not TSDO_cobid:
                 TSDO_cobid = 0x580 + nodeid
 
@@ -384,9 +399,16 @@
                             format(a1 = location["IEC_TYPE"], a2 = COlocationtype, a3 = subentry_infos["type"], a4 = name)
 
                     typeinfos = node.GetEntryInfos(COlocationtype)
-                    self.IECLocations[name] = {"type":COlocationtype, "pdotype":SlavePDOType[direction],
-                                                "nodeid": nodeid, "index": index,"subindex": subindex,
-                                                "bit": numbit, "size": typeinfos["size"], "sizelocation": sizelocation}
+                    self.IECLocations[name] = {
+                        "type":         COlocationtype,
+                        "pdotype":      SlavePDOType[direction],
+                        "nodeid":       nodeid,
+                        "index":        index,
+                        "subindex":     subindex,
+                        "bit":          numbit,
+                        "size":         typeinfos["size"],
+                        "sizelocation": sizelocation
+                    }
                 else:
                     raise PDOmappingException, _("Not PDO mappable variable : '{a1}' (ID:{a2},Idx:{a3},sIdx:{a4}))").\
                         format(a1 = name, a2 = nodeid, a3 = "%x" % index, a4 = "%x" % subindex)
@@ -550,7 +572,7 @@
                     # Generate entry name
                     indexname = "%s%s%s_%d" % (VariableDirText[variable_infos["pdotype"]],
                                                  variable_infos["sizelocation"],
-                                                 '_'.join(map(str,current_location)),
+                                                 '_'.join(map(str, current_location)),
                                                  variable_infos["nodeid"])
 
                     # Search for an entry that has an empty subindex
@@ -611,10 +633,10 @@
 
     dcfgenerator = ConciseDCFGenerator(nodelist, nodename)
     dcfgenerator.GenerateDCF(locations, current_location, sync_TPDOs)
-    masternode,pointers = dcfgenerator.GetMasterNode(), dcfgenerator.GetPointedVariables()
+    masternode, pointers = dcfgenerator.GetMasterNode(), dcfgenerator.GetPointedVariables()
     # allow access to local OD from Master PLC
     pointers.update(LocalODPointers(locations, current_location, masternode))
-    return masternode,pointers
+    return masternode, pointers
 
 
 def LocalODPointers(locations, current_location, slave):
@@ -679,7 +701,7 @@
 
     # Extract command options
     try:
-        opts, args = getopt.getopt(sys.argv[1:], "hr", ["help","reset"])
+        opts, args = getopt.getopt(sys.argv[1:], "hr", ["help", "reset"])
     except getopt.GetoptError:
         # print help information and exit:
         usage()
@@ -709,16 +731,18 @@
     result = nodelist.LoadProject("test_config")
 
     # List of locations, we try to map for test
-    locations = [{"IEC_TYPE":"BYTE","NAME":"__IB0_1_64_24576_1","DIR":"I","SIZE":"B","LOC":(0,1,64,24576,1)},
-                 {"IEC_TYPE":"INT","NAME":"__IW0_1_64_25601_2","DIR":"I","SIZE":"W","LOC":(0,1,64,25601,2)},
-                 {"IEC_TYPE":"INT","NAME":"__IW0_1_64_25601_3","DIR":"I","SIZE":"W","LOC":(0,1,64,25601,3)},
-                 {"IEC_TYPE":"INT","NAME":"__QW0_1_64_25617_2","DIR":"Q","SIZE":"W","LOC":(0,1,64,25617,1)},
-                 {"IEC_TYPE":"BYTE","NAME":"__IB0_1_64_24578_1","DIR":"I","SIZE":"B","LOC":(0,1,64,24578,1)},
-                 {"IEC_TYPE":"UDINT","NAME":"__ID0_1_64_25638_1","DIR":"I","SIZE":"D","LOC":(0,1,64,25638,1)},
-                 {"IEC_TYPE":"UDINT","NAME":"__ID0_1_64_25638_2","DIR":"I","SIZE":"D","LOC":(0,1,64,25638,2)},
-                 {"IEC_TYPE":"UDINT","NAME":"__ID0_1_64_25638_3","DIR":"I","SIZE":"D","LOC":(0,1,64,25638,3)},
-                 {"IEC_TYPE":"UDINT","NAME":"__ID0_1_64_25638_4","DIR":"I","SIZE":"D","LOC":(0,1,64,25638,4)},
-                 {"IEC_TYPE":"UDINT","NAME":"__ID0_1_4096_0","DIR":"I","SIZE":"D","LOC":(0,1,4096,0)}]
+    locations = [
+        {"IEC_TYPE": "BYTE",  "NAME": "__IB0_1_64_24576_1", "DIR": "I", "SIZE": "B", "LOC": (0, 1, 64, 24576, 1)},
+        {"IEC_TYPE": "INT",   "NAME": "__IW0_1_64_25601_2", "DIR": "I", "SIZE": "W", "LOC": (0, 1, 64, 25601, 2)},
+        {"IEC_TYPE": "INT",   "NAME": "__IW0_1_64_25601_3", "DIR": "I", "SIZE": "W", "LOC": (0, 1, 64, 25601, 3)},
+        {"IEC_TYPE": "INT",   "NAME": "__QW0_1_64_25617_2", "DIR": "Q", "SIZE": "W", "LOC": (0, 1, 64, 25617, 1)},
+        {"IEC_TYPE": "BYTE",  "NAME": "__IB0_1_64_24578_1", "DIR": "I", "SIZE": "B", "LOC": (0, 1, 64, 24578, 1)},
+        {"IEC_TYPE": "UDINT", "NAME": "__ID0_1_64_25638_1", "DIR": "I", "SIZE": "D", "LOC": (0, 1, 64, 25638, 1)},
+        {"IEC_TYPE": "UDINT", "NAME": "__ID0_1_64_25638_2", "DIR": "I", "SIZE": "D", "LOC": (0, 1, 64, 25638, 2)},
+        {"IEC_TYPE": "UDINT", "NAME": "__ID0_1_64_25638_3", "DIR": "I", "SIZE": "D", "LOC": (0, 1, 64, 25638, 3)},
+        {"IEC_TYPE": "UDINT", "NAME": "__ID0_1_64_25638_4", "DIR": "I", "SIZE": "D", "LOC": (0, 1, 64, 25638, 4)},
+        {"IEC_TYPE": "UDINT", "NAME": "__ID0_1_4096_0",     "DIR": "I", "SIZE": "D", "LOC": (0, 1, 4096, 0)}
+    ]
 
     # Generate MasterNode configuration
     try:
--- a/connectors/WAMP/__init__.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/connectors/WAMP/__init__.py	Tue Aug 15 15:50:30 2017 +0300
@@ -65,8 +65,8 @@
     """
     servicetype, location = uri.split("://")
     urlpath, realm, ID = location.split('#')
-    urlprefix = {"WAMP":"ws",
-                 "WAMPS":"wss"}[servicetype]
+    urlprefix = {"WAMP":  "ws",
+                 "WAMPS": "wss"}[servicetype]
     url = urlprefix+"://"+urlpath
 
     def RegisterWampClient():
@@ -77,7 +77,7 @@
         # create a WAMP application session factory
         component_config = types.ComponentConfig(
             realm = realm,
-            extra = {"ID":ID})
+            extra = {"ID": ID})
         session_factory = wamp.ApplicationSessionFactory(
             config = component_config)
         session_factory.session = WampSession
@@ -103,18 +103,18 @@
         reactor.run(installSignalHandlers=False)
 
     def WampSessionProcMapper(funcname):
-        wampfuncname = '.'.join((ID,funcname))
-        def catcher_func(*args,**kwargs):
+        wampfuncname = '.'.join((ID, funcname))
+        def catcher_func(*args, **kwargs):
             global _WampSession
             if _WampSession is not None:
                 try:
                     return threads.blockingCallFromThread(
                         reactor, _WampSession.call, wampfuncname,
-                        *args,**kwargs)
+                        *args, **kwargs)
                 except TransportLost, e:
                     confnodesroot.logger.write_error(_("Connection lost!\n"))
                     confnodesroot._SetConnector(None)
-                except Exception,e:
+                except Exception, e:
                     errmess = traceback.format_exc()
                     confnodesroot.logger.write_error(errmess+"\n")
                     print errmess
--- a/connectors/__init__.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/connectors/__init__.py	Tue Aug 15 15:50:30 2017 +0300
@@ -34,7 +34,7 @@
 def _GetLocalConnectorClassFactory(name):
     return lambda: getattr(__import__(name, globals(), locals()), name + "_connector_factory")
 
-connectors = {name:_GetLocalConnectorClassFactory(name)
+connectors = {name: _GetLocalConnectorClassFactory(name)
                   for name in listdir(_base_path)
                       if path.isdir(path.join(_base_path, name))
                           and not name.startswith("__")}
--- a/controls/CustomTable.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/controls/CustomTable.py	Tue Aug 15 15:50:30 2017 +0300
@@ -92,10 +92,10 @@
             (self._cols, self.GetNumberCols(), wx.grid.GRIDTABLE_NOTIFY_COLS_DELETED, wx.grid.GRIDTABLE_NOTIFY_COLS_APPENDED),
         ]:
             if new < current:
-                msg = wx.grid.GridTableMessage(self,delmsg,new,current-new)
+                msg = wx.grid.GridTableMessage(self, delmsg, new, current-new)
                 grid.ProcessTableMessage(msg)
             elif new > current:
-                msg = wx.grid.GridTableMessage(self,addmsg,new-current)
+                msg = wx.grid.GridTableMessage(self, addmsg, new-current)
                 grid.ProcessTableMessage(msg)
                 self.UpdateValues(grid)
         grid.EndBatch()
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Tue Aug 15 15:50:30 2017 +0300
@@ -584,8 +584,8 @@
             # Search for the nearest point from mouse position
             if len(x_data) > 0 and len(y_data) > 0:
                 length = min(len(x_data), len(y_data))
-                d = numpy.sqrt((x_data[:length,1]-event.xdata) ** 2 + \
-                               (y_data[:length,1]-event.ydata) ** 2)
+                d = numpy.sqrt((x_data[:length, 1]-event.xdata) ** 2 + \
+                               (y_data[:length, 1]-event.ydata) ** 2)
 
                 # Set cursor tick to the tick of this point
                 cursor_tick = x_data[numpy.argmin(d), 0]
@@ -599,7 +599,7 @@
             # and set cursor tick to the tick of this point
             if len(data) > 0:
                 cursor_tick = data[numpy.argmin(
-                        numpy.abs(data[:,0] - event.xdata)), 0]
+                        numpy.abs(data[:, 0] - event.xdata)), 0]
 
         # Update cursor tick
         if cursor_tick is not None:
@@ -985,7 +985,7 @@
 
     def SetAxesColor(self, color):
         if LooseVersion(matplotlib.__version__) >= LooseVersion("1.5.0"):
-            self.Axes.set_prop_cycle(cycler('color',color))
+            self.Axes.set_prop_cycle(cycler('color', color))
         else:
             self.Axes.set_color_cycle(color)
 
--- a/controls/LogViewer.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/controls/LogViewer.py	Tue Aug 15 15:50:30 2017 +0300
@@ -418,7 +418,7 @@
                     oldest_message = (-1, None)
                 else:
                     dump_end = prev - 1
-                for msgidx in xrange(count-1, dump_end,-1):
+                for msgidx in xrange(count-1, dump_end, -1):
                     new_message = self.GetLogMessageFromSource(msgidx, level)
                     if new_message is None:
                         if prev is None:
--- a/controls/PouInstanceVariablesPanel.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/controls/PouInstanceVariablesPanel.py	Tue Aug 15 15:50:30 2017 +0300
@@ -148,7 +148,7 @@
                        getattr(CT, "TR_ALIGN_WINDOWS_RIGHT", CT.TR_ALIGN_WINDOWS))
         self.VariablesList.SetIndent(0)
         self.VariablesList.SetSpacing(5)
-        self.VariablesList.DoSelectItem = lambda *x,**y:True
+        self.VariablesList.DoSelectItem = lambda *x, **y: True
         self.VariablesList.Bind(CT.EVT_TREE_ITEM_ACTIVATED,
                 self.OnVariablesListItemActivated)
         self.VariablesList.Bind(wx.EVT_LEFT_DOWN, self.OnVariablesListLeftDown)
--- a/controls/ProjectPropertiesPanel.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/controls/ProjectPropertiesPanel.py	Tue Aug 15 15:50:30 2017 +0300
@@ -142,7 +142,7 @@
               flag=wx.GROW|wx.BOTTOM|wx.LEFT|wx.RIGHT)
 
         self.Scalings = {}
-        for language, translation in [("FBD",_("FBD")), ("LD",_("LD")), ("SFC",_("SFC"))]:
+        for language, translation in [("FBD", _("FBD")), ("LD", _("LD")), ("SFC", _("SFC"))]:
             scaling_panel = wx.Panel(scaling_nb, style=wx.TAB_TRAVERSAL)
             scalingpanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=5)
             scalingpanel_sizer.AddGrowableCol(1)
@@ -201,7 +201,7 @@
               flag=wx.BOTTOM|wx.LEFT)
 
         self.ContentDescription = wx.TextCtrl(self.MiscellaneousPanel,
-              size=wx.Size(240,150), style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER)
+              size=wx.Size(240, 150), style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER)
         self.Bind(wx.EVT_TEXT_ENTER, self.OnContentDescriptionChanged,
               self.ContentDescription)
         self.ContentDescription.Bind(wx.EVT_KILL_FOCUS,
--- a/controls/VariablePanel.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/controls/VariablePanel.py	Tue Aug 15 15:50:30 2017 +0300
@@ -211,7 +211,7 @@
                                 editor = wx.grid.GridCellChoiceEditor()
                                 excluded = []
                                 if self.Parent.IsFunctionBlockType(var_type):
-                                    excluded.extend(["Local","Temp"])
+                                    excluded.extend(["Local", "Temp"])
                                 editor.SetParameters(",".join([_(choice) for choice in self.Parent.ClassList if choice not in excluded]))
                     elif colname != "Documentation":
                         grid.SetReadOnly(row, col, True)
@@ -323,7 +323,7 @@
             elif (element_type not in ["config", "resource", "function"] and values[1] == "Global" and
                   self.ParentWindow.Filter in ["All", "Interface", "External"] or
                   element_type != "function" and values[1] in ["location", "NamedConstant"]):
-                if values[1] in ["location","NamedConstant"]:
+                if values[1] in ["location", "NamedConstant"]:
                     var_name = values[3]
                 else:
                     var_name = values[0]
@@ -386,7 +386,7 @@
                                 var_infos.Class = "Global"
                             var_infos.Location = location
                     elif values[1] == "NamedConstant":
-                        if element_type in ["functionBlock","program"]:
+                        if element_type in ["functionBlock", "program"]:
                             var_infos.Class = "Local"
                             var_infos.InitialValue = values[0]
                         else:
@@ -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)
 
@@ -753,11 +753,11 @@
 
     def RefreshTypeList(self):
         if self.Filter == "All":
-            self.ClassList = [self.FilterChoiceTransfer[choice] for choice in self.FilterChoices if self.FilterChoiceTransfer[choice] not in ["All","Interface","Variables"]]
+            self.ClassList = [self.FilterChoiceTransfer[choice] for choice in self.FilterChoices if self.FilterChoiceTransfer[choice] not in ["All", "Interface", "Variables"]]
         elif self.Filter == "Interface":
-            self.ClassList = ["Input","Output","InOut","External"]
+            self.ClassList = ["Input", "Output", "InOut", "External"]
         elif self.Filter == "Variables":
-            self.ClassList = ["Local","Temp"]
+            self.ClassList = ["Local", "Temp"]
         else:
             self.ClassList = [self.Filter]
 
@@ -811,7 +811,7 @@
                 self.RefreshValues()
                 self.SaveValues()
 
-    def BuildStdIECTypesMenu(self,type_menu):
+    def BuildStdIECTypesMenu(self, type_menu):
             # build a submenu containing standard IEC types
             base_menu = wx.Menu(title='')
             for base_type in self.Controler.GetBaseTypes():
@@ -821,7 +821,7 @@
 
             type_menu.AppendMenu(wx.NewId(), _("Base Types"), base_menu)
 
-    def BuildUserTypesMenu(self,type_menu):
+    def BuildUserTypesMenu(self, type_menu):
             # build a submenu containing user-defined types
             datatype_menu = wx.Menu(title='')
             datatypes = self.Controler.GetDataTypes(basetypes = False, confnodetypes = False)
@@ -879,7 +879,7 @@
 
             self.BuildLibsTypesMenu(type_menu)
 
-            self.BuildProjectTypesMenu(type_menu,classtype)
+            self.BuildProjectTypesMenu(type_menu, classtype)
 
             self.BuildArrayTypesMenu(type_menu)
 
--- a/dialogs/ActionBlockDialog.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/dialogs/ActionBlockDialog.py	Tue Aug 15 15:50:30 2017 +0300
@@ -165,7 +165,7 @@
 
         self.Table = ActionTable(self, [], GetActionTableColnames())
         typelist = GetTypeList()
-        self.TypeList = ",".join(map(_,typelist))
+        self.TypeList = ",".join(map(_, typelist))
         self.TranslateType = dict([(_(value), value) for value in typelist])
         self.ColSizes = [60, 90, 130, 200, 50]
         self.ColAlignements = [wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]
--- a/dialogs/BlockPreviewDialog.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/dialogs/BlockPreviewDialog.py	Tue Aug 15 15:50:30 2017 +0300
@@ -62,8 +62,8 @@
 
         # Add function to preview panel so that it answers to graphic elements
         # like Viewer
-        setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE)
-        setattr(self.Preview, "GetScaling", lambda:None)
+        setattr(self.Preview, "GetDrawingMode", lambda: FREEDRAWING_MODE)
+        setattr(self.Preview, "GetScaling", lambda: None)
         setattr(self.Preview, "GetBlockType", controller.GetBlockType)
         setattr(self.Preview, "IsOfType", controller.IsOfType)
 
--- a/dialogs/ConnectionDialog.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/dialogs/ConnectionDialog.py	Tue Aug 15 15:50:30 2017 +0300
@@ -78,12 +78,12 @@
 
         # Create text control for defining connection name
         self.ConnectionName = wx.TextCtrl(self)
-        self.ConnectionName.SetMinSize(wx.Size(200,-1))
+        self.ConnectionName.SetMinSize(wx.Size(200, -1))
         self.Bind(wx.EVT_TEXT, self.OnNameChanged, self.ConnectionName)
         self.LeftGridSizer.AddWindow(self.ConnectionName, flag=wx.GROW)
 
         # Add preview panel and associated label to sizers
-        self.Preview.SetMinSize(wx.Size(-1,100))
+        self.Preview.SetMinSize(wx.Size(-1, 100))
         self.LeftGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW)
         self.LeftGridSizer.AddWindow(self.Preview, flag=wx.GROW)
 
--- a/dialogs/DiscoveryDialog.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/dialogs/DiscoveryDialog.py	Tue Aug 15 15:50:30 2017 +0300
@@ -157,8 +157,8 @@
 
     def OnIpButton(self, event):
         if self.LatestSelection is not None:
-            l = lambda col: self.getColumnText(self.LatestSelection,col)
-            self.URI = "%s://%s:%s" % tuple(map(l,(1,2,3)))
+            l = lambda col: self.getColumnText(self.LatestSelection, col)
+            self.URI = "%s://%s:%s" % tuple(map(l, (1, 2, 3)))
             self.EndModal(wx.ID_OK)
         event.Skip()
 
--- a/dialogs/FBDVariableDialog.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/dialogs/FBDVariableDialog.py	Tue Aug 15 15:50:30 2017 +0300
@@ -101,7 +101,7 @@
 
         # Create a list box to selected variable expression in the list of
         # variables defined in POU
-        self.VariableName = wx.ListBox(self, size=wx.Size(-1,120),
+        self.VariableName = wx.ListBox(self, size=wx.Size(-1, 120),
               style=wx.LB_SINGLE|wx.LB_SORT)
         self.Bind(wx.EVT_LISTBOX, self.OnNameChanged, self.VariableName)
         self.RightGridSizer.AddWindow(self.VariableName, border=4, flag=wx.GROW|wx.TOP)
--- a/dialogs/FindInPouDialog.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/dialogs/FindInPouDialog.py	Tue Aug 15 15:50:30 2017 +0300
@@ -179,6 +179,6 @@
             self.SetStatusText(message)
         if len(self.criteria) > 0:
             wx.CallAfter(self.ParentWindow.FindInPou,
-                {True: 1, False:-1}[self.Forward.GetValue()],
+                {True: 1, False: -1}[self.Forward.GetValue()],
                 self.criteria)
         event.Skip()
--- a/dialogs/PouActionDialog.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/dialogs/PouActionDialog.py	Tue Aug 15 15:50:30 2017 +0300
@@ -52,7 +52,7 @@
         infos_sizer.AddWindow(actionname_label, border=4,
               flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP)
 
-        self.ActionName = wx.TextCtrl(self, size=wx.Size(180,-1))
+        self.ActionName = wx.TextCtrl(self, size=wx.Size(180, -1))
         infos_sizer.AddWindow(self.ActionName, flag=wx.GROW)
 
         language_label = wx.StaticText(self, label=_('Language:'))
--- a/dialogs/PouTransitionDialog.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/dialogs/PouTransitionDialog.py	Tue Aug 15 15:50:30 2017 +0300
@@ -56,7 +56,7 @@
         infos_sizer.AddWindow(transitionname_label, border=4,
               flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP)
 
-        self.TransitionName = wx.TextCtrl(self, size=wx.Size(180,-1))
+        self.TransitionName = wx.TextCtrl(self, size=wx.Size(180, -1))
         infos_sizer.AddWindow(self.TransitionName, flag=wx.GROW)
 
         language_label = wx.StaticText(self, label=_('Language:'))
--- a/dialogs/SFCStepDialog.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/dialogs/SFCStepDialog.py	Tue Aug 15 15:50:30 2017 +0300
@@ -47,7 +47,7 @@
         @param tagname: Tagname of project POU edited
         @param initial: True if step is initial (default: False)
         """
-        BlockPreviewDialog.__init__(self,parent, controller, tagname,
+        BlockPreviewDialog.__init__(self, parent, controller, tagname,
               title=_('Edit Step'))
 
         # Init common sizers
--- a/dialogs/SearchInProjectDialog.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/dialogs/SearchInProjectDialog.py	Tue Aug 15 15:50:30 2017 +0300
@@ -61,7 +61,7 @@
         self.CaseSensitive = wx.CheckBox(self, label=_('Case sensitive'))
         pattern_sizer.AddWindow(self.CaseSensitive, flag=wx.GROW)
 
-        self.Pattern = wx.TextCtrl(self, size=wx.Size(250,-1))
+        self.Pattern = wx.TextCtrl(self, size=wx.Size(250, -1))
         self.Bind(wx.EVT_TEXT, self.FindPatternChanged, self.Pattern)
         pattern_sizer.AddWindow(self.Pattern, flag=wx.GROW)
         self.Bind(wx.EVT_CHAR_HOOK, self.OnEscapeKey)
--- a/docutil/docpdf.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/docutil/docpdf.py	Tue Aug 15 15:50:30 2017 +0300
@@ -76,7 +76,7 @@
         else:
             return None
     else:
-        readerexepath = os.path.join("/usr/bin","xpdf")
+        readerexepath = os.path.join("/usr/bin", "xpdf")
         if(os.path.isfile(readerexepath)):
             open_lin_pdf(readerexepath, pdffile, pagenum)
         else:
--- a/docutil/docsvg.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/docutil/docsvg.py	Tue Aug 15 15:50:30 2017 +0300
@@ -59,7 +59,7 @@
             wx.MessageBox("Inkscape is not found or installed !")
             return None
     else:
-        svgexepath = os.path.join("/usr/bin","inkscape")
+        svgexepath = os.path.join("/usr/bin", "inkscape")
         if(os.path.isfile(svgexepath)):
             open_lin_svg(svgexepath, svgfile)
         else:
--- a/editors/CodeFileEditor.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/editors/CodeFileEditor.py	Tue Aug 15 15:50:30 2017 +0300
@@ -63,7 +63,7 @@
 
         self.SetProperty("fold", "1")
         self.SetProperty("tab.timmy.whinge.level", "1")
-        self.SetMargins(0,0)
+        self.SetMargins(0, 0)
 
         self.SetViewWhiteSpace(False)
 
@@ -677,8 +677,14 @@
         self.ParentWindow = window
         self.Controler = controler
 
-        self.VariablesDefaultValue = {"Name": "", "Type": DefaultType, "Initial": "",
-                                      "Description":"", "OnChange":"", "Options":""}
+        self.VariablesDefaultValue = {
+            "Name":        "",
+            "Type":        DefaultType,
+            "Initial":     "",
+            "Description": "",
+            "OnChange":    "",
+            "Options":     ""
+        }
         self.Table = VariablesTable(self, [], self.GetVariableTableColnames())
         self.ColAlignements = [wx.ALIGN_RIGHT] +  \
                               [wx.ALIGN_LEFT]*(len(self.VariablesDefaultValue))
@@ -737,7 +743,7 @@
 
     def GetVariableTableColnames(self):
         _ = lambda x: x
-    	return ["#", _("Name"),_("Type"), _("Initial"), _("Description"), _("OnChange"), _("Options")]
+    	return ["#", _("Name"), _("Type"), _("Initial"), _("Description"), _("OnChange"), _("Options")]
 
     def RefreshModel(self):
         self.Controler.SetVariables(self.Table.GetData())
--- a/editors/ConfTreeNodeEditor.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/editors/ConfTreeNodeEditor.py	Tue Aug 15 15:50:30 2017 +0300
@@ -79,7 +79,7 @@
                 bmp = self.bmpFocus
             if self.bmpSelected and not self.up:
                 bmp = self.bmpSelected
-            bw,bh = bmp.GetWidth(), bmp.GetHeight()
+            bw, bh = bmp.GetWidth(), bmp.GetHeight()
             if not self.up:
                 dw = dy = self.labelDelta
             hasMask = bmp.GetMask() != None
@@ -302,7 +302,7 @@
         msizer = wx.BoxSizer(wx.HORIZONTAL)
 
         for confnode_method in self.Controler.ConfNodeMethods:
-            if "method" in confnode_method and confnode_method.get("shown",True):
+            if "method" in confnode_method and confnode_method.get("shown", True):
                 button = GenBitmapTextButton(self.Editor,
                     bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")),
                     label=confnode_method["name"], style=wx.NO_BORDER)
@@ -322,7 +322,7 @@
                 button.Bind(wx.EVT_ENTER_WINDOW, setFontStyle(button, mouseover_bt_font))
                 button.Bind(wx.EVT_LEAVE_WINDOW, setFontStyle(button, normal_bt_font))
                 # hack to force size to mini
-                if not confnode_method.get("enabled",True):
+                if not confnode_method.get("enabled", True):
                     button.Disable()
                 msizer.AddWindow(button, flag=wx.ALIGN_CENTER)
         return msizer
@@ -445,7 +445,7 @@
                                       self.GetCheckBoxCallBackFunction(checkbox, element_path),
                                       checkbox)
 
-                    elif element_infos["type"] in ["unsignedLong", "long","integer"]:
+                    elif element_infos["type"] in ["unsignedLong", "long", "integer"]:
                         if element_infos["type"].startswith("unsigned"):
                             scmin = 0
                         else:
@@ -502,7 +502,7 @@
             # Disable button to prevent re-entrant call
             event.GetEventObject().Disable()
             # Call
-            getattr(self.Controler,method)()
+            getattr(self.Controler, method)()
             # Re-enable button
             event.GetEventObject().Enable()
 
--- a/editors/LDViewer.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/editors/LDViewer.py	Tue Aug 15 15:50:30 2017 +0300
@@ -60,11 +60,11 @@
     element_tree = {}
     for element in elements:
         if element not in element_tree:
-            element_tree[element] = {"parents":["start"], "children":[], "weight":None}
+            element_tree[element] = {"parents": ["start"], "children": [], "weight": None}
             GenerateTree(element, element_tree, stop_list)
         elif element_tree[element]:
             element_tree[element]["parents"].append("start")
-    remove_stops = {"start":[], "stop":[]}
+    remove_stops = {"start": [], "stop": []}
     for element, values in element_tree.items():
         if "stop" in values["children"]:
             removed = []
@@ -129,7 +129,7 @@
                     if next in element_tree:
                         element_tree[next]["parents"].append(element)
                     else:
-                        element_tree[next] = {"parents":[element], "children":[], "weight":None}
+                        element_tree[next] = {"parents": [element], "children": [], "weight": None}
                         GenerateTree(next, element_tree, stop_list)
 
 
@@ -494,7 +494,7 @@
         if returntype == "BOOL":
             varlist.append(self.Controler.GetEditedElementName(self.TagName))
         dialog.SetVariables(varlist)
-        dialog.SetValues({"name":"","type":COIL_NORMAL})
+        dialog.SetValues({"name": "", "type": COIL_NORMAL})
         if dialog.ShowModal() == wx.ID_OK:
             values = dialog.GetValues()
             startx, starty = LD_OFFSET[0], 0
@@ -577,7 +577,7 @@
             left_element = self.SelectedElement.EndConnected
             if not isinstance(left_element.GetParentBlock(), LD_Coil):
                 wires.append(self.SelectedElement)
-        elif self.SelectedElement and isinstance(self.SelectedElement,Graphic_Group):
+        elif self.SelectedElement and isinstance(self.SelectedElement, Graphic_Group):
             if False not in [self.IsWire(element) for element in self.SelectedElement.GetElements()]:
                 for element in self.SelectedElement.GetElements():
                     wires.append(element)
@@ -591,7 +591,7 @@
                     if var.Class != "Output" and var.Type == "BOOL":
                         varlist.append(var.Name)
             dialog.SetVariables(varlist)
-            dialog.SetValues({"name":"","type":CONTACT_NORMAL})
+            dialog.SetValues({"name": "", "type": CONTACT_NORMAL})
             if dialog.ShowModal() == wx.ID_OK:
                 values = dialog.GetValues()
                 points = wires[0].GetSelectedSegmentPoints()
@@ -686,7 +686,7 @@
             right_index = []
             for block in blocks:
                 connectors = block.GetConnectors()
-                block_infos = {"lefts":[],"rights":[]}
+                block_infos = {"lefts": [], "rights": []}
                 block_infos.update(connectors)
                 for connector in block_infos["inputs"]:
                     for wire, handle in connector.GetWires():
@@ -808,7 +808,7 @@
                         if returntype == "BOOL":
                             varlist.append(self.Controler.GetEditedElementName(self.TagName))
                         dialog.SetVariables(varlist)
-                        dialog.SetValues({"name":"","type":COIL_NORMAL})
+                        dialog.SetValues({"name": "", "type": COIL_NORMAL})
                         if dialog.ShowModal() == wx.ID_OK:
                             values = dialog.GetValues()
                             powerrail = right_elements[0].GetParentBlock()
--- a/editors/ResourceEditor.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/editors/ResourceEditor.py	Tue Aug 15 15:50:30 2017 +0300
@@ -158,12 +158,12 @@
                     if interval != "" and IEC_TIME_MODEL.match(interval.upper()) is None:
                         error = True
                 elif colname == "Single":
-                    editor = SingleCellEditor(self,colname)
+                    editor = SingleCellEditor(self, colname)
                     editor.SetParameters(self.Parent.VariableList)
                     if self.GetValueByName(row, "Triggering") != "Interrupt":
                         grid.SetReadOnly(row, col, True)
                     single = self.GetValueByName(row, colname)
-                    if single != "" and not CheckSingle(single,self.Parent.VariableList):
+                    if single != "" and not CheckSingle(single, self.Parent.VariableList):
                         error = True
                 elif colname == "Triggering":
                     editor = wx.grid.GridCellChoiceEditor()
--- a/editors/SFCViewer.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/editors/SFCViewer.py	Tue Aug 15 15:50:30 2017 +0300
@@ -341,9 +341,9 @@
         return blockName
 
     # 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)\
-                                                               or isinstance(endblock,SFC_Objects)):
+    def BlockCompatibility(self, startblock = None, endblock = None, direction = None):
+        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.
             if (direction == SOUTH or direction == EAST):
--- a/editors/Viewer.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/editors/Viewer.py	Tue Aug 15 15:50:30 2017 +0300
@@ -689,7 +689,7 @@
 
         # Adding a rubberband to Viewer
         self.rubberBand = RubberBand(viewer=self)
-        self.Editor.SetBackgroundColour(wx.Colour(255,255,255))
+        self.Editor.SetBackgroundColour(wx.Colour(255, 255, 255))
         self.Editor.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
         self.ResetView()
         self.LastClientSize = None
@@ -2647,7 +2647,7 @@
             comment = Comment(self, value, id)
             comment.SetPosition(bbox.x, bbox.y)
             min_width, min_height = comment.GetMinSize()
-            comment.SetSize(*self.GetScaledSize(max(min_width,bbox.width),max(min_height,bbox.height)))
+            comment.SetSize(*self.GetScaledSize(max(min_width, bbox.width), max(min_height, bbox.height)))
             self.AddComment(comment)
             self.Controler.AddEditedElementComment(self.TagName, id)
             self.RefreshCommentModel(comment)
@@ -2703,11 +2703,11 @@
     def AddNewStep(self, bbox, initial=False, wire=None):
         if wire is not None:
             values = {
-                "name": self.Controler.GenerateNewName(
-                    self.TagName, None, "Step%d", 0),
-                "input": True,
+                "name":   self.Controler.GenerateNewName(self.TagName, None, "Step%d", 0),
+                "input":  True,
                 "output": True,
-                "action":False}
+                "action": False
+            }
         else:
             dialog = SFCStepDialog(self.ParentWindow, self.Controler, self.TagName, initial)
             dialog.SetPreviewFont(self.GetFont())
@@ -3010,11 +3010,15 @@
         dialog = SFCTransitionDialog(self.ParentWindow, self.Controler, self.TagName, self.GetDrawingMode() == FREEDRAWING_MODE)
         dialog.SetPreviewFont(self.GetFont())
         dialog.SetMinElementSize(transition.GetSize())
-        dialog.SetValues({"type":transition.GetType(),"value":transition.GetCondition(), "priority":transition.GetPriority()})
+        dialog.SetValues({
+            "type":     transition.GetType(),
+            "value":    transition.GetCondition(),
+            "priority": transition.GetPriority()
+        })
         if dialog.ShowModal() == wx.ID_OK:
             values = dialog.GetValues()
             rect = transition.GetRedrawRect(1, 1)
-            transition.SetType(values["type"],values["value"])
+            transition.SetType(values["type"], values["value"])
             transition.SetPriority(values["priority"])
             rect = rect.Union(transition.GetRedrawRect())
             self.RefreshTransitionModel(transition)
--- a/graphics/FBD_Objects.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/graphics/FBD_Objects.py	Tue Aug 15 15:50:30 2017 +0300
@@ -262,8 +262,8 @@
                 outputs = connectors.get("outputs", [])
                 self.Description = None
             if self.ExecutionControl:
-                inputs.insert(0, ("EN","BOOL","none"))
-                outputs.insert(0, ("ENO","BOOL","none"))
+                inputs.insert(0,  ("EN",   "BOOL", "none"))
+                outputs.insert(0, ("ENO" , "BOOL", "none"))
             self.Pen = MiterPen(self.Colour)
 
             # Extract the inputs properties and create or modify the corresponding connector
--- a/graphics/GraphicCommons.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/graphics/GraphicCommons.py	Tue Aug 15 15:50:30 2017 +0300
@@ -26,7 +26,7 @@
 from math import *
 from types import *
 import datetime
-from threading import Lock,Timer
+from threading import Lock, Timer
 
 from graphics.ToolTipProducer import ToolTipProducer
 from graphics.DebugDataConsumer import DebugDataConsumer
@@ -78,10 +78,10 @@
 [HANDLE_MOVE, HANDLE_RESIZE, HANDLE_POINT, HANDLE_SEGMENT, HANDLE_CONNECTOR] = range(5)
 
 # List of value for resize handle that are valid
-VALID_HANDLES = [(1,1), (1,2), (1,3), (2,3), (3,3), (3,2), (3,1), (2,1)]
+VALID_HANDLES = [(1, 1), (1, 2), (1, 3), (2, 3), (3, 3), (3, 2), (3, 1), (2, 1)]
 
 # Contants for defining the direction of a connector
-[EAST, NORTH, WEST, SOUTH] = [(1,0), (0,-1), (-1,0), (0,1)]
+[EAST, NORTH, WEST, SOUTH] = [(1, 0), (0, -1), (-1, 0), (0, 1)]
 
 # Contants for defining which mode is selected for each view
 [MODE_SELECTION, MODE_BLOCK, MODE_VARIABLE, MODE_CONNECTION, MODE_COMMENT,
@@ -266,7 +266,7 @@
         self.oldPos = None
         self.StartPos = None
         self.CurrentDrag = None
-        self.Handle = (None,None)
+        self.Handle = (None, None)
         self.Dragging = False
         self.Selected = False
         self.Highlighted = False
--- a/graphics/SFC_Objects.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/graphics/SFC_Objects.py	Tue Aug 15 15:50:30 2017 +0300
@@ -1363,7 +1363,7 @@
 
     # Method called when a LeftDown event have been generated
     def OnLeftDown(self, event, dc, scaling):
-        self.RealConnectors = {"Inputs":[],"Outputs":[]}
+        self.RealConnectors = {"Inputs": [], "Outputs": []}
         for input in self.Inputs:
             position = input.GetRelPosition()
             self.RealConnectors["Inputs"].append(float(position.x)/float(self.Size[0]))
--- a/i18n/mki18n.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/i18n/mki18n.py	Tue Aug 15 15:50:30 2017 +0300
@@ -166,14 +166,14 @@
     """
 
     if applicationDomain is None:
-        applicationName = fileBaseOf(applicationDirectoryPath,withPath=0)
+        applicationName = fileBaseOf(applicationDirectoryPath, withPath=0)
     else:
         applicationName = applicationDomain
     currentDir = os.getcwd()
     os.chdir(applicationDirectoryPath)
     filelist = 'app.fil'
     if not os.path.exists(filelist):
-        raise IOError(2,'No module file: ' % filelist)
+        raise IOError(2, 'No module file: ' % filelist)
 
     fileout = 'messages.pot'
     # Steps:
@@ -217,7 +217,7 @@
     """
 
     if applicationDomain is None:
-        applicationName = fileBaseOf(applicationDirectoryPath,withPath=0)
+        applicationName = fileBaseOf(applicationDirectoryPath, withPath=0)
     else:
         applicationName = applicationDomain
     currentDir = os.getcwd()
@@ -233,21 +233,21 @@
             if os.path.exists(langPOfileName):
                 fileList = ''
                 for fileName in listOf_extraPo:
-                    fileList += ("%s_%s.po " % (fileName,langCode))
+                    fileList += ("%s_%s.po " % (fileName, langCode))
                 cmd = "msgcat -s --no-wrap %s %s > %s.cat" % (langPOfileName, fileList, langPOfileName)
                 if verbose: print cmd
                 os.system(cmd)
                 if targetDir is None:
                     pass
                 else:
-                    mo_targetDir = "%s/%s/LC_MESSAGES" % (targetDir,langCode)
-                    cmd = "msgfmt --output-file=%s/%s.mo %s_%s.po.cat" % (mo_targetDir,applicationName,applicationName,langCode)
+                    mo_targetDir = "%s/%s/LC_MESSAGES" % (targetDir, langCode)
+                    cmd = "msgfmt --output-file=%s/%s.mo %s_%s.po.cat" % (mo_targetDir, applicationName, applicationName, langCode)
                     if verbose: print cmd
                     os.system(cmd)
     os.chdir(currentDir)
 
 
-def makeMO(applicationDirectoryPath,targetDir='./locale',applicationDomain=None, verbose=0, forceEnglish=0):
+def makeMO(applicationDirectoryPath, targetDir='./locale', applicationDomain=None, verbose=0, forceEnglish=0):
     """Compile the Portable Object files into the Machine Object stored in the right location.
 
     makeMO converts all translated language-specific PO files located inside
@@ -270,7 +270,7 @@
         print "Target directory for .mo files is: %s" % targetDir
 
     if applicationDomain is None:
-        applicationName = fileBaseOf(applicationDirectoryPath,withPath=0)
+        applicationName = fileBaseOf(applicationDirectoryPath, withPath=0)
     else:
         applicationName = applicationDomain
     currentDir = os.getcwd()
@@ -284,10 +284,10 @@
         else:
             langPOfileName = "%s_%s.po" % (applicationName, langCode)
             if os.path.exists(langPOfileName):
-                mo_targetDir = "%s/%s/LC_MESSAGES" % (targetDir,langCode)
+                mo_targetDir = "%s/%s/LC_MESSAGES" % (targetDir, langCode)
                 if not os.path.exists(mo_targetDir):
                     mkdir(mo_targetDir)
-                cmd = 'msgfmt --output-file="%s/%s.mo" "%s_%s.po"' % (mo_targetDir,applicationName,applicationName,langCode)
+                cmd = 'msgfmt --output-file="%s/%s.mo" "%s_%s.po"' % (mo_targetDir, applicationName, applicationName, langCode)
                 if verbose: print cmd
                 os.system(cmd)
     os.chdir(currentDir)
@@ -330,7 +330,7 @@
         print "\n   ERROR: %s" % errorMsg
 
 
-def fileBaseOf(filename,withPath=0):
+def fileBaseOf(filename, withPath=0):
    """fileBaseOf(filename,withPath) ---> string
 
    Return base name of filename.  The returned string never includes the extension.
@@ -422,7 +422,7 @@
    if os.sep == '/':
       return thePath
    else:
-      return thePath.replace(os.sep,'/')
+      return thePath.replace(os.sep, '/')
 
 # -----------------------------------------------------------------------------
 
@@ -446,11 +446,11 @@
     option['domain'] = None
     option['moTarget'] = None
     try:
-        optionList,pargs = getopt.getopt(sys.argv[1:],validOptions,validLongOptions)
+        optionList, pargs = getopt.getopt(sys.argv[1:], validOptions, validLongOptions)
     except getopt.GetoptError, e:
         printUsage(e[0])
         sys.exit(1)
-    for (opt,val) in optionList:
+    for (opt, val) in optionList:
         if (opt == '-h'):
             printUsage()
             sys.exit(0)
@@ -476,11 +476,11 @@
         print "Application domain used is: '%s'" % option['domain']
     if option['po']:
         try:
-            makePO(appDirPath,option['domain'],option['verbose'])
+            makePO(appDirPath, option['domain'], option['verbose'])
         except IOError, e:
             printUsage(e[1] + '\n   You must write a file app.fil that contains the list of all files to parse.')
     if option['mo']:
-        makeMO(appDirPath,option['moTarget'],option['domain'],option['verbose'],option['forceEnglish'])
+        makeMO(appDirPath, option['moTarget'], option['domain'], option['verbose'], option['forceEnglish'])
     sys.exit(1)
 
 
--- a/plcopen/definitions.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/plcopen/definitions.py	Tue Aug 15 15:50:30 2017 +0300
@@ -31,9 +31,9 @@
 # Override gettext _ in this module
 # since we just want string to be added to dictionnary
 # but translation should happen here
-_ = lambda x:x
+_ = lambda x: x
 
-LANGUAGES = ["IL","ST","FBD","LD","SFC"]
+LANGUAGES = ["IL", "ST", "FBD", "LD", "SFC"]
 
 LOCATIONDATATYPES = {"X": ["BOOL"],
                      "B": ["SINT", "USINT", "BYTE", "STRING"],
@@ -45,10 +45,10 @@
 #                        Function Block Types definitions
 #-------------------------------------------------------------------------------
 
-StdTC6Libs = [(_("Standard function blocks"),  join(sd, "Standard_Function_Blocks.xml")),
-              (_("Additional function blocks"),join(sd, "Additional_Function_Blocks.xml"))]
+StdTC6Libs = [(_("Standard function blocks"),   join(sd, "Standard_Function_Blocks.xml")),
+              (_("Additional function blocks"), join(sd, "Additional_Function_Blocks.xml"))]
 
-StdFuncsCSV = join(sd,"iec_std.csv")
+StdFuncsCSV = join(sd, "iec_std.csv")
 
 
 def GetBlockInfos(pou):
@@ -109,39 +109,39 @@
 DefaultType = "DINT"
 
 DataTypeRange_list = [
-    ("SINT", (-2**7, 2**7 - 1)),
-    ("INT", (-2**15, 2**15 - 1)),
-    ("DINT", (-2**31, 2**31 - 1)),
-    ("LINT", (-2**31, 2**31 - 1)),
-    ("USINT", (0, 2**8 - 1)),
-    ("UINT", (0, 2**16 - 1)),
-    ("UDINT", (0, 2**31 - 1)),
-    ("ULINT", (0, 2**31 - 1))
+    ("SINT",  (-2**7,  2**7 - 1)),
+    ("INT",   (-2**15, 2**15 - 1)),
+    ("DINT",  (-2**31, 2**31 - 1)),
+    ("LINT",  (-2**31, 2**31 - 1)),
+    ("USINT", (0,      2**8 - 1)),
+    ("UINT",  (0,      2**16 - 1)),
+    ("UDINT", (0,      2**31 - 1)),
+    ("ULINT", (0,      2**31 - 1))
 ]
 
 ANY_TO_ANY_FILTERS = {
-    "ANY_TO_ANY":[
+    "ANY_TO_ANY": [
         # simple type conv are let as C cast
-        (("ANY_INT","ANY_BIT"),("ANY_NUM","ANY_BIT")),
-        (("ANY_REAL",),("ANY_REAL",)),
+        (("ANY_INT", "ANY_BIT"), ("ANY_NUM", "ANY_BIT")),
+        (("ANY_REAL",), ("ANY_REAL",)),
         # REAL_TO_INT
-        (("ANY_REAL",),("ANY_SINT",)),
-        (("ANY_REAL",),("ANY_UINT",)),
-        (("ANY_REAL",),("ANY_BIT",)),
+        (("ANY_REAL",), ("ANY_SINT",)),
+        (("ANY_REAL",), ("ANY_UINT",)),
+        (("ANY_REAL",), ("ANY_BIT",)),
         # TO_TIME
-        (("ANY_INT","ANY_BIT"),("ANY_DATE","TIME")),
-        (("ANY_REAL",),("ANY_DATE","TIME")),
-        (("ANY_STRING",), ("ANY_DATE","TIME")),
+        (("ANY_INT", "ANY_BIT"), ("ANY_DATE", "TIME")),
+        (("ANY_REAL",),          ("ANY_DATE", "TIME")),
+        (("ANY_STRING",),        ("ANY_DATE", "TIME")),
         # FROM_TIME
-        (("ANY_DATE","TIME"), ("ANY_REAL",)),
-        (("ANY_DATE","TIME"), ("ANY_INT","ANY_NBIT")),
+        (("ANY_DATE", "TIME"), ("ANY_REAL",)),
+        (("ANY_DATE", "TIME"), ("ANY_INT", "ANY_NBIT")),
         (("TIME",), ("ANY_STRING",)),
         (("DATE",), ("ANY_STRING",)),
-        (("TOD",), ("ANY_STRING",)),
-        (("DT",), ("ANY_STRING",)),
+        (("TOD",),  ("ANY_STRING",)),
+        (("DT",),   ("ANY_STRING",)),
         # TO_STRING
-        (("BOOL",), ("ANY_STRING",)),
-        (("ANY_BIT",), ("ANY_STRING",)),
+        (("BOOL",),     ("ANY_STRING",)),
+        (("ANY_BIT",),  ("ANY_STRING",)),
         (("ANY_REAL",), ("ANY_STRING",)),
         (("ANY_SINT",), ("ANY_STRING",)),
         (("ANY_UINT",), ("ANY_STRING",)),
@@ -150,17 +150,20 @@
         (("ANY_STRING",), ("ANY_BIT",)),
         (("ANY_STRING",), ("ANY_SINT",)),
         (("ANY_STRING",), ("ANY_UINT",)),
-        (("ANY_STRING",), ("ANY_REAL",))],
-    "BCD_TO_ANY":[
-        (("BYTE",),("USINT",)),
-        (("WORD",),("UINT",)),
-        (("DWORD",),("UDINT",)),
-        (("LWORD",),("ULINT",))],
-    "ANY_TO_BCD":[
-        (("USINT",),("BYTE",)),
-        (("UINT",),("WORD",)),
-        (("UDINT",),("DWORD",)),
-        (("ULINT",),("LWORD",))]
+        (("ANY_STRING",), ("ANY_REAL",))
+    ],
+    "BCD_TO_ANY": [
+        (("BYTE",),  ("USINT",)),
+        (("WORD",),  ("UINT",)),
+        (("DWORD",), ("UDINT",)),
+        (("LWORD",), ("ULINT",))
+    ],
+    "ANY_TO_BCD": [
+        (("USINT",), ("BYTE",)),
+        (("UINT",),  ("WORD",)),
+        (("UDINT",), ("DWORD",)),
+        (("ULINT",), ("LWORD",))
+    ]
 }
 
 # remove gettext override
--- a/plcopen/plcopen.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/plcopen/plcopen.py	Tue Aug 15 15:50:30 2017 +0300
@@ -54,7 +54,7 @@
 """
 Define in which order var types must be displayed
 """
-VarOrder = ["Local","Temp","Input","Output","InOut","External","Global","Access"]
+VarOrder = ["Local", "Temp", "Input", "Output", "InOut", "External", "Global", "Access"]
 
 """
 Define which action qualifier must be associated with a duration
@@ -1692,14 +1692,14 @@
     setattr(cls, "setelementExecutionOrder", setelementExecutionOrder)
 
     def appendcontentInstance(self, instance):
-        if self.content.getLocalTag() in ["LD","FBD","SFC"]:
+        if self.content.getLocalTag() in ["LD", "FBD", "SFC"]:
             self.content.appendcontent(instance)
         else:
             raise TypeError, _("%s body don't have instances!") % self.content.getLocalTag()
     setattr(cls, "appendcontentInstance", appendcontentInstance)
 
     def getcontentInstances(self):
-        if self.content.getLocalTag() in ["LD","FBD","SFC"]:
+        if self.content.getLocalTag() in ["LD", "FBD", "SFC"]:
             return self.content.getcontent()
         else:
             raise TypeError, _("%s body don't have instances!") % self.content.getLocalTag()
@@ -1708,7 +1708,7 @@
     instance_by_id_xpath = PLCOpen_XPath("*[@localId=$localId]")
     instance_by_name_xpath = PLCOpen_XPath("ppx:block[@instanceName=$name]")
     def getcontentInstance(self, local_id):
-        if self.content.getLocalTag() in ["LD","FBD","SFC"]:
+        if self.content.getLocalTag() in ["LD", "FBD", "SFC"]:
             instance = instance_by_id_xpath(self.content, localId=local_id)
             if len(instance) > 0:
                 return instance[0]
@@ -1718,7 +1718,7 @@
     setattr(cls, "getcontentInstance", getcontentInstance)
 
     def getcontentInstancesIds(self):
-        if self.content.getLocalTag() in ["LD","FBD","SFC"]:
+        if self.content.getLocalTag() in ["LD", "FBD", "SFC"]:
             return OrderedDict([(instance.getlocalId(), True)
                                 for instance in self.content])
         else:
@@ -1726,7 +1726,7 @@
     setattr(cls, "getcontentInstancesIds", getcontentInstancesIds)
 
     def getcontentInstanceByName(self, name):
-        if self.content.getLocalTag() in ["LD","FBD","SFC"]:
+        if self.content.getLocalTag() in ["LD", "FBD", "SFC"]:
             instance = instance_by_name_xpath(self.content)
             if len(instance) > 0:
                 return instance[0]
@@ -1736,7 +1736,7 @@
     setattr(cls, "getcontentInstanceByName", getcontentInstanceByName)
 
     def removecontentInstance(self, local_id):
-        if self.content.getLocalTag() in ["LD","FBD","SFC"]:
+        if self.content.getLocalTag() in ["LD", "FBD", "SFC"]:
             instance = instance_by_id_xpath(self.content, localId=local_id)
             if len(instance) > 0:
                 self.content.remove(instance[0])
@@ -1747,21 +1747,21 @@
     setattr(cls, "removecontentInstance", removecontentInstance)
 
     def settext(self, text):
-        if self.content.getLocalTag() in ["IL","ST"]:
+        if self.content.getLocalTag() in ["IL", "ST"]:
             self.content.setanyText(text)
         else:
             raise TypeError, _("%s body don't have text!") % self.content.getLocalTag()
     setattr(cls, "settext", settext)
 
     def gettext(self):
-        if self.content.getLocalTag() in ["IL","ST"]:
+        if self.content.getLocalTag() in ["IL", "ST"]:
             return self.content.getanyText()
         else:
             raise TypeError, _("%s body don't have text!") % self.content.getLocalTag()
     setattr(cls, "gettext", gettext)
 
     def hasblock(self, block_type):
-        if self.content.getLocalTag() in ["IL","ST"]:
+        if self.content.getLocalTag() in ["IL", "ST"]:
             return self.content.hasblock(block_type)
         else:
             raise TypeError, _("%s body don't have text!") % self.content.getLocalTag()
@@ -2365,7 +2365,7 @@
     def getpoints(self):
         points = []
         for position in self.position:
-            points.append((position.getx(),position.gety()))
+            points.append((position.getx(), position.gety()))
         return points
     setattr(cls, "getpoints", getpoints)
 
--- a/plcopen/structures.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/plcopen/structures.py	Tue Aug 15 15:50:30 2017 +0300
@@ -100,7 +100,7 @@
     """
     take a .csv file and translate it it a "csv_table"
     """
-    return [ map(string.strip,line.split(';')) for line in file.xreadlines()]
+    return [ map(string.strip, line.split(';')) for line in file.xreadlines()]
 
 
 def find_section(section_name, table):
@@ -121,7 +121,7 @@
     """
     variables = find_section("Standard_functions_variables_types", table)
     standard_funtions_input_variables = {}
-    fields = [True,True]
+    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!=''])
@@ -135,7 +135,7 @@
     in : "(ANY_NUM, ANY_NUM)" and { ParameterName: Type, ...}
     return [("IN1","ANY_NUM","none"),("IN2","ANY_NUM","none")]
     """
-    decl = str_decl.replace('(','').replace(')','').replace(' ','').split(',')
+    decl = str_decl.replace('(', '').replace(')', '').replace(' ', '').split(',')
     params = []
 
     len_of_not_predifined_variable = len([True for param_type in decl if param_type not in variables])
@@ -170,15 +170,15 @@
 
     variables = get_standard_funtions_input_variables(table)
 
-    fonctions = find_section("Standard_functions_type",table)
+    fonctions = find_section("Standard_functions_type", table)
 
     Standard_Functions_Decl = []
     Current_section = None
 
     translate = {
-            "extensible": lambda x: {"yes":True, "no":False}[x],
-            "inputs": lambda x:csv_input_translate(x,variables,baseinputnumber),
-            "outputs":lambda x:[("OUT",x,"none")]}
+            "extensible": lambda x: {"yes": True, "no": False}[x],
+            "inputs":     lambda x: csv_input_translate(x, variables, baseinputnumber),
+            "outputs":    lambda x: [("OUT", x, "none")]}
 
     for fields in table:
         if fields[1]:
@@ -194,7 +194,7 @@
                 Function_decl_list = []
             if Current_section:
                 Function_decl = dict([(champ, val) for champ, val in zip(fonctions, fields[1:]) if champ])
-                baseinputnumber = int(Function_decl.get("baseinputnumber",1))
+                baseinputnumber = int(Function_decl.get("baseinputnumber", 1))
                 Function_decl["baseinputnumber"] = baseinputnumber
                 for param, value in Function_decl.iteritems():
                     if param in translate:
@@ -242,12 +242,12 @@
                         # apply filter given in "filter" column
                         filter_name = Function_decl["filter"]
                         store = True
-                        for (InTypes, OutTypes) in ANY_TO_ANY_FILTERS.get(filter_name,[]):
-                            outs = reduce(lambda a,b: a or b,
+                        for (InTypes, OutTypes) in ANY_TO_ANY_FILTERS.get(filter_name, []):
+                            outs = reduce(lambda a, b: a or b,
                                        map(lambda testtype: IsOfType(
                                            Function_decl["outputs"][0][1],
                                            testtype), OutTypes))
-                            inps = reduce(lambda a,b: a or b,
+                            inps = reduce(lambda a, b: a or b,
                                        map(lambda testtype: IsOfType(
                                            Function_decl["inputs"][0][1],
                                            testtype), InTypes))
@@ -280,7 +280,7 @@
                         for input in desc["inputs"]]),
              ", ".join(["%s:%s" % (output[1], output[0])
                         for output in desc["outputs"]])))
-        BlkLst = StdBlckDct.setdefault(desc["name"],[])
+        BlkLst = StdBlckDct.setdefault(desc["name"], [])
         BlkLst.append((section["name"], desc))
 
 #-------------------------------------------------------------------------------
--- a/py_ext/PythonEditor.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/py_ext/PythonEditor.py	Tue Aug 15 15:50:30 2017 +0300
@@ -38,11 +38,11 @@
         self.SetLexer(stc.STC_LEX_PYTHON)
 
         # Line numbers in margin
-        self.StyleSetSpec(stc.STC_STYLE_LINENUMBER,'fore:#000000,back:#99A9C2,size:%(size)d' % faces)
+        self.StyleSetSpec(stc.STC_STYLE_LINENUMBER, 'fore:#000000,back:#99A9C2,size:%(size)d' % faces)
         # Highlighted brace
-        self.StyleSetSpec(stc.STC_STYLE_BRACELIGHT,'fore:#00009D,back:#FFFF00,size:%(size)d' % faces)
+        self.StyleSetSpec(stc.STC_STYLE_BRACELIGHT, 'fore:#00009D,back:#FFFF00,size:%(size)d' % faces)
         # Unmatched brace
-        self.StyleSetSpec(stc.STC_STYLE_BRACEBAD,'fore:#00009D,back:#FF0000,size:%(size)d' % faces)
+        self.StyleSetSpec(stc.STC_STYLE_BRACEBAD, 'fore:#00009D,back:#FF0000,size:%(size)d' % faces)
         # Indentation guide
         self.StyleSetSpec(stc.STC_STYLE_INDENTGUIDE, 'fore:#CDCDCD,size:%(size)d' % faces)
 
--- a/py_ext/PythonFileCTNMixin.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/py_ext/PythonFileCTNMixin.py	Tue Aug 15 15:50:30 2017 +0300
@@ -87,14 +87,14 @@
 
     PreSectionsTexts = {}
     PostSectionsTexts = {}
-    def GetSection(self,section):
-        return self.PreSectionsTexts.get(section,"") + "\n" + \
+    def GetSection(self, section):
+        return self.PreSectionsTexts.get(section, "") + "\n" + \
                getattr(self.CodeFile, section).getanyText() + "\n" + \
-               self.PostSectionsTexts.get(section,"")
+               self.PostSectionsTexts.get(section, "")
 
     def CTNGenerate_C(self, buildpath, locations):
         # location string for that CTN
-        location_str = "_".join(map(lambda x:str(x),
+        location_str = "_".join(map(lambda x: str(x),
                                 self.GetCurrentLocation()))
         configname = self.GetCTRoot().GetProjectConfigNames()[0]
 
@@ -243,7 +243,7 @@
                              varpubfmt) % varinfo
                             for varinfo in varinfos])
         varinit = "\n".join([varinitonchangefmt % dict(
-                                onchangelen = len(varinfo["onchangecode"]),**varinfo)
+                                onchangelen = len(varinfo["onchangecode"]), **varinfo)
                             for varinfo in varinfos if varinfo["onchange"]])
 
         # TODO : use config name obtained from model instead of default
@@ -281,7 +281,7 @@
 """ % locals()
 
         Gen_PyCfile_path = os.path.join(buildpath, "PyCFile_%s.c" % location_str)
-        pycfile = open(Gen_PyCfile_path,'w')
+        pycfile = open(Gen_PyCfile_path, 'w')
         pycfile.write(PyCFileContent)
         pycfile.close()
 
@@ -291,5 +291,5 @@
         return ([(Gen_PyCfile_path, matiec_CFLAGS)],
                 "",
                 True,
-                ("runtime_%s.py" % location_str, file(runtimefile_path,"rb")))
-
+                ("runtime_%s.py" % location_str, file(runtimefile_path, "rb")))
+
--- a/py_ext/py_ext.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/py_ext/py_ext.py	Tue Aug 15 15:50:30 2017 +0300
@@ -51,7 +51,7 @@
             "python_eval_fb_count": python_eval_fb_count }
 
         Gen_Pythonfile_path = os.path.join(buildpath, "py_ext.c")
-        pythonfile = open(Gen_Pythonfile_path,'w')
+        pythonfile = open(Gen_Pythonfile_path, 'w')
         pythonfile.write(plc_python_code)
         pythonfile.close()
 
--- a/runtime/NevowServer.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/runtime/NevowServer.py	Tue Aug 15 15:50:30 2017 +0300
@@ -89,7 +89,7 @@
 
     def HMIexec(self, function, *args, **kwargs):
         if self.HMI is not None:
-            getattr(self.HMI, function, lambda:None)(*args, **kwargs)
+            getattr(self.HMI, function, lambda: None)(*args, **kwargs)
     athena.expose(HMIexec)
 
     def resetHMI(self):
--- a/runtime/PLCObject.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/runtime/PLCObject.py	Tue Aug 15 15:50:30 2017 +0300
@@ -47,8 +47,8 @@
     return tb
 
 lib_ext ={
-     "linux2":".so",
-     "win32":".dll",
+     "linux2": ".so",
+     "win32":  ".dll",
      }.get(sys.platform, "")
 
 
@@ -128,16 +128,16 @@
                 ctypes.byref(tv_nsec))
             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
+                return self._log_read_buffer.value, tick.value, tv_sec.value, tv_nsec.value
         elif self._loading_error is not None and level==0:
-            return self._loading_error,0,0,0
+            return self._loading_error, 0, 0, 0
         return None
 
     def _GetMD5FileName(self):
         return os.path.join(self.workingdir, "lasttransferedPLC.md5")
 
     def _GetLibFileName(self):
-        return os.path.join(self.workingdir,self.CurrentPLCFilename)
+        return os.path.join(self.workingdir, self.CurrentPLCFilename)
 
 
     def LoadPLC(self):
@@ -241,22 +241,22 @@
         """
         self.PLClibraryLock.acquire()
         # Forget all refs to library
-        self._startPLC = lambda x,y:None
-        self._stopPLC = lambda:None
-        self._ResetDebugVariables = lambda:None
-        self._RegisterDebugVariable = lambda x, y:None
-        self._IterDebugData = lambda x,y:None
-        self._FreeDebugData = lambda:None
-        self._GetDebugData = lambda:-1
-        self._suspendDebug = lambda x:-1
-        self._resumeDebug = lambda:None
-        self._PythonIterator = lambda:""
+        self._startPLC = lambda x, y: None
+        self._stopPLC = lambda: None
+        self._ResetDebugVariables = lambda: None
+        self._RegisterDebugVariable = lambda x, y: None
+        self._IterDebugData = lambda x, y: None
+        self._FreeDebugData = lambda: None
+        self._GetDebugData = lambda: -1
+        self._suspendDebug = lambda x: -1
+        self._resumeDebug = lambda: None
+        self._PythonIterator = lambda: ""
         self._GetLogCount = None
-        self._LogMessage = lambda l,m,s:PLCprint("OFF LOG :"+m)
+        self._LogMessage = lambda l, m, s: PLCprint("OFF LOG :"+m)
         self._GetLogMessage = None
         self.PLClibraryHandle = None
         # Unload library explicitely
-        if getattr(self,"_PLClibraryHandle",None) is not None:
+        if getattr(self, "_PLClibraryHandle", None) is not None:
             dlclose(self._PLClibraryHandle)
             self._PLClibraryHandle = None
 
@@ -269,9 +269,9 @@
         runtime python files, loaded when new PLC uploaded
         """
         for method in self.python_runtime_vars.get("_runtime_%s" % methodname, []):
-            res,exp = self.evaluator(method)
+            res, exp = self.evaluator(method)
             if exp is not None:
-                self.LogMessage(0,'\n'.join(traceback.format_exception(*exp)))
+                self.LogMessage(0, '\n'.join(traceback.format_exception(*exp)))
 
     def PythonRuntimeInit(self):
         MethodNames = ["init", "start", "stop", "cleanup"]
@@ -292,7 +292,7 @@
                     t = self.python_runtime_vars["_"+name+"_ctype"]
                 except KeyError:
                     raise KeyError("Try to set unknown shared global variable : %s" % name)
-                v = self.python_runtime_vars["_"+name+"_pack"](t,value)
+                v = self.python_runtime_vars["_"+name+"_pack"](t, value)
                 self.python_runtime_vars["_PySafeSetPLCGlob_"+name](ctypes.byref(v))
 
         self.python_runtime_vars.update({
@@ -317,7 +317,7 @@
                         if method is not None:
                             self.python_runtime_vars["_runtime_%s" % methodname].append(method)
         except:
-            self.LogMessage(0,traceback.format_exc())
+            self.LogMessage(0, traceback.format_exc())
             raise
 
         self.PythonRuntimeCall("init")
@@ -332,38 +332,38 @@
 
     def PythonThreadProc(self):
         self.StartSem.release()
-        res,cmd,blkid = "None","None",ctypes.c_void_p()
+        res, cmd, blkid = "None", "None", ctypes.c_void_p()
         compile_cache={}
         while True:
             # print "_PythonIterator(", res, ")",
-            cmd = self._PythonIterator(res,blkid)
+            cmd = self._PythonIterator(res, blkid)
             FBID = blkid.value
             # print " -> ", cmd, blkid
             if cmd is None:
                 break
             try:
                 self.python_runtime_vars["FBID"]=FBID
-                ccmd,AST =compile_cache.get(FBID, (None,None))
+                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)
-                result,exp = self.evaluator(eval,AST,self.python_runtime_vars)
+                    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,
+                    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
-            except Exception,e:
+            except Exception, e:
                 res = "#EXCEPTION : "+str(e)
-                self.LogMessage(1,('PyEval@0x%x(Code="%s") Exception "%s"') % (FBID,cmd,str(e)))
+                self.LogMessage(1, ('PyEval@0x%x(Code="%s") Exception "%s"') % (FBID, cmd, str(e)))
 
     def StartPLC(self):
         if self.CurrentPLCFilename is not None and self.PLCStatus == "Stopped":
             c_argv = ctypes.c_char_p * len(self.argv)
             error = None
-            res = self._startPLC(len(self.argv),c_argv(*self.argv))
+            res = self._startPLC(len(self.argv), c_argv(*self.argv))
             if res == 0:
                 self.PLCStatus = "Started"
                 self.StatusChange()
@@ -374,7 +374,7 @@
                 self.StartSem.acquire()
                 self.LogMessage("PLC started")
             else:
-                self.LogMessage(0,_("Problem starting PLC : error %d" % res))
+                self.LogMessage(0, _("Problem starting PLC : error %d" % res))
                 self.PLCStatus = "Broken"
                 self.StatusChange()
 
@@ -396,22 +396,22 @@
     def _Reload(self):
         self.daemon.shutdown(True)
         self.daemon.sock.close()
-        os.execv(sys.executable,[sys.executable]+sys.argv[:])
+        os.execv(sys.executable, [sys.executable]+sys.argv[:])
         # never reached
         return 0
 
     def ForceReload(self):
         # respawn python interpreter
-        Timer(0.1,self._Reload).start()
+        Timer(0.1, self._Reload).start()
         return True
 
     def GetPLCstatus(self):
-        return self.PLCStatus, map(self.GetLogCount,xrange(LogLevelsCount))
+        return self.PLCStatus, map(self.GetLogCount, xrange(LogLevelsCount))
 
     def NewPLC(self, md5sum, data, extrafiles):
         if self.PLCStatus in ["Stopped", "Empty", "Broken"]:
             NewFileName = md5sum + lib_ext
-            extra_files_log = os.path.join(self.workingdir,"extra_files.txt")
+            extra_files_log = os.path.join(self.workingdir, "extra_files.txt")
 
             self.UnLoadPLC()
 
@@ -431,7 +431,7 @@
 
             try:
                 # Create new PLC file
-                open(os.path.join(self.workingdir,NewFileName),
+                open(os.path.join(self.workingdir, NewFileName),
                      'wb').write(data)
 
                 # Store new PLC filename based on md5 key
@@ -439,8 +439,8 @@
 
                 # Then write the files
                 log = file(extra_files_log, "w")
-                for fname,fdata in extrafiles:
-                    fpath = os.path.join(self.workingdir,fname)
+                for fname, fdata in extrafiles:
+                    fpath = os.path.join(self.workingdir, fname)
                     open(fpath, "wb").write(fdata)
                     log.write(fname+'\n')
 
@@ -480,12 +480,12 @@
             if self._suspendDebug(False) == 0:
                 # keep a copy of requested idx
                 self._ResetDebugVariables()
-                for idx,iectype,force in idxs:
+                for idx, iectype, force in idxs:
                     if force !=None:
-                        c_type,unpack_func, pack_func = \
+                        c_type, unpack_func, pack_func = \
                             TypeTranslator.get(iectype,
-                                                    (None,None,None))
-                        force = ctypes.byref(pack_func(c_type,force))
+                                                    (None, None, None))
+                        force = ctypes.byref(pack_func(c_type, force))
                     self._RegisterDebugVariable(idx, force)
                 self._TracesSwap()
                 self._resumeDebug()
--- a/runtime/ServicePublisher.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/runtime/ServicePublisher.py	Tue Aug 15 15:50:30 2017 +0300
@@ -31,7 +31,7 @@
 class ServicePublisher():
     def __init__(self):
         # type: fully qualified service type name
-        self.serviceproperties = {'description':'Beremiz remote PLC'}
+        self.serviceproperties = {'description': 'Beremiz remote PLC'}
 
         self.name = None
         self.ip_32b = None
@@ -43,13 +43,13 @@
     def RegisterService(self, name, ip, port):
         try:
             self._RegisterService(name, ip, port)
-        except Exception,e:
-            self.retrytimer = threading.Timer(2,self.RegisterService,[name, ip, port])
+        except Exception, e:
+            self.retrytimer = threading.Timer(2, self.RegisterService, [name, ip, port])
             self.retrytimer.start()
 
     def _RegisterService(self, name, ip, port):
         # name: fully qualified service name
-        self.service_name = 'Beremiz_%s.%s' % (name,service_type)
+        self.service_name = 'Beremiz_%s.%s' % (name, service_type)
         self.name = name
         self.port = port
 
@@ -90,6 +90,6 @@
             s.close()
             if host != '0.0.0.0':
                 return host
-        except Exception,e:
+        except Exception, e:
             pass
         return socket.gethostbyname(socket.gethostname())
--- a/runtime/WampClient.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/runtime/WampClient.py	Tue Aug 15 15:50:30 2017 +0300
@@ -70,7 +70,7 @@
         ID = self.config.extra["ID"]
         print 'WAMP session joined by :', ID
         for name in ExposedCalls:
-            reg = yield self.register(GetCallee(name), '.'.join((ID,name)))
+            reg = yield self.register(GetCallee(name), '.'.join((ID, name)))
 
         for name in SubscribedEvents:
             reg = yield self.subscribe(GetCallee(name), name)
@@ -109,7 +109,7 @@
     # create a WAMP application session factory
     component_config = types.ComponentConfig(
         realm = WSClientConf["realm"],
-        extra = {"ID":WSClientConf["ID"]})
+        extra = {"ID": WSClientConf["ID"]})
     session_factory = wamp.ApplicationSessionFactory(
         config = component_config)
     session_factory.session = WampSession
@@ -124,7 +124,7 @@
 
     # start the client from a Twisted endpoint
     conn = connectWS(transport_factory)
-    print "WAMP client connecting to :",WSClientConf["url"]
+    print "WAMP client connecting to :", WSClientConf["url"]
     return conn
 
 
--- a/svgui/pyjs/jsonrpc/django/jsonrpc.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/svgui/pyjs/jsonrpc/django/jsonrpc.py	Tue Aug 15 15:50:30 2017 +0300
@@ -156,8 +156,8 @@
 
         if command is None:  # just validate
             if not f.is_valid():
-                return {'success':False, 'errors': builderrors(f)}
-            return {'success':True}
+                return {'success': False, 'errors': builderrors(f)}
+            return {'success': True}
 
         elif command.has_key('describe_errors'):
             field_names = command['describe_errors']
@@ -169,7 +169,7 @@
 
         elif command.has_key('save'):
             if not f.is_valid():
-                return {'success':False, 'errors': builderrors(f)}
+                return {'success': False, 'errors': builderrors(f)}
             instance = f.save()  # XXX: if you want more, over-ride save.
             return {'success': True, 'instance': json_convert(instance) }
 
--- a/svgui/pyjs/jsonrpc/jsonrpc.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/svgui/pyjs/jsonrpc/jsonrpc.py	Tue Aug 15 15:50:30 2017 +0300
@@ -9,8 +9,8 @@
         self.methods={}
 
     def response(self, id, result):
-        return simplejson.dumps({'version': '1.1', 'id':id,
-                                 'result':result, 'error':None})
+        return simplejson.dumps({'version': '1.1', 'id': id,
+                                 'result': result, 'error': None})
     def error(self, id, code, message):
         return simplejson.dumps({'id': id,
                                  'version': '1.1',
--- a/svgui/pyjs/jsonrpc/web2py/jsonrpc.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/svgui/pyjs/jsonrpc/web2py/jsonrpc.py	Tue Aug 15 15:50:30 2017 +0300
@@ -6,7 +6,7 @@
     def serve(self):
         return self.process(request.body.read())
 
-    def __call__(self,func):
+    def __call__(self, func):
         self.methods[func.__name__]=func
         return func
 
--- a/svgui/pyjs/lib/pyjslib.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/svgui/pyjs/lib/pyjslib.py	Tue Aug 15 15:50:30 2017 +0300
@@ -426,7 +426,7 @@
         return self.name
 
 
-def eq(a,b):
+def eq(a, b):
     JS("""
     if (pyjslib.hasattr(a, "__cmp__")) {
         return a.__cmp__(b) == 0;
@@ -437,7 +437,7 @@
     """)
 
 
-def cmp(a,b):
+def cmp(a, b):
     if hasattr(a, "__cmp__"):
         return a.__cmp__(b)
     elif hasattr(b, "__cmp__"):
@@ -595,15 +595,15 @@
             global cmp
             compareFunc = cmp
         if keyFunc and reverse:
-            def thisSort1(a,b):
+            def thisSort1(a, b):
                 return -compareFunc(keyFunc(a), keyFunc(b))
             self.l.sort(thisSort1)
         elif keyFunc:
-            def thisSort2(a,b):
+            def thisSort2(a, b):
                 return compareFunc(keyFunc(a), keyFunc(b))
             self.l.sort(thisSort2)
         elif reverse:
-            def thisSort3(a,b):
+            def thisSort3(a, b):
                 return -compareFunc(a, b)
             self.l.sort(thisSort3)
         else:
@@ -745,15 +745,15 @@
             global cmp
             compareFunc = cmp
         if keyFunc and reverse:
-            def thisSort1(a,b):
+            def thisSort1(a, b):
                 return -compareFunc(keyFunc(a), keyFunc(b))
             self.l.sort(thisSort1)
         elif keyFunc:
-            def thisSort2(a,b):
+            def thisSort2(a, b):
                 return compareFunc(keyFunc(a), keyFunc(b))
             self.l.sort(thisSort2)
         elif reverse:
-            def thisSort3(a,b):
+            def thisSort3(a, b):
                 return -compareFunc(a, b)
             self.l.sort(thisSort3)
         else:
@@ -897,7 +897,7 @@
         return self[key]
 
     def update(self, d):
-        for k,v in d.iteritems():
+        for k, v in d.iteritems():
             self[k] = v
 
     def getObject(self):
--- a/svgui/pyjs/pyjs.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/svgui/pyjs/pyjs.py	Tue Aug 15 15:50:30 2017 +0300
@@ -1148,7 +1148,7 @@
             tempName = "__tupleassign" + str(uniqueID) + "__"
             print >>self.output, "    var " + tempName + " = " + \
                                  self.expr(node.expr, current_klass) + ";"
-            for index,child in enumerate(v.getChildNodes()):
+            for index, child in enumerate(v.getChildNodes()):
                 rhs = tempName + ".__getitem__(" + str(index) + ")"
 
                 if isinstance(child, ast.AssAttr):
@@ -1412,7 +1412,7 @@
     def _bitshiftright(self, node, current_klass):
         return self.expr(node.left, current_klass) + " >>> " + self.expr(node.right, current_klass)
 
-    def _bitxor(self,node, current_klass):
+    def _bitxor(self, node, current_klass):
         return " ^ ".join([self.expr(child, current_klass) for child in node.nodes])
 
     def _bitor(self, node, current_klass):
@@ -1507,7 +1507,7 @@
             return self._invert(node, current_klass)
         elif isinstance(node, ast.Bitand):
             return "("+self._bitand(node, current_klass)+")"
-        elif isinstance(node,ast.LeftShift):
+        elif isinstance(node, ast.LeftShift):
             return self._bitshiftleft(node, current_klass)
         elif isinstance(node, ast.RightShift):
             return self._bitshiftright(node, current_klass)
--- a/svgui/svgui.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/svgui/svgui.py	Tue Aug 15 15:50:30 2017 +0300
@@ -86,13 +86,13 @@
 
         current_location = self.GetCurrentLocation()
         # define a unique name for the generated C file
-        location_str = "_".join(map(lambda x:str(x), current_location))
+        location_str = "_".join(map(lambda x: str(x), current_location))
 
         res = ([], "", False)
 
         svgfile=self._getSVGpath()
         if os.path.exists(svgfile):
-            res += (("gui.svg", file(svgfile,"rb")),)
+            res += (("gui.svg", file(svgfile, "rb")),)
 
         svguiserverfile = open(self._getSVGUIserverpath(), 'r')
         svguiservercode = svguiserverfile.read()
@@ -110,7 +110,7 @@
         svguilibfile.write(open(os.path.join(fpath, "livesvg.js"), 'r').read())
         svguilibfile.close()
         jsmodules = {"LiveSVGPage": "svguilib.js"}
-        res += (("svguilib.js", file(svguilibpath,"rb")),)
+        res += (("svguilib.js", file(svguilibpath, "rb")),)
 
         runtimefile_path = os.path.join(buildpath, "runtime_%s.py" % location_str)
         runtimefile = open(runtimefile_path, 'w')
@@ -128,7 +128,7 @@
       })
         runtimefile.close()
 
-        res += (("runtime_%s.py" % location_str, file(runtimefile_path,"rb")),)
+        res += (("runtime_%s.py" % location_str, file(runtimefile_path, "rb")),)
 
         return res
 
--- a/svgui/svgui_server.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/svgui/svgui_server.py	Tue Aug 15 15:50:30 2017 +0300
@@ -121,9 +121,9 @@
         d = self.callRemote('init', gadgets)
         d.addCallback(self.HMIinitialised)
 
-    def sendData(self,data):
+    def sendData(self, data):
         if self.initialised:
-            return self.callRemote('receiveData',unicode(json.dumps(data, default=get_object_current_state, indent=2), 'ascii'))
+            return self.callRemote('receiveData', unicode(json.dumps(data, default=get_object_current_state, indent=2), 'ascii'))
         return None
 
     def setattr(self, id, attrname, value):
--- a/targets/__init__.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/targets/__init__.py	Tue Aug 15 15:50:30 2017 +0300
@@ -41,10 +41,10 @@
 
 
 def _GetLocalTargetClassFactory(name):
-    return lambda:getattr(__import__(name,globals(),locals()), name+"_target")
+    return lambda: getattr(__import__(name, globals(), locals()), name+"_target")
 
-targets = dict([(name, {"xsd":path.join(_base_path, name, "XSD"),
-                        "class":_GetLocalTargetClassFactory(name),
+targets = dict([(name, {"xsd": path.join(_base_path, name, "XSD"),
+                        "class": _GetLocalTargetClassFactory(name),
                         "code": { fname: path.join(_base_path, name, fname)
                            for fname in listdir(path.join(_base_path, name))
                              if fname.startswith("plc_%s_main" % name) and
@@ -66,13 +66,13 @@
     targetchoices = ""
 
     # Get all xsd toolchains
-    for toolchainname,xsdfilename in toolchains.iteritems():
+    for toolchainname, xsdfilename in toolchains.iteritems():
          if path.isfile(xsdfilename):
              DictXSD_toolchain["toolchain_"+toolchainname] = \
                 open(xsdfilename).read()
 
     # Get all xsd targets
-    for targetname,nfo in targets.iteritems():
+    for targetname, nfo in targets.iteritems():
         xsd_string = open(nfo["xsd"]).read()
         targetchoices +=  xsd_string % DictXSD_toolchain
 
@@ -86,10 +86,10 @@
 
 
 def GetHeader():
-    filename = paths.AbsNeighbourFile(__file__,"beremiz.h")
+    filename = paths.AbsNeighbourFile(__file__, "beremiz.h")
     return open(filename).read()
 
 
 def GetCode(name):
-    filename = paths.AbsNeighbourFile(__file__,name)
+    filename = paths.AbsNeighbourFile(__file__, name)
     return open(filename).read()
--- a/targets/toolchain_gcc.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/targets/toolchain_gcc.py	Tue Aug 15 15:50:30 2017 +0300
@@ -111,7 +111,7 @@
 
     def concat_deps(self, bn):
         # read source
-        src = open(os.path.join(self.buildpath, bn),"r").read()
+        src = open(os.path.join(self.buildpath, bn), "r").read()
         # update direct dependencies
         deps = []
         self.append_cfile_deps(src, deps)
@@ -121,7 +121,7 @@
 
     def check_and_update_hash_and_deps(self, bn):
         # Get latest computed hash and deps
-        oldhash, deps = self.srcmd5.get(bn,(None,[]))
+        oldhash, deps = self.srcmd5.get(bn, (None, []))
         # read source
         src = open(os.path.join(self.buildpath, bn)).read()
         # compute new hash
@@ -165,7 +165,7 @@
         for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS:
             if CFilesAndCFLAGS:
                 if Location:
-                    self.CTRInstance.logger.write(".".join(map(str,Location))+" :\n")
+                    self.CTRInstance.logger.write(".".join(map(str, Location))+" :\n")
                 else:
                     self.CTRInstance.logger.write(_("PLC :\n"))
 
--- a/targets/toolchain_makefile.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/targets/toolchain_makefile.py	Tue Aug 15 15:50:30 2017 +0300
@@ -69,7 +69,7 @@
 
     def concat_deps(self, bn):
         # read source
-        src = open(os.path.join(self.buildpath, bn),"r").read()
+        src = open(os.path.join(self.buildpath, bn), "r").read()
         # update direct dependencies
         deps = []
         for l in src.splitlines():
--- a/targets/typemapping.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/targets/typemapping.py	Tue Aug 15 15:50:30 2017 +0300
@@ -47,15 +47,15 @@
                 ("ns", c_long)]  # tv_nsec
 
 
-def _t(t, u=lambda x:x.value, p=lambda t,x:t(x)): return (t, u, p)
+def _t(t, u=lambda x: x.value, p=lambda t, x: t(x)): return (t, u, p)
 
 
 def _ttime(): return (IEC_TIME,
-                      lambda x:td(0, x.s, x.ns/1000),
-                      lambda t,x:t(x.days * 24 * 3600 + x.seconds, x.microseconds*1000))
+                      lambda x: td(0, x.s, x.ns/1000),
+                      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),
@@ -63,8 +63,8 @@
     "USINT":      _t(c_uint8),
     "BYTE":       _t(c_uint8),
     "STRING":     (IEC_STRING,
-                   lambda x:x.body[:x.len],
-                   lambda t,x:t(len(x),x)),
+                   lambda x: x.body[:x.len],
+                   lambda t, x: t(len(x), x)),
     "INT":        _t(c_int16),
     "UINT":       _t(c_uint16),
     "WORD":       _t(c_uint16),
@@ -89,18 +89,18 @@
 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])
+DebugTypesSize =  dict([(key, sizeof(t)) for key, (t, p, u) in SameEndianessTypeTranslator.iteritems() if t is not None])
 
 
 def UnpackDebugBuffer(buff, indexes):
     res =  []
     buffoffset = 0
     buffsize = len(buff)
-    buffptr = cast(ctypes.pythonapi.PyString_AsString(id(buff)),c_void_p).value
+    buffptr = cast(ctypes.pythonapi.PyString_AsString(id(buff)), c_void_p).value
     for iectype in indexes:
-        c_type,unpack_func, pack_func = \
+        c_type, unpack_func, pack_func = \
             TypeTranslator.get(iectype,
-                                    (None,None,None))
+                                    (None, None, None))
         if c_type is not None and buffoffset < buffsize:
             cursor = c_void_p( buffptr + buffoffset)
             value = unpack_func( cast(cursor,
@@ -115,8 +115,8 @@
 
 
 
-LogLevels = ["CRITICAL","WARNING","INFO","DEBUG"]
+LogLevels = ["CRITICAL", "WARNING", "INFO", "DEBUG"]
 LogLevelsCount = len(LogLevels)
-LogLevelsDict = dict(zip(LogLevels,range(LogLevelsCount)))
+LogLevelsDict = dict(zip(LogLevels, range(LogLevelsCount)))
 LogLevelsDefault = LogLevelsDict["DEBUG"]
 
--- a/util/ProcessLogger.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/util/ProcessLogger.py	Tue Aug 15 15:50:30 2017 +0300
@@ -80,7 +80,7 @@
         if not isinstance(Command, list):
             self.Command_str = Command
             self.Command = []
-            for i,word in enumerate(Command.replace("'",'"').split('"')):
+            for i, word in enumerate(Command.replace("'", '"').split('"')):
                 if i % 2 == 0:
                     word = word.strip()
                     if len(word) > 0:
@@ -116,10 +116,11 @@
         self.endlock = Lock()
 
         popenargs= {
-               "cwd":os.getcwd() if cwd is None else cwd,
-               "stdin":subprocess.PIPE,
-               "stdout":subprocess.PIPE,
-               "stderr":subprocess.PIPE}
+               "cwd":    os.getcwd() if cwd is None else cwd,
+               "stdin":  subprocess.PIPE,
+               "stdout": subprocess.PIPE,
+               "stderr": subprocess.PIPE
+        }
 
         if no_gui == True and wx.Platform == '__WXMSW__':
             self.startupinfo = subprocess.STARTUPINFO()
@@ -129,7 +130,7 @@
             popenargs["shell"] = False
 
         if timeout:
-            self.timeout = Timer(timeout,self.endlog)
+            self.timeout = Timer(timeout, self.endlog)
             self.timeout.start()
         else:
             self.timeout = None
@@ -151,7 +152,7 @@
         self.startsem.release()
 
 
-    def output(self,v):
+    def output(self, v):
         self.outdata.append(v)
         self.outlen += 1
         if not self.no_stdout:
@@ -159,7 +160,7 @@
         if (self.keyword and v.find(self.keyword)!=-1) or (self.outlimit and self.outlen > self.outlimit):
             self.endlog()
 
-    def errors(self,v):
+    def errors(self, v):
         self.errdata.append(v)
         self.errlen += 1
         if not self.no_stderr:
@@ -167,24 +168,24 @@
         if self.errlimit and self.errlen > self.errlimit:
             self.endlog()
 
-    def log_the_end(self,ecode,pid):
+    def log_the_end(self, ecode, pid):
         self.logger.write(self.Command_str + "\n")
         self.logger.write_warning(_("exited with status {a1} (pid {a2})\n").format(a1 = str(ecode), a2 = str(pid)))
 
-    def finish(self, pid,ecode):
+    def finish(self, pid, ecode):
         # avoid running function before start is finished
         self.startsem.acquire()
         if self.timeout:
             self.timeout.cancel()
         self.exitcode = ecode
         if self.exitcode != 0:
-            self.log_the_end(ecode,pid)
+            self.log_the_end(ecode, pid)
         if self.finish_callback is not None:
-            self.finish_callback(self,ecode,pid)
+            self.finish_callback(self, ecode, pid)
         self.errt.join()
         self.finishsem.release()
 
-    def kill(self,gently=True):
+    def kill(self, gently=True):
         # avoid running kill before start is finished
         self.startsem.acquire()
         self.startsem.release()
--- a/util/Zeroconf.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/util/Zeroconf.py	Tue Aug 15 15:50:30 2017 +0300
@@ -1557,7 +1557,7 @@
     print "Multicast DNS Service Discovery for Python, version", __version__
     r = Zeroconf()
     print "1. Testing registration of a service..."
-    desc = {'version':'0.10','a':'test value', 'b':'another value'}
+    desc = {'version': '0.10', 'a': 'test value', 'b': 'another value'}
     info = ServiceInfo("_http._tcp.local.", "My Service Name._http._tcp.local.", socket.inet_aton("127.0.0.1"), 1234, 0, 0, desc)
     print "   Registering service..."
     r.registerService(info)
--- a/util/misc.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/util/misc.py	Tue Aug 15 15:50:30 2017 +0300
@@ -46,7 +46,7 @@
 def GetClassImporter(classpath):
     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/util/paths.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/util/paths.py	Tue Aug 15 15:50:30 2017 +0300
@@ -28,7 +28,7 @@
 
 def AbsFile(file):
     if isinstance(file, str):
-        file = unicode(file,sys.getfilesystemencoding())
+        file = unicode(file, sys.getfilesystemencoding())
     return file
 
 
--- a/version.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/version.py	Tue Aug 15 15:50:30 2017 +0300
@@ -59,7 +59,7 @@
     # try to read revision from file
     if rev is None:
         try:
-            f = open(os.path.join(app_dir,"revision"))
+            f = open(os.path.join(app_dir, "revision"))
             rev = f.readline()
         except:
             pass
--- a/wxglade_hmi/wxglade_hmi.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/wxglade_hmi/wxglade_hmi.py	Tue Aug 15 15:50:30 2017 +0300
@@ -77,7 +77,7 @@
         glade = os.path.join(path, 'wxglade.py')
         if wx.Platform == '__WXMSW__':
             glade = "\"%s\"" % glade
-        mode = {False:os.P_NOWAIT, True:os.P_WAIT}[wait]
+        mode = {False: os.P_NOWAIT, True: os.P_WAIT}[wait]
         os.spawnv(mode, sys.executable, ["\"%s\"" % sys.executable] + [glade] + options)
 
     def OnCTNSave(self, from_project_path=None):
@@ -122,7 +122,7 @@
 
         declare_hmi = "\n".join(["%(name)s = None\n" % x +
                           "\n".join(["%(class)s.%(h)s = %(h)s"%
-                            dict(x,h=h) for h in x['handlers']])
+                            dict(x, h=h) for h in x['handlers']])
                                 for x in hmi_frames])
         global_hmi = ("global %s\n" % ",".join(
                          [x["name"] for x in hmi_frames])
@@ -140,13 +140,13 @@
                 for x in hmi_frames])
 
         self.PreSectionsTexts = {
-            "globals":define_hmi,
-            "start":global_hmi,
-            "stop":global_hmi + cleanup_hmi
+            "globals": define_hmi,
+            "start":   global_hmi,
+            "stop":    global_hmi + cleanup_hmi
         }
         self.PostSectionsTexts = {
-            "globals":declare_hmi,
-            "start":init_hmi,
+            "globals": declare_hmi,
+            "start":   init_hmi,
         }
 
         return PythonFileCTNMixin.CTNGenerate_C(self, buildpath, locations)
@@ -164,7 +164,7 @@
         if open_wxglade:
             if not os.path.exists(wxg_filename):
                 hmi_name = self.BaseParams.getName()
-                open(wxg_filename,"w").write("""<?xml version="1.0"?>
+                open(wxg_filename, "w").write("""<?xml version="1.0"?>
     <application path="" name="" class="" option="0" language="python" top_window="%(name)s" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.8" is_template="0">
         <object class="%(class)s" name="%(name)s" base="EditFrame">
             <style>wxDEFAULT_FRAME_STYLE</style>
--- a/xmlclass/xsdschema.py	Tue Aug 15 12:17:51 2017 +0300
+++ b/xmlclass/xsdschema.py	Tue Aug 15 15:50:30 2017 +0300
@@ -509,7 +509,7 @@
     if base is not None:
         basetypeinfos = factory.FindSchemaElement(base)
         if not isinstance(basetypeinfos, (UnicodeType, StringType)) and basetypeinfos["type"] == COMPLEXTYPE:
-            attrnames = dict(map(lambda x:(x["name"], True), basetypeinfos["attributes"]))
+            attrnames = dict(map(lambda x: (x["name"], True), basetypeinfos["attributes"]))
 
     for element in elements:
         if element["type"] == ATTRIBUTE:
@@ -2210,7 +2210,7 @@
     "long": {
         "type": SIMPLETYPE,
         "basename": "long",
-        "extract": GenerateIntegerExtraction(minInclusive=-2**63,maxExclusive=2**63),
+        "extract": GenerateIntegerExtraction(minInclusive=-2**63, maxExclusive=2**63),
         "facets": DECIMAL_FACETS,
         "generate": GenerateSimpleTypeXMLText(str),
         "initial": lambda: 0,
@@ -2220,7 +2220,7 @@
     "unsignedLong": {
         "type": SIMPLETYPE,
         "basename": "unsignedLong",
-        "extract": GenerateIntegerExtraction(minInclusive=0,maxExclusive=2**64),
+        "extract": GenerateIntegerExtraction(minInclusive=0, maxExclusive=2**64),
         "facets": DECIMAL_FACETS,
         "generate": GenerateSimpleTypeXMLText(str),
         "initial": lambda: 0,
@@ -2230,7 +2230,7 @@
     "int": {
         "type": SIMPLETYPE,
         "basename": "int",
-        "extract": GenerateIntegerExtraction(minInclusive=-2**31,maxExclusive=2**31),
+        "extract": GenerateIntegerExtraction(minInclusive=-2**31, maxExclusive=2**31),
         "facets": DECIMAL_FACETS,
         "generate": GenerateSimpleTypeXMLText(str),
         "initial": lambda: 0,
@@ -2240,7 +2240,7 @@
     "unsignedInt": {
         "type": SIMPLETYPE,
         "basename": "unsignedInt",
-        "extract": GenerateIntegerExtraction(minInclusive=0,maxExclusive=2**32),
+        "extract": GenerateIntegerExtraction(minInclusive=0, maxExclusive=2**32),
         "facets": DECIMAL_FACETS,
         "generate": GenerateSimpleTypeXMLText(str),
         "initial": lambda: 0,
@@ -2250,7 +2250,7 @@
     "short": {
         "type": SIMPLETYPE,
         "basename": "short",
-        "extract": GenerateIntegerExtraction(minInclusive=-2**15,maxExclusive=2**15),
+        "extract": GenerateIntegerExtraction(minInclusive=-2**15, maxExclusive=2**15),
         "facets": DECIMAL_FACETS,
         "generate": GenerateSimpleTypeXMLText(str),
         "initial": lambda: 0,
@@ -2260,7 +2260,7 @@
     "unsignedShort": {
         "type": SIMPLETYPE,
         "basename": "unsignedShort",
-        "extract": GenerateIntegerExtraction(minInclusive=0,maxExclusive=2**16),
+        "extract": GenerateIntegerExtraction(minInclusive=0, maxExclusive=2**16),
         "facets": DECIMAL_FACETS,
         "generate": GenerateSimpleTypeXMLText(str),
         "initial": lambda: 0,
@@ -2270,7 +2270,7 @@
     "byte": {
         "type": SIMPLETYPE,
         "basename": "byte",
-        "extract": GenerateIntegerExtraction(minInclusive=-2**7,maxExclusive=2**7),
+        "extract": GenerateIntegerExtraction(minInclusive=-2**7, maxExclusive=2**7),
         "facets": DECIMAL_FACETS,
         "generate": GenerateSimpleTypeXMLText(str),
         "initial": lambda: 0,
@@ -2280,7 +2280,7 @@
     "unsignedByte": {
         "type": SIMPLETYPE,
         "basename": "unsignedByte",
-        "extract": GenerateIntegerExtraction(minInclusive=0,maxExclusive=2**8),
+        "extract": GenerateIntegerExtraction(minInclusive=0, maxExclusive=2**8),
         "facets": DECIMAL_FACETS,
         "generate": GenerateSimpleTypeXMLText(str),
         "initial": lambda: 0,
@@ -2322,7 +2322,7 @@
         "basename": "boolean",
         "extract": GetBoolean,
         "facets": GenerateDictFacets(["pattern", "whiteSpace"]),
-        "generate": GenerateSimpleTypeXMLText(lambda x:{True: "true", False: "false"}[x]),
+        "generate": GenerateSimpleTypeXMLText(lambda x: {True: "true", False: "false"}[x]),
         "initial": lambda: False,
         "check": lambda x: isinstance(x, BooleanType)
     },
@@ -2343,7 +2343,7 @@
         "extract": GetDateTime,
         "facets": NUMBER_FACETS,
         "generate": GenerateSimpleTypeXMLText(datetime.datetime.isoformat),
-        "initial": lambda: datetime.datetime(1,1,1,0,0,0,0),
+        "initial": lambda: datetime.datetime(1, 1, 1, 0, 0, 0, 0),
         "check": lambda x: isinstance(x, datetime.datetime)
     },
 
@@ -2353,7 +2353,7 @@
         "extract": GetDate,
         "facets": NUMBER_FACETS,
         "generate": GenerateSimpleTypeXMLText(datetime.date.isoformat),
-        "initial": lambda: datetime.date(1,1,1),
+        "initial": lambda: datetime.date(1, 1, 1),
         "check": lambda x: isinstance(x, datetime.date)
     },
 
@@ -2363,7 +2363,7 @@
         "extract": GetTime,
         "facets": NUMBER_FACETS,
         "generate": GenerateSimpleTypeXMLText(datetime.time.isoformat),
-        "initial": lambda: datetime.time(0,0,0,0),
+        "initial": lambda: datetime.time(0, 0, 0, 0),
         "check": lambda x: isinstance(x, datetime.time)
     },
 
@@ -2548,5 +2548,5 @@
     },
 
     # Complex Types
-    "anyType": {"type": COMPLEXTYPE, "extract": lambda x:None},
+    "anyType": {"type": COMPLEXTYPE, "extract": lambda x: None},
 }