clean-up: fix most PEP8 E266 too many leading '#' for block comment
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 16 Aug 2017 13:49:02 +0300
changeset 1753 19f19c66b67e
parent 1752 d14ff9d7eb76
child 1754 63f4af6bf6d9
clean-up: fix most PEP8 E266 too many leading '#' for block comment
PLCControler.py
PLCGenerator.py
connectors/WAMP/__init__.py
editors/DataTypeEditor.py
editors/LDViewer.py
graphics/FBD_Objects.py
runtime/WampClient.py
svgui/pyjs/build.py
targets/toolchain_gcc.py
--- a/PLCControler.py	Wed Aug 16 13:01:13 2017 +0300
+++ b/PLCControler.py	Wed Aug 16 13:49:02 2017 +0300
@@ -3127,17 +3127,17 @@
                 new_task.setname(task["Name"])
                 if task["Triggering"] == "Interrupt":
                     new_task.setsingle(task["Single"])
-##                result = duration_model.match(task["Interval"]).groups()
-##                if reduce(lambda x, y: x or y != None, result):
-##                    values = []
-##                    for value in result[:-1]:
-##                        if value != None:
-##                            values.append(int(value))
-##                        else:
-##                            values.append(0)
-##                    if result[-1] is not None:
-##                        values.append(int(float(result[-1]) * 1000))
-##                    new_task.setinterval(datetime.time(*values))
+#                result = duration_model.match(task["Interval"]).groups()
+#                if reduce(lambda x, y: x or y != None, result):
+#                    values = []
+#                    for value in result[:-1]:
+#                        if value != None:
+#                            values.append(int(value))
+#                        else:
+#                            values.append(0)
+#                    if result[-1] is not None:
+#                        values.append(int(float(result[-1]) * 1000))
+#                    new_task.setinterval(datetime.time(*values))
                 if task["Triggering"] == "Cyclic":
                     new_task.setinterval(task["Interval"])
                 new_task.setpriority(int(task["Priority"]))
@@ -3171,19 +3171,19 @@
                     new_task["Single"] = ""
                 interval = task.getinterval()
                 if interval is not None:
-##                    text = ""
-##                    if interval.hour != 0:
-##                        text += "%dh"%interval.hour
-##                    if interval.minute != 0:
-##                        text += "%dm"%interval.minute
-##                    if interval.second != 0:
-##                        text += "%ds"%interval.second
-##                    if interval.microsecond != 0:
-##                        if interval.microsecond % 1000 != 0:
-##                            text += "%.3fms"%(float(interval.microsecond) / 1000)
-##                        else:
-##                            text += "%dms"%(interval.microsecond / 1000)
-##                    new_task["Interval"] = text
+#                    text = ""
+#                    if interval.hour != 0:
+#                        text += "%dh"%interval.hour
+#                    if interval.minute != 0:
+#                        text += "%dm"%interval.minute
+#                    if interval.second != 0:
+#                        text += "%ds"%interval.second
+#                    if interval.microsecond != 0:
+#                        if interval.microsecond % 1000 != 0:
+#                            text += "%.3fms"%(float(interval.microsecond) / 1000)
+#                        else:
+#                            text += "%dms"%(interval.microsecond / 1000)
+#                    new_task["Interval"] = text
                     new_task["Interval"] = interval
                 else:
                     new_task["Interval"] = ""
--- a/PLCGenerator.py	Wed Aug 16 13:01:13 2017 +0300
+++ b/PLCGenerator.py	Wed Aug 16 13:49:02 2017 +0300
@@ -414,16 +414,16 @@
                 resrce += [("INTERVAL := ", ()),
                            (interval, (tagname, "task", task_number, "interval")),
                            (",", ())]
-##                resrce += [("INTERVAL := t#", ())]
-##                if interval.hour != 0:
-##                    resrce += [("%dh"%interval.hour, (tagname, "task", task_number, "interval", "hour"))]
-##                if interval.minute != 0:
-##                    resrce += [("%dm"%interval.minute, (tagname, "task", task_number, "interval", "minute"))]
-##                if interval.second != 0:
-##                    resrce += [("%ds"%interval.second, (tagname, "task", task_number, "interval", "second"))]
-##                if interval.microsecond != 0:
-##                    resrce += [("%dms"%(interval.microsecond / 1000), (tagname, "task", task_number, "interval", "millisecond"))]
-##                resrce += [(",", ())]
+#                resrce += [("INTERVAL := t#", ())]
+#                if interval.hour != 0:
+#                    resrce += [("%dh"%interval.hour, (tagname, "task", task_number, "interval", "hour"))]
+#                if interval.minute != 0:
+#                    resrce += [("%dm"%interval.minute, (tagname, "task", task_number, "interval", "minute"))]
+#                if interval.second != 0:
+#                    resrce += [("%ds"%interval.second, (tagname, "task", task_number, "interval", "second"))]
+#                if interval.microsecond != 0:
+#                    resrce += [("%dms"%(interval.microsecond / 1000), (tagname, "task", task_number, "interval", "millisecond"))]
+#                resrce += [(",", ())]
             # Priority argument
             resrce += [("PRIORITY := ", ()),
                        ("%d" % task.getpriority(), (tagname, "task", task_number, "priority")),
--- a/connectors/WAMP/__init__.py	Wed Aug 16 13:01:13 2017 +0300
+++ b/connectors/WAMP/__init__.py	Wed Aug 16 13:49:02 2017 +0300
@@ -74,7 +74,7 @@
 
     def RegisterWampClient():
 
-        ## start logging to console
+        # start logging to console
         # log.startLogging(sys.stdout)
 
         # create a WAMP application session factory
--- a/editors/DataTypeEditor.py	Wed Aug 16 13:01:13 2017 +0300
+++ b/editors/DataTypeEditor.py	Wed Aug 16 13:49:02 2017 +0300
@@ -592,17 +592,17 @@
                 message = _("\"%s\" is not a valid identifier!") % value
             elif value.upper() in IEC_KEYWORDS:
                 message = _("\"%s\" is a keyword. It can't be used!") % value
-##            elif value.upper() in self.PouNames:
-##                message = _("A pou with \"%s\" as name exists!")%value
+#            elif value.upper() in self.PouNames:
+#                message = _("A pou with \"%s\" as name exists!")%value
             elif value.upper() in [var["Name"].upper() for idx, var in enumerate(self.StructureElementsTable.GetData()) if idx != row]:
                 message = _("An element named \"%s\" already exists in this structure!") % value
             else:
                 self.RefreshTypeInfos()
                 wx.CallAfter(self.StructureElementsTable.ResetView, self.StructureElementsGrid)
-##                old_value = self.Table.GetOldValue()
-##                if old_value != "":
-##                    self.Controler.UpdateEditedElementUsedVariable(self.TagName, old_value, value)
-##                self.Controler.BufferProject()
+#                old_value = self.Table.GetOldValue()
+#                if old_value != "":
+#                    self.Controler.UpdateEditedElementUsedVariable(self.TagName, old_value, value)
+#                self.Controler.BufferProject()
                 event.Skip()
 
             if message is not None:
@@ -640,15 +640,15 @@
             AppendMenu(type_menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Array"))
             self.Bind(wx.EVT_MENU, self.ElementArrayTypeFunction, id=new_id)
 
-##            functionblock_menu = wx.Menu(title='')
-##            bodytype = self.Controler.GetEditedElementBodyType(self.TagName)
-##            pouname, poutype = self.Controler.GetEditedElementType(self.TagName)
-##            if classtype in ["Input","Output","InOut","External","Global"] or poutype != "function" and bodytype in ["ST", "IL"]:
-##                for functionblock_type in self.Controler.GetFunctionBlockTypes(self.TagName):
-##                    new_id = wx.NewId()
-##                    AppendMenu(functionblock_menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=functionblock_type)
-##                    self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(functionblock_type), id=new_id)
-##                type_menu.AppendMenu(wx.NewId(), _("Function Block Types"), functionblock_menu)
+#            functionblock_menu = wx.Menu(title='')
+#            bodytype = self.Controler.GetEditedElementBodyType(self.TagName)
+#            pouname, poutype = self.Controler.GetEditedElementType(self.TagName)
+#            if classtype in ["Input","Output","InOut","External","Global"] or poutype != "function" and bodytype in ["ST", "IL"]:
+#                for functionblock_type in self.Controler.GetFunctionBlockTypes(self.TagName):
+#                    new_id = wx.NewId()
+#                    AppendMenu(functionblock_menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=functionblock_type)
+#                    self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(functionblock_type), id=new_id)
+#                type_menu.AppendMenu(wx.NewId(), _("Function Block Types"), functionblock_menu)
 
             rect = self.StructureElementsGrid.BlockToDeviceRect((row, col), (row, col))
             self.StructureElementsGrid.PopupMenuXY(type_menu, rect.x + rect.width, rect.y + self.StructureElementsGrid.GetColLabelSize())
--- a/editors/LDViewer.py	Wed Aug 16 13:01:13 2017 +0300
+++ b/editors/LDViewer.py	Wed Aug 16 13:49:02 2017 +0300
@@ -70,9 +70,9 @@
             removed = []
             for child in values["children"]:
                 if child != "stop":
-##                    if child in elements:
-##                        RemoveElement(child, element_tree)
-##                        removed.append(child)
+#                    if child in elements:
+#                        RemoveElement(child, element_tree)
+#                        removed.append(child)
                     if "start" in element_tree[child]["parents"]:
                         if element not in remove_stops["stop"]:
                             remove_stops["stop"].append(element)
@@ -100,7 +100,7 @@
             if child != "stop":
                 RemoveElement(child, element_tree)
         element_tree.pop(remove)
-##        element_tree[remove] = None
+#        element_tree[remove] = None
 
 
 def GenerateTree(element, element_tree, stop_list):
@@ -118,12 +118,12 @@
             for wire, handle in connector.GetWires():
                 next = wire.EndConnected.GetParentBlock()
                 if isinstance(next, LD_PowerRail) and next.GetType() == LEFTRAIL or next in stop_list:
-##                    for remove in element_tree[element]["children"]:
-##                        RemoveElement(remove, element_tree)
-##                    element_tree[element]["children"] = ["stop"]
+#                    for remove in element_tree[element]["children"]:
+#                        RemoveElement(remove, element_tree)
+#                    element_tree[element]["children"] = ["stop"]
                     element_tree[element]["children"].append("stop")
-##                elif element_tree[element]["children"] == ["stop"]:
-##                    element_tree[next] = None
+#                elif element_tree[element]["children"] == ["stop"]:
+#                    element_tree[next] = None
                 elif next not in element_tree or element_tree[next]:
                     element_tree[element]["children"].append(next)
                     if next in element_tree:
--- a/graphics/FBD_Objects.py	Wed Aug 16 13:01:13 2017 +0300
+++ b/graphics/FBD_Objects.py	Wed Aug 16 13:49:02 2017 +0300
@@ -380,17 +380,17 @@
             handle.SetEdge(edge)
             self.RefreshModel(False)
 
-##    # Method called when a Motion event have been generated
-##    def OnMotion(self, event, dc, scaling):
-##        if not event.Dragging():
-##            pos = event.GetLogicalPosition(dc)
-##            for input in self.Inputs:
-##                rect = input.GetRedrawRect()
-##                if rect.InsideXY(pos.x, pos.y):
-##                    print "Find input"
-##                    tip = wx.TipWindow(self.Parent, "Test")
-##                    tip.SetBoundingRect(rect)
-##        return Graphic_Element.OnMotion(self, event, dc, scaling)
+#    # Method called when a Motion event have been generated
+#    def OnMotion(self, event, dc, scaling):
+#        if not event.Dragging():
+#            pos = event.GetLogicalPosition(dc)
+#            for input in self.Inputs:
+#                rect = input.GetRedrawRect()
+#                if rect.InsideXY(pos.x, pos.y):
+#                    print "Find input"
+#                    tip = wx.TipWindow(self.Parent, "Test")
+#                    tip.SetBoundingRect(rect)
+#        return Graphic_Element.OnMotion(self, event, dc, scaling)
 
     # Method called when a LeftDClick event have been generated
     def OnLeftDClick(self, event, dc, scaling):
--- a/runtime/WampClient.py	Wed Aug 16 13:01:13 2017 +0300
+++ b/runtime/WampClient.py	Wed Aug 16 13:49:02 2017 +0300
@@ -104,7 +104,7 @@
 
     WSClientConf = LoadWampClientConf(wampconf)
 
-    ## start logging to console
+    # start logging to console
     # log.startLogging(sys.stdout)
 
     # create a WAMP application session factory
--- a/svgui/pyjs/build.py	Wed Aug 16 13:01:13 2017 +0300
+++ b/svgui/pyjs/build.py	Wed Aug 16 13:49:02 2017 +0300
@@ -187,14 +187,14 @@
         except StandardError, e:
             print >>sys.stderr, "Exception creating output directory %s: %s" % (output, e)
 
-    ## public dir
+    # public dir
     for p in pyjs.path:
         pub_dir = join(p, 'public')
         if isdir(pub_dir):
             print "Copying: public directory of library %r" % p
             copytree_exists(pub_dir, output)
 
-    ## AppName.html - can be in current or public directory
+    # AppName.html - can be in current or public directory
     html_input_filename = app_name + ".html"
     html_output_filename = join(output, basename(html_input_filename))
     if os.path.isfile(html_input_filename):
@@ -211,7 +211,7 @@
     if check_html_file(html_input_filename, output):
         print >>sys.stderr, "Warning: Module HTML file %s has been auto-generated" % html_input_filename
 
-    ## pygwt.js
+    # pygwt.js
 
     print "Copying: pygwt.js"
 
@@ -222,7 +222,7 @@
 
     pygwt_js_output.close()
 
-    ## Images
+    # Images
 
     print "Copying: Images and History"
     copy_boilerplate(data_dir, "corner_dialog_topleft_black.png", output)
@@ -240,11 +240,11 @@
     copy_boilerplate(data_dir, "tree_white.gif", output)
     copy_boilerplate(data_dir, "history.html", output)
 
-    ## all.cache.html
+    # all.cache.html
     app_files = generateAppFiles(data_dir, js_includes, app_name, debug,
                                  output, dynamic, cache_buster, optimize)
 
-    ## AppName.nocache.html
+    # AppName.nocache.html
 
     print "Creating: %(app_name)s.nocache.html" % locals()
 
--- a/targets/toolchain_gcc.py	Wed Aug 16 13:01:13 2017 +0300
+++ b/targets/toolchain_gcc.py	Wed Aug 16 13:49:02 2017 +0300
@@ -158,7 +158,7 @@
 
         Builder_CFLAGS = ' '.join(self.getBuilderCFLAGS())
 
-        ######### GENERATE OBJECT FILES ########################################
+        # ----------------- GENERATE OBJECT FILES ------------------------
         obns = []
         objs = []
         relink = self.GetBinaryCode() is None
@@ -200,7 +200,7 @@
                     obns.append(os.path.basename(CFile))
                     objs.append(CFile)
 
-        ######### GENERATE OUTPUT FILE ########################################
+        # ---------------- GENERATE OUTPUT FILE --------------------------
         # Link all the object files into one binary file
         self.CTRInstance.logger.write(_("Linking :\n"))
         if relink: