# HG changeset patch # User Andrey Skvortsov # Date 1502973805 -10800 # Node ID d5df428640ff530902dda821beb258b089648517 # Parent bcc07ff2362ccde1b1500803f99ba42bf6338d94 clean-up: fix PEP8 E502 the backslash is redundant between brackets diff -r bcc07ff2362c -r d5df428640ff ProjectController.py --- a/ProjectController.py Thu Aug 17 14:27:06 2017 +0300 +++ b/ProjectController.py Thu Aug 17 15:43:25 2017 +0300 @@ -1817,7 +1817,7 @@ extrafiles.extend( [(name, open(os.path.join(extrafilespath, name), - 'rb').read()) \ + 'rb').read()) for name in os.listdir(extrafilespath)]) # Send PLC on target diff -r bcc07ff2362c -r d5df428640ff controls/DebugVariablePanel/DebugVariableGraphicViewer.py --- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Aug 17 14:27:06 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Aug 17 15:43:25 2017 +0300 @@ -584,7 +584,7 @@ # 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 + \ + 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 diff -r bcc07ff2362c -r d5df428640ff controls/VariablePanel.py --- a/controls/VariablePanel.py Thu Aug 17 14:27:06 2017 +0300 +++ b/controls/VariablePanel.py Thu Aug 17 15:43:25 2017 +0300 @@ -342,11 +342,10 @@ if var_name is None: return elif var_name.upper() in [name.upper() - for name in self.ParentWindow.Controler.\ - GetProjectPouNames(self.ParentWindow.Debug)]: + for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]: message = _("\"%s\" pou already exists!") % var_name elif not var_name.upper() in [name.upper() - for name in self.ParentWindow.Controler.\ + for name in self.ParentWindow.Controler. GetEditedElementVariables(tagname, self.ParentWindow.Debug)]: var_infos = self.ParentWindow.DefaultValue.copy() var_infos.Name = var_name @@ -378,8 +377,7 @@ if len(configs) == 0: return if not var_name.upper() in [name.upper() - for name in self.ParentWindow.Controler.\ - GetConfigurationVariableNames(configs[0])]: + for name in self.ParentWindow.Controler.GetConfigurationVariableNames(configs[0])]: self.ParentWindow.Controler.AddConfigurationGlobalVar( configs[0], values[2], var_name, location, "") var_infos.Class = "External" diff -r bcc07ff2362c -r d5df428640ff dialogs/BlockPreviewDialog.py --- a/dialogs/BlockPreviewDialog.py Thu Aug 17 14:27:06 2017 +0300 +++ b/dialogs/BlockPreviewDialog.py Thu Aug 17 15:43:25 2017 +0300 @@ -215,8 +215,7 @@ # or another graphic element elif ((self.DefaultElementName is None or self.DefaultElementName.upper() != uppercase_element_name) and - uppercase_element_name in self.Controller.\ - GetEditedElementVariables(self.TagName)): + uppercase_element_name in self.Controller.GetEditedElementVariables(self.TagName)): message_format = _("\"%s\" element for this pou already exists!") # If an error have been identify, show error message dialog diff -r bcc07ff2362c -r d5df428640ff editors/SFCViewer.py --- a/editors/SFCViewer.py Thu Aug 17 14:27:06 2017 +0300 +++ b/editors/SFCViewer.py Thu Aug 17 15:43:25 2017 +0300 @@ -342,8 +342,8 @@ # This method check the IEC 61131-3 compatibility between two SFC blocks def BlockCompatibility(self, startblock=None, endblock=None, direction=None): - if startblock is not None and endblock is not None and (isinstance(startblock, SFC_Objects)\ - or isinstance(endblock, SFC_Objects)): + if startblock is not None and endblock is not 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): diff -r bcc07ff2362c -r d5df428640ff editors/Viewer.py --- a/editors/Viewer.py Thu Aug 17 14:27:06 2017 +0300 +++ b/editors/Viewer.py Thu Aug 17 15:43:25 2017 +0300 @@ -1497,8 +1497,8 @@ wire.EndConnected = end_connector connected.RefreshConnectors() self.AddWire(wire) - if selection is not None and (\ - selection[1].get((id, refLocalId), False) or \ + if selection is not None and ( + selection[1].get((id, refLocalId), False) or selection[1].get((refLocalId, id), False)): self.SelectInGroup(wire) else: diff -r bcc07ff2362c -r d5df428640ff graphics/DebugDataConsumer.py --- a/graphics/DebugDataConsumer.py Thu Aug 17 14:27:06 2017 +0300 +++ b/graphics/DebugDataConsumer.py Thu Aug 17 15:43:25 2017 +0300 @@ -44,8 +44,8 @@ @param value: Time duration to convert @return: Time duration expressed in microsecond """ - return float(value.days * DAY + \ - value.seconds * SECOND + \ + return float(value.days * DAY + + value.seconds * SECOND + value.microseconds) return diff -r bcc07ff2362c -r d5df428640ff graphics/GraphicCommons.py --- a/graphics/GraphicCommons.py Thu Aug 17 14:27:06 2017 +0300 +++ b/graphics/GraphicCommons.py Thu Aug 17 15:43:25 2017 +0300 @@ -1089,9 +1089,9 @@ if self.ValueSize is not None: width, height = self.ValueSize rect = rect.Union(wx.Rect( - parent_pos[0] + self.Pos.x + CONNECTOR_SIZE * self.Direction[0] + \ + parent_pos[0] + self.Pos.x + CONNECTOR_SIZE * self.Direction[0] + width * (self.Direction[0] - 1) / 2, - parent_pos[1] + self.Pos.y + CONNECTOR_SIZE * self.Direction[1] + \ + parent_pos[1] + self.Pos.y + CONNECTOR_SIZE * self.Direction[1] + height * (self.Direction[1] - 1), width, height)) return rect @@ -1548,9 +1548,9 @@ if self.ValueSize is not None: width, height = self.ValueSize dc.DrawText(self.ComputedValue, - parent_pos[0] + self.Pos.x + CONNECTOR_SIZE * self.Direction[0] + \ + parent_pos[0] + self.Pos.x + CONNECTOR_SIZE * self.Direction[0] + width * (self.Direction[0] - 1) / 2, - parent_pos[1] + self.Pos.y + CONNECTOR_SIZE * self.Direction[1] + \ + parent_pos[1] + self.Pos.y + CONNECTOR_SIZE * self.Direction[1] + height * (self.Direction[1] - 1)) dc.SetFont(self.ParentBlock.Parent.GetFont()) dc.SetTextForeground(wx.BLACK) diff -r bcc07ff2362c -r d5df428640ff py_ext/PythonFileCTNMixin.py --- a/py_ext/PythonFileCTNMixin.py Thu Aug 17 14:27:06 2017 +0300 +++ b/py_ext/PythonFileCTNMixin.py Thu Aug 17 15:43:25 2017 +0300 @@ -103,10 +103,10 @@ varinfos = map(lambda variable: { "name": variable.getname(), "desc": repr(variable.getdesc()), - "onchangecode": '"'+variable.getonchange() + \ - "('"+variable.getname()+"')\"" \ + "onchangecode": '"' + variable.getonchange() + + "('" + variable.getname() + "')\"" if variable.getonchange() else '""', - "onchange": repr(variable.getonchange()) \ + "onchange": repr(variable.getonchange()) if variable.getonchange() else None, "opts": repr(variable.getopts()), "configname": configname.upper(), diff -r bcc07ff2362c -r d5df428640ff svgui/pyjs/build.py --- a/svgui/pyjs/build.py Thu Aug 17 14:27:06 2017 +0300 +++ b/svgui/pyjs/build.py Thu Aug 17 15:43:25 2017 +0300 @@ -286,8 +286,8 @@ tmpl = read_boilerplate(data_dir, "all.cache.html") parser = pyjs.PlatformParser("platform") app_headers = '' - scripts = ['' % script \ - for script in js_includes] + scripts = ['' % + script for script in js_includes] app_body = '\n'.join(scripts) mod_code = {} diff -r bcc07ff2362c -r d5df428640ff xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Thu Aug 17 14:27:06 2017 +0300 +++ b/xmlclass/xmlclass.py Thu Aug 17 15:43:25 2017 +0300 @@ -113,8 +113,7 @@ @return: function generated """ def GetUnknownValue(attr): - raise ValueError("\"%s\" type isn't supported by \"xmlclass\" yet!" % \ - type) + raise ValueError("\"%s\" type isn't supported by \"xmlclass\" yet!" % type) return GetUnknownValue @@ -224,16 +223,16 @@ except: raise ValueError("\"%s\" isn't a valid integer!" % value) if minInclusive is not None and value < minInclusive: - raise ValueError("\"%d\" isn't greater or equal to %d!" % \ + raise ValueError("\"%d\" isn't greater or equal to %d!" % (value, minInclusive)) if maxInclusive is not None and value > maxInclusive: - raise ValueError("\"%d\" isn't lesser or equal to %d!" % \ + raise ValueError("\"%d\" isn't lesser or equal to %d!" % (value, maxInclusive)) if minExclusive is not None and value <= minExclusive: - raise ValueError("\"%d\" isn't greater than %d!" % \ + raise ValueError("\"%d\" isn't greater than %d!" % (value, minExclusive)) if maxExclusive is not None and value >= maxExclusive: - raise ValueError("\"%d\" isn't lesser than %d!" % \ + raise ValueError("\"%d\" isn't lesser than %d!" % (value, maxExclusive)) return value return GetInteger @@ -444,8 +443,8 @@ if value in list: return value else: - raise ValueError("\"%s\" isn't a valid value for %s!" % \ - (value, type)) + raise ValueError( + "\"%s\" isn't a valid value for %s!" % (value, type)) return GetEnumerated @@ -506,8 +505,8 @@ if item in list: values.append(item) else: - raise ValueError("\"%s\" isn't a valid value for %s!" % \ - (value, type)) + raise ValueError( + "\"%s\" isn't a valid value for %s!" % (value, type)) return values return GetLists @@ -538,8 +537,7 @@ if result is not None: values.append(item) else: - raise ValueError("\"%s\" isn't a valid value for %s!" % \ - (value, type)) + raise ValueError("\"%s\" isn't a valid value for %s!" % (value, type)) return values return GetModelNameList