clean-up: fix PEP8 E261 at least two spaces before inline comment
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Mon, 14 Aug 2017 23:34:22 +0300
changeset 1737 a39c2918c015
parent 1736 7e61baa047f0
child 1738 d2e979738700
clean-up: fix PEP8 E261 at least two spaces before inline comment
BeremizIDE.py
Beremiz_service.py
ConfigTreeNode.py
IDEFrame.py
PLCOpenEditor.py
ProjectController.py
canfestival/canfestival.py
controls/CustomToolTip.py
controls/DebugVariablePanel/DebugVariableGraphicViewer.py
controls/DebugVariablePanel/DebugVariablePanel.py
controls/LogViewer.py
controls/VariablePanel.py
editors/ConfTreeNodeEditor.py
editors/DebugViewer.py
graphics/DebugDataConsumer.py
runtime/PLCObject.py
svgui/pyjs/build.py
svgui/pyjs/jsonrpc/django/jsonrpc.py
svgui/pyjs/lib/sys.py
svgui/pyjs/pyjs.py
svgui/svgui.py
targets/typemapping.py
util/Zeroconf.py
--- a/BeremizIDE.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/BeremizIDE.py	Mon Aug 14 23:34:22 2017 +0300
@@ -1140,10 +1140,10 @@
     return '\n'.join(['%s%s: %s' % (indent, k, repr(v)[:10000]) for k, v in d.iteritems()])
 
 
-ignored_exceptions = [] # a problem with a line in a module is only reported once per session
-
-
-def AddExceptHook(path, app_version='[No version]'):#, ignored_exceptions=[]):
+ignored_exceptions = []  # a problem with a line in a module is only reported once per session
+
+
+def AddExceptHook(path, app_version='[No version]'):  #, ignored_exceptions=[]):
 
     def save_bug_report(e_type, e_value, e_traceback, bug_report_path,date):
         info = {
@@ -1178,7 +1178,7 @@
         output.close()
 
     def handle_exception(e_type, e_value, e_traceback):
-        traceback.print_exception(e_type, e_value, e_traceback) # this is very helpful when there's an exception in the rest of this func
+        traceback.print_exception(e_type, e_value, e_traceback)  # this is very helpful when there's an exception in the rest of this func
         last_tb = get_last_traceback(e_traceback)
         ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno)
         if ex not in ignored_exceptions:
--- a/Beremiz_service.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/Beremiz_service.py	Mon Aug 14 23:34:22 2017 +0300
@@ -51,7 +51,7 @@
     opts, argv = getopt.getopt(sys.argv[1:], "i:p:n:x:t:a:w:c:e:h")
 except getopt.GetoptError, err:
     # print help information and exit:
-    print str(err) # will print something like "option -a not recognized"
+    print str(err)  # will print something like "option -a not recognized"
     usage()
     sys.exit(2)
 
--- a/ConfigTreeNode.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/ConfigTreeNode.py	Mon Aug 14 23:34:22 2017 +0300
@@ -450,14 +450,14 @@
 
         # Now, try to guess the nearest available channel
         res = DesiredChannel
-        while res in AllChannels: # While channel not free
-            if res < CurrentChannel: # Want to go down ?
-                res -=  1 # Test for n-1
+        while res in AllChannels:  # While channel not free
+            if res < CurrentChannel:  # Want to go down ?
+                res -=  1  # Test for n-1
                 if res < 0 :
                     self.GetCTRoot().logger.write_warning(_("Cannot find lower free IEC channel than %d\n") % CurrentChannel)
-                    return CurrentChannel # Can't go bellow 0, do nothing
-            else : # Want to go up ?
-                res +=  1 # Test for n-1
+                    return CurrentChannel  # Can't go bellow 0, do nothing
+            else :  # Want to go up ?
+                res +=  1  # Test for n-1
         # Finally set IEC Channel
         self.BaseParams.setIEC_Channel(res)
         return res
@@ -561,7 +561,7 @@
                 # check name is unique
                 NewCTNName = _self.FindNewName(CTNName)
                 # If dir have already be made, and file exist
-                if os.path.isdir(_self.CTNPath(NewCTNName)): #and os.path.isfile(_self.ConfNodeXmlFilePath(CTNName)):
+                if os.path.isdir(_self.CTNPath(NewCTNName)):  #and os.path.isfile(_self.ConfNodeXmlFilePath(CTNName)):
                     # Load the confnode.xml file into parameters members
                     _self.LoadXMLParams(NewCTNName)
                     # Basic check. Better to fail immediately.
--- a/IDEFrame.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/IDEFrame.py	Mon Aug 14 23:34:22 2017 +0300
@@ -374,7 +374,7 @@
               kind=wx.ITEM_NORMAL, text=_(u'Redo') + '\tCTRL+Y')
         #AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO,
         #      kind=wx.ITEM_CHECK, text=_(u'Enable Undo/Redo'))
-        enable_undo_redo = _(u'Enable Undo/Redo') # Keeping text in translations for possible menu reactivation
+        enable_undo_redo = _(u'Enable Undo/Redo')  # Keeping text in translations for possible menu reactivation
         parent.AppendSeparator()
         AppendMenu(parent, help='', id=wx.ID_CUT,
               kind=wx.ITEM_NORMAL, text=_(u'Cut') + '\tCTRL+X')
@@ -2395,7 +2395,7 @@
 
         if self.ProjectTree.GetPyData(selected)["type"] != ITEM_PROJECT:
             pou_type = self.ProjectTree.GetItemText(selected)
-            pou_type = UNEDITABLE_NAMES_DICT[pou_type] # one of 'Functions', 'Function Blocks' or 'Programs'
+            pou_type = UNEDITABLE_NAMES_DICT[pou_type]  # one of 'Functions', 'Function Blocks' or 'Programs'
             pou_type = {'Functions': 'function', 'Function Blocks': 'functionBlock', 'Programs': 'program'}[pou_type]
         else:
             pou_type = None
--- a/PLCOpenEditor.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/PLCOpenEditor.py	Mon Aug 14 23:34:22 2017 +0300
@@ -460,13 +460,13 @@
     return '\n'.join(['%s%s: %s' % (indent, k, repr(v)[:10000]) for k, v in d.iteritems()])
 
 
-ignored_exceptions = [] # a problem with a line in a module is only reported once per session
-
-
-def AddExceptHook(path, app_version='[No version]'):#, ignored_exceptions=[]):
+ignored_exceptions = []  # a problem with a line in a module is only reported once per session
+
+
+def AddExceptHook(path, app_version='[No version]'):  #, ignored_exceptions=[]):
 
     def handle_exception(e_type, e_value, e_traceback):
-        traceback.print_exception(e_type, e_value, e_traceback) # this is very helpful when there's an exception in the rest of this func
+        traceback.print_exception(e_type, e_value, e_traceback)  # this is very helpful when there's an exception in the rest of this func
         last_tb = get_last_traceback(e_traceback)
         ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno)
         if str(e_value).startswith("!!!"):
@@ -476,11 +476,11 @@
             if result:
                 ignored_exceptions.append(ex)
                 info = {
-                    'app-title' : wx.GetApp().GetAppName(), # app_title
+                    'app-title' : wx.GetApp().GetAppName(),  # app_title
                     'app-version' : app_version,
                     'wx-version' : wx.VERSION_STRING,
                     'wx-platform' : wx.Platform,
-                    'python-version' : platform.python_version(), #sys.version.split()[0],
+                    'python-version' : platform.python_version(),  #sys.version.split()[0],
                     'platform' : platform.platform(),
                     'e-type' : e_type,
                     'e-value' : e_value,
@@ -490,7 +490,7 @@
                 if e_traceback:
                     info['traceback'] = ''.join(traceback.format_tb(e_traceback)) + '%s: %s' % (e_type, e_value)
                     last_tb = get_last_traceback(e_traceback)
-                    exception_locals = last_tb.tb_frame.f_locals # the locals at the level of the stack trace where the exception actually occurred
+                    exception_locals = last_tb.tb_frame.f_locals  # the locals at the level of the stack trace where the exception actually occurred
                     info['locals'] = format_namespace(exception_locals)
                     if 'self' in exception_locals:
                         info['self'] = format_namespace(exception_locals['self'].__dict__)
--- a/ProjectController.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/ProjectController.py	Mon Aug 14 23:34:22 2017 +0300
@@ -781,7 +781,7 @@
                         if first_line <= i <= last_line:
                             if last_section is not None:
                                 self.logger.write_warning("In section: " + last_section)
-                                last_section = None # only write section once
+                                last_section = None  # only write section once
                             self.logger.write_warning("%04d: %s" % (i, line))
 
                     f.close()
@@ -859,8 +859,8 @@
 
         return ([(C_file_name, self.plcCFLAGS)
                 for C_file_name in self.PLCGeneratedCFiles ],
-               "", # no ldflags
-               False) # do not expose retreive/publish calls
+               "",  # no ldflags
+               False)  # do not expose retreive/publish calls
 
     def ResetIECProgramsAndVariables(self):
         """
@@ -1012,7 +1012,7 @@
                       "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_level=%d; " % (i+1)+
@@ -1468,9 +1468,9 @@
         IECdebug_data = self.IECdebug_datas.get(IECPath, None)
         if IECdebug_data is None:
             IECdebug_data  = [
-                    WeakKeyDictionary(), # Callables
-                    [],                  # Data storage [(tick, data),...]
-                    "Registered",        # Variable status
+                    WeakKeyDictionary(),  # Callables
+                    [],                   # Data storage [(tick, data),...]
+                    "Registered",         # Variable status
                     None,
                     buffer_list]                # Forced value
             self.IECdebug_datas[IECPath] = IECdebug_data
@@ -1581,7 +1581,7 @@
                                     self.TracedIECPath,
                                     self.DebugValuesBuffers,
                                     debug_vars):
-                                IECdebug_data = self.IECdebug_datas.get(IECPath, None) #FIXME get
+                                IECdebug_data = self.IECdebug_datas.get(IECPath, None)  #FIXME get
                                 if IECdebug_data is not None and value is not None:
                                     forced = IECdebug_data[2:4] == ["Forced", value]
                                     if not IECdebug_data[4] and len(values_buffer) > 0:
--- a/canfestival/canfestival.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/canfestival/canfestival.py	Mon Aug 14 23:34:22 2017 +0300
@@ -129,21 +129,21 @@
                 profile, filepath = dialog.GetProfile()
                 NMT = dialog.GetNMTManagement()
                 options = dialog.GetOptions()
-                self.CreateNewNode(name,       # Name - will be changed at build time
-                                   id,         # NodeID - will be changed at build time
-                                   "slave",    # Type
-                                   description,# description
-                                   profile,    # profile
-                                   filepath,   # prfile filepath
-                                   NMT,        # NMT
-                                   options)     # options
+                self.CreateNewNode(name,         # Name - will be changed at build time
+                                   id,           # NodeID - will be changed at build time
+                                   "slave",      # Type
+                                   description,  # description
+                                   profile,      # profile
+                                   filepath,     # prfile filepath
+                                   NMT,          # NMT
+                                   options)      # options
             else:
                 self.CreateNewNode("SlaveNode",  # Name - will be changed at build time
                                    0x00,         # NodeID - will be changed at build time
                                    "slave",      # Type
                                    "",           # description
                                    "None",       # profile
-                                   "", # prfile filepath
+                                   "",           # prfile filepath
                                    "heartbeat",  # NMT
                                    [])           # options
             dialog.Destroy()
--- a/controls/CustomToolTip.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/controls/CustomToolTip.py	Mon Aug 14 23:34:22 2017 +0300
@@ -26,9 +26,9 @@
 
 from controls.CustomStyledTextCtrl import faces
 
-TOOLTIP_MAX_CHARACTERS = 30 # Maximum number of characters by line in ToolTip
-TOOLTIP_MAX_LINE = 5        # Maximum number of line in ToolTip
-TOOLTIP_WAIT_PERIOD = 0.5   # Wait period before displaying tooltip in second
+TOOLTIP_MAX_CHARACTERS = 30  # Maximum number of characters by line in ToolTip
+TOOLTIP_MAX_LINE = 5         # Maximum number of line in ToolTip
+TOOLTIP_WAIT_PERIOD = 0.5    # Wait period before displaying tooltip in second
 
 #-------------------------------------------------------------------------------
 #                               Custom ToolTip
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Mon Aug 14 23:34:22 2017 +0300
@@ -53,10 +53,10 @@
 # Canvas height
 [SIZE_MINI, SIZE_MIDDLE, SIZE_MAXI] = [0, 100, 200]
 
-CANVAS_BORDER = (20., 10.) # Border height on at bottom and top of graph
-CANVAS_PADDING = 8.5       # Border inside graph where no label is drawn
-VALUE_LABEL_HEIGHT = 17.   # Height of variable label in graph
-AXES_LABEL_HEIGHT = 12.75  # Height of variable value in graph
+CANVAS_BORDER = (20., 10.)  # Border height on at bottom and top of graph
+CANVAS_PADDING = 8.5        # Border inside graph where no label is drawn
+VALUE_LABEL_HEIGHT = 17.    # Height of variable label in graph
+AXES_LABEL_HEIGHT = 12.75   # Height of variable value in graph
 
 # Colors used cyclically for graph curves
 COLOR_CYCLE = ['r', 'b', 'g', 'm', 'y', 'k']
@@ -646,8 +646,8 @@
                 xw, yw = self.GetPosition()
                 self.ParentWindow.StartDragNDrop(self,
                     self.ItemsDict.values()[item_idx],
-                    x + xw, y + yw, # Current mouse position
-                    x + xw, y + yw) # Mouse position when button was clicked
+                    x + xw, y + yw,  # Current mouse position
+                    x + xw, y + yw)  # Mouse position when button was clicked
 
             # Don't handle mouse button if canvas is 3D and let matplotlib do
             # the default behavior (rotate 3D axes)
@@ -722,13 +722,13 @@
         # highlight
         elif event.button is None:
             # Compute direction for items label according graph type
-            if self.GraphType == GRAPH_PARALLEL: # Graph is parallel
+            if self.GraphType == GRAPH_PARALLEL:  # Graph is parallel
                 directions = [wx.RIGHT] * len(self.AxesLabels) + \
                              [wx.LEFT] * len(self.Labels)
-            elif len(self.AxesLabels) > 0: # Graph is orthogonal in 2D
-                directions = [wx.RIGHT, wx.TOP,  # Directions for AxesLabels
-                             wx.LEFT, wx.BOTTOM] # Directions for Labels
-            else: # Graph is orthogonal in 3D
+            elif len(self.AxesLabels) > 0:        # Graph is orthogonal in 2D
+                directions = [wx.RIGHT, wx.TOP,   # Directions for AxesLabels
+                             wx.LEFT, wx.BOTTOM]  # Directions for Labels
+            else:  # Graph is orthogonal in 3D
                 directions = [wx.LEFT] * len(self.Labels)
 
             # Find if mouse is over an item label
@@ -1022,11 +1022,11 @@
         self.Axes.tick_params(axis='y', labelsize='small')
 
         # Init variables storing graphical elements added to figure
-        self.Plots = []      # List of curves
-        self.VLine = None    # Vertical line for cursor
-        self.HLine = None    # Horizontal line for cursor (only orthogonal 2D)
-        self.AxesLabels = [] # List of items variable path text label
-        self.Labels = []     # List of items text label
+        self.Plots = []       # List of curves
+        self.VLine = None     # Vertical line for cursor
+        self.HLine = None     # Horizontal line for cursor (only orthogonal 2D)
+        self.AxesLabels = []  # List of items variable path text label
+        self.Labels = []      # List of items text label
 
         # Get function to add a text in figure according to graph type
         add_text_func = self.GetAddTextFunction()
@@ -1084,7 +1084,7 @@
         # expressed border and text position in pixel on screen and apply the
         # ratio calculated hereafter to get border and text position in
         # matplotlib coordinate
-        canvas_ratio = 1. / height # Divide by canvas height in pixel
+        canvas_ratio = 1. / height  # Divide by canvas height in pixel
         graph_ratio = 1. / (
             (1.0 - (CANVAS_BORDER[0] + CANVAS_BORDER[1]) * canvas_ratio)
              * height)             # Divide by figure height in pixel
--- a/controls/DebugVariablePanel/DebugVariablePanel.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariablePanel.py	Mon Aug 14 23:34:22 2017 +0300
@@ -41,11 +41,11 @@
 from DebugVariableTextViewer import DebugVariableTextViewer
 from DebugVariableGraphicViewer import *
 
-MILLISECOND = 1000000       # Number of nanosecond in a millisecond
-SECOND = 1000 * MILLISECOND # Number of nanosecond in a second
-MINUTE = 60 * SECOND        # Number of nanosecond in a minute
-HOUR = 60 * MINUTE          # Number of nanosecond in a hour
-DAY = 24 * HOUR             # Number of nanosecond in a day
+MILLISECOND = 1000000        # Number of nanosecond in a millisecond
+SECOND = 1000 * MILLISECOND  # Number of nanosecond in a second
+MINUTE = 60 * SECOND         # Number of nanosecond in a minute
+HOUR = 60 * MINUTE           # Number of nanosecond in a hour
+DAY = 24 * HOUR              # Number of nanosecond in a day
 
 # List of values possible for graph range
 # Format is [(time_in_plain_text, value_in_nanosecond),...]
@@ -207,10 +207,10 @@
 
         main_sizer = wx.BoxSizer(wx.VERTICAL)
 
-        self.Ticks = numpy.array([]) # List of tick received
-        self.StartTick = 0           # Tick starting range of data displayed
-        self.Fixed = False           # Flag that range of data is fixed
-        self.CursorTick = None       # Tick of cursor for displaying values
+        self.Ticks = numpy.array([])  # List of tick received
+        self.StartTick = 0            # Tick starting range of data displayed
+        self.Fixed = False            # Flag that range of data is fixed
+        self.CursorTick = None        # Tick of cursor for displaying values
 
         self.DraggingAxesPanel = None
         self.DraggingAxesBoundingBox = None
--- a/controls/LogViewer.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/controls/LogViewer.py	Mon Aug 14 23:34:22 2017 +0300
@@ -60,7 +60,7 @@
         self.Bind(wx.EVT_PAINT, self.OnPaint)
         self.Bind(wx.EVT_SIZE, self.OnResize)
 
-        self.ThumbPosition = 0. # -1 <= ThumbPosition <= 1
+        self.ThumbPosition = 0.  # -1 <= ThumbPosition <= 1
         self.ThumbScrollingStartPos = None
 
     def GetRangeRect(self):
--- a/controls/VariablePanel.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/controls/VariablePanel.py	Mon Aug 14 23:34:22 2017 +0300
@@ -73,7 +73,7 @@
     return {_("All"): _("All"), _("Interface"): _("Interface"),
             _("   Input"): _("Input"), _("   Output"): _("Output"), _("   InOut"): _("InOut"),
             _("   External"): _("External"), _("Variables"): _("Variables"), _("   Local"): _("Local"),
-            _("   Temp"): _("Temp"), _("Global"): _("Global")}#, _("Access") : _("Access")}
+            _("   Temp"): _("Temp"), _("Global"): _("Global")}  #, _("Access") : _("Access")}
 VARIABLE_CHOICES_DICT = dict([(_(_class), _class) for _class in GetFilterChoiceTransfer().iterkeys()])
 VARIABLE_CLASSES_DICT = dict([(_(_class), _class) for _class in GetFilterChoiceTransfer().itervalues()])
 
@@ -501,11 +501,11 @@
             self.Table = VariableTable(self, [], GetVariableTableColnames(True))
 
             if element_type in ["config", "resource"]:
-                self.FilterChoices = ["All", "Global"]#,"Access"]
+                self.FilterChoices = ["All", "Global"]  #,"Access"]
             else:
                 self.FilterChoices = ["All",
                                         "Interface", "   Input", "   Output", "   InOut", "   External",
-                                        "Variables", "   Local", "   Temp"]#,"Access"]
+                                        "Variables", "   Local", "   Temp"]  #,"Access"]
 
             # these condense the ColAlignements list
             l = wx.ALIGN_LEFT
--- a/editors/ConfTreeNodeEditor.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/editors/ConfTreeNodeEditor.py	Mon Aug 14 23:34:22 2017 +0300
@@ -100,7 +100,7 @@
         pos_x = (width-bw)/2+dw      # adjust for bitmap and text to centre
         pos_y = (height-bh-th)/2+dy
         if bmp !=None:
-            dc.DrawBitmap(bmp, pos_x, pos_y, hasMask) # draw bitmap if available
+            dc.DrawBitmap(bmp, pos_x, pos_y, hasMask)  # draw bitmap if available
             pos_x = (width-tw)/2+dw      # adjust for bitmap and text to centre
             pos_y += bh + 2
 
--- a/editors/DebugViewer.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/editors/DebugViewer.py	Mon Aug 14 23:34:22 2017 +0300
@@ -27,8 +27,8 @@
 
 import wx
 
-REFRESH_PERIOD = 0.1        # Minimum time between 2 refresh
-DEBUG_REFRESH_LOCK = Lock() # Common refresh lock for all debug viewers
+REFRESH_PERIOD = 0.1         # Minimum time between 2 refresh
+DEBUG_REFRESH_LOCK = Lock()  # Common refresh lock for all debug viewers
 
 #-------------------------------------------------------------------------------
 #                               Debug Viewer Class
--- a/graphics/DebugDataConsumer.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/graphics/DebugDataConsumer.py	Mon Aug 14 23:34:22 2017 +0300
@@ -74,10 +74,10 @@
     not_null = False
 
     for val, format in [
-            (int(microseconds) / DAY, "%dd"),                # Days
-            ((int(microseconds) % DAY) / HOUR, "%dh"),       # Hours
-            ((int(microseconds) % HOUR) / MINUTE, "%dm"),    # Minutes
-            ((int(microseconds) % MINUTE) / SECOND, "%ds")]: # Seconds
+            (int(microseconds) / DAY, "%dd"),                 # Days
+            ((int(microseconds) % DAY) / HOUR, "%dh"),        # Hours
+            ((int(microseconds) % HOUR) / MINUTE, "%dm"),     # Minutes
+            ((int(microseconds) % MINUTE) / SECOND, "%ds")]:  # Seconds
 
         # Add value to TIME literal if value is non-null or another non-null
         # value have already be found
--- a/runtime/PLCObject.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/runtime/PLCObject.py	Mon Aug 14 23:34:22 2017 +0300
@@ -61,7 +61,7 @@
     def __init__(self, workingdir, daemon, argv, statuschange, evaluator, pyruntimevars):
         pyro.ObjBase.__init__(self)
         self.evaluator = evaluator
-        self.argv = [workingdir] + argv # force argv[0] to be "path" to exec...
+        self.argv = [workingdir] + argv  # force argv[0] to be "path" to exec...
         self.workingdir = workingdir
         self.PLCStatus = "Empty"
         self.PLClibraryHandle = None
@@ -215,7 +215,7 @@
             self._LogMessage.restype = ctypes.c_int
             self._LogMessage.argtypes = [ctypes.c_uint8, ctypes.c_char_p, ctypes.c_uint32]
 
-            self._log_read_buffer = ctypes.create_string_buffer(1<<14) #16K
+            self._log_read_buffer = ctypes.create_string_buffer(1<<14)  #16K
             self._GetLogMessage = self.PLClibraryHandle.GetLogMessage
             self._GetLogMessage.restype = ctypes.c_uint32
             self._GetLogMessage.argtypes = [ctypes.c_uint8, ctypes.c_uint32, ctypes.c_char_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)]
@@ -519,10 +519,10 @@
             self.TraceLock.acquire()
             self.Traces = []
             self.TraceLock.release()
-            self._suspendDebug(True) # Disable debugger
+            self._suspendDebug(True)  # Disable debugger
             self.TraceWakeup.clear()
             self.TraceWakeup.wait()
-            self._resumeDebug() # Re-enable debugger
+            self._resumeDebug()  # Re-enable debugger
 
     def _TracesFlush(self):
         self.TraceLock.acquire()
--- a/svgui/pyjs/build.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/svgui/pyjs/build.py	Mon Aug 14 23:34:22 2017 +0300
@@ -663,7 +663,7 @@
         #time.sleep(0)
 
     if mod_list:
-        ordered_deps.append(mod_list) # last dependencies - usually the app(s)
+        ordered_deps.append(mod_list)  # last dependencies - usually the app(s)
 
     ordered_deps.reverse()
 
--- a/svgui/pyjs/jsonrpc/django/jsonrpc.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/svgui/pyjs/jsonrpc/django/jsonrpc.py	Mon Aug 14 23:34:22 2017 +0300
@@ -86,7 +86,7 @@
  'DateField': ['input_formats'],
  'DateTimeField': ['input_formats'],
  'TimeField': ['input_formats'],
- 'RegexField': ['max_length', 'min_length'], # sadly we can't get the expr
+ 'RegexField': ['max_length', 'min_length'],  # sadly we can't get the expr
  'EmailField': ['max_length', 'min_length'],
  'URLField': ['max_length', 'min_length', 'verify_exists', 'user_agent'],
  'ChoiceField': ['choices'],
@@ -154,7 +154,7 @@
 
         f = self.formcls(params)
 
-        if command is None: # just validate
+        if command is None:  # just validate
             if not f.is_valid():
                 return {'success':False, 'errors': builderrors(f)}
             return {'success':True}
@@ -170,7 +170,7 @@
         elif command.has_key('save'):
             if not f.is_valid():
                 return {'success':False, 'errors': builderrors(f)}
-            instance = f.save() # XXX: if you want more, over-ride save.
+            instance = f.save()  # XXX: if you want more, over-ride save.
             return {'success': True, 'instance': json_convert(instance) }
 
         elif command.has_key('html'):
--- a/svgui/pyjs/lib/sys.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/svgui/pyjs/lib/sys.py	Mon Aug 14 23:34:22 2017 +0300
@@ -1,8 +1,8 @@
 # the platform name (PyV8, smjs, Mozilla, IE6, Opera, Safari etc.)
-platform = '' # to be updated by app, on compile
+platform = ''  # to be updated by app, on compile
 
 # a dictionary of module override names (platform-specific)
-overrides = None # to be updated by app, on compile
+overrides = None  # to be updated by app, on compile
 
 # the remote path for loading modules
 loadpath = None
--- a/svgui/pyjs/pyjs.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/svgui/pyjs/pyjs.py	Mon Aug 14 23:34:22 2017 +0300
@@ -281,14 +281,14 @@
                 self._class(child)
             elif isinstance(child, ast.Import):
                 importName = child.names[0][0]
-                if importName == '__pyjamas__': # special module to help make pyjamas modules loadable in the python interpreter
+                if importName == '__pyjamas__':  # special module to help make pyjamas modules loadable in the python interpreter
                     pass
                 elif importName.endswith('.js'):
                    self.imported_js.add(importName)
                 else:
                    self.add_imported_module(strip_py(importName))
             elif isinstance(child, ast.From):
-                if child.modname == '__pyjamas__': # special module to help make pyjamas modules loadable in the python interpreter
+                if child.modname == '__pyjamas__':  # special module to help make pyjamas modules loadable in the python interpreter
                     pass
                 else:
                     self.add_imported_module(child.modname)
@@ -689,7 +689,7 @@
                     cls_name_ = cls_name.name_
                     cls_name = cls_name.name
                 else:
-                    cls_name_ = current_klass + "_" # XXX ???
+                    cls_name_ = current_klass + "_"  # XXX ???
                 name = UU+cls_name_ + ".prototype.__class__." \
                                    + v.name
                 if v.name == 'listener':
@@ -710,7 +710,7 @@
             call_name = UU+self.imported_classes[obj] + '.__' + obj + attr_str
         elif obj in self.module_imports():
             call_name = obj + "." + attr_name
-        elif obj[0] == obj[0].upper(): # XXX HACK ALERT
+        elif obj[0] == obj[0].upper():  # XXX HACK ALERT
             call_name = UU + self.modpfx() + "__" + obj + ".prototype.__class__." + attr_name
         else:
             call_name = UU+self._name(v, current_klass) + "." + attr_name
@@ -1202,7 +1202,7 @@
                 print >>self.output, "sys.popstack();\n"
 
         elif isinstance(node.expr, ast.Const):
-            if node.expr.value is not None: # Empty statements generate ignore None
+            if node.expr.value is not None:  # Empty statements generate ignore None
                 print >>self.output, self._const(node.expr)
         else:
             raise TranslationError("unsupported type (in _discard)", node.expr)
@@ -1396,7 +1396,7 @@
 
     def _mod(self, node, current_klass):
         if isinstance(node.left, ast.Const) and isinstance(node.left.value, StringType):
-           self.imported_js.add("sprintf.js") # Include the sprintf functionality if it is used
+           self.imported_js.add("sprintf.js")  # Include the sprintf functionality if it is used
            return "sprintf("+self.expr(node.left, current_klass) + ", " + self.expr(node.right, current_klass)+")"
         return self.expr(node.left, current_klass) + " % " + self.expr(node.right, current_klass)
 
@@ -1640,7 +1640,7 @@
         target.code = source.code
         target.argnames = source.argnames
         target.defaults = source.defaults
-        target.doc = source.doc # @@@ not sure we need to do this any more
+        target.doc = source.doc  # @@@ not sure we need to do this any more
 
 
 def dotreplace(fname):
--- a/svgui/svgui.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/svgui/svgui.py	Mon Aug 14 23:34:22 2017 +0300
@@ -48,7 +48,7 @@
          "name" : _("Import SVG"),
          "tooltip" : _("Import SVG"),
          "method" : "_ImportSVG"},
-        {"bitmap" : "ImportSVG", # should be something different
+        {"bitmap" : "ImportSVG",  # should be something different
          "name" : _("Inkscape"),
          "tooltip" : _("Create HMI"),
          "method" : "_StartInkscape"},
--- a/targets/typemapping.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/targets/typemapping.py	Mon Aug 14 23:34:22 2017 +0300
@@ -43,8 +43,8 @@
     """
     Must be changed according to changes in iec_types.h
     """
-    _fields_ = [("s", c_long), #tv_sec
-                ("ns", c_long)] #tv_nsec
+    _fields_ = [("s", c_long),   # tv_sec
+                ("ns", c_long)]  # tv_nsec
 
 
 def _t(t, u=lambda x:x.value, p=lambda t,x:t(x)): return  (t, u, p)
--- a/util/Zeroconf.py	Mon Aug 14 23:27:15 2017 +0300
+++ b/util/Zeroconf.py	Mon Aug 14 23:34:22 2017 +0300
@@ -105,23 +105,23 @@
 _MDNS_ADDR = '224.0.0.251'
 _MDNS_PORT = 5353;
 _DNS_PORT = 53;
-_DNS_TTL = 60 * 60; # one hour default TTL
-
-_MAX_MSG_TYPICAL = 1460 # unused
+_DNS_TTL = 60 * 60;  # one hour default TTL
+
+_MAX_MSG_TYPICAL = 1460  # unused
 _MAX_MSG_ABSOLUTE = 8972
 
-_FLAGS_QR_MASK = 0x8000 # query response mask
-_FLAGS_QR_QUERY = 0x0000 # query
-_FLAGS_QR_RESPONSE = 0x8000 # response
-
-_FLAGS_AA = 0x0400 # Authorative answer
-_FLAGS_TC = 0x0200 # Truncated
-_FLAGS_RD = 0x0100 # Recursion desired
-_FLAGS_RA = 0x8000 # Recursion available
-
-_FLAGS_Z = 0x0040 # Zero
-_FLAGS_AD = 0x0020 # Authentic data
-_FLAGS_CD = 0x0010 # Checking disabled
+_FLAGS_QR_MASK = 0x8000  # query response mask
+_FLAGS_QR_QUERY = 0x0000  # query
+_FLAGS_QR_RESPONSE = 0x8000  # response
+
+_FLAGS_AA = 0x0400  # Authorative answer
+_FLAGS_TC = 0x0200  # Truncated
+_FLAGS_RD = 0x0100  # Recursion desired
+_FLAGS_RA = 0x8000  # Recursion available
+
+_FLAGS_Z = 0x0040   # Zero
+_FLAGS_AD = 0x0020  # Authentic data
+_FLAGS_CD = 0x0010  # Checking disabled
 
 _CLASS_IN = 1
 _CLASS_CS = 2
@@ -755,7 +755,7 @@
         self.size -= 2
 
         length = len(''.join(self.data[index:]))
-        self.insertShort(index, length) # Here is the short we adjusted for
+        self.insertShort(index, length)  # Here is the short we adjusted for
 
     def packet(self):
         """Returns a string containing the packet's bytes
@@ -853,7 +853,7 @@
     def __init__(self, zeroconf):
         threading.Thread.__init__(self)
         self.zeroconf = zeroconf
-        self.readers = {} # maps socket to reader
+        self.readers = {}  # maps socket to reader
         self.timeout = 5
         self.condition = threading.Condition()
         self.start()