# HG changeset patch # User Andrey Skvortsov # Date 1502979917 -10800 # Node ID c1e5b9f1948346665379a232502e52964d4640ce # Parent ccf59c1f0b4561d55a4462dce061b631e9d6ef0c clean-up: fix PEP8 E129 visually indented line with same indent as next logical line diff -r ccf59c1f0b45 -r c1e5b9f19483 BeremizIDE.py --- a/BeremizIDE.py Thu Aug 17 16:26:32 2017 +0300 +++ b/BeremizIDE.py Thu Aug 17 17:25:17 2017 +0300 @@ -422,12 +422,12 @@ # Icons for location items for imgname, itemtype in [ - ("CONFIGURATION", LOCATION_CONFNODE), - ("RESOURCE", LOCATION_MODULE), - ("PROGRAM", LOCATION_GROUP), - ("VAR_INPUT", LOCATION_VAR_INPUT), - ("VAR_OUTPUT", LOCATION_VAR_OUTPUT), - ("VAR_LOCAL", LOCATION_VAR_MEMORY)]: + ("CONFIGURATION", LOCATION_CONFNODE), + ("RESOURCE", LOCATION_MODULE), + ("PROGRAM", LOCATION_GROUP), + ("VAR_INPUT", LOCATION_VAR_INPUT), + ("VAR_OUTPUT", LOCATION_VAR_OUTPUT), + ("VAR_LOCAL", LOCATION_VAR_MEMORY)]: self.LocationImageDict[itemtype] = self.LocationImageList.Add(GetBitmap(imgname)) # Icons for other items diff -r ccf59c1f0b45 -r c1e5b9f19483 Beremiz_service.py --- a/Beremiz_service.py Thu Aug 17 16:26:32 2017 +0300 +++ b/Beremiz_service.py Thu Aug 17 17:25:17 2017 +0300 @@ -441,10 +441,10 @@ # Configure and publish service # Not publish service if localhost in address params - if (self.servicename is not None and - self.ip_addr is not None and - self.ip_addr != "localhost" and - self.ip_addr != "127.0.0.1"): + if self.servicename is not None and \ + self.ip_addr is not None and \ + self.ip_addr != "localhost" and \ + self.ip_addr != "127.0.0.1": print _("Publishing service on local network") self.servicepublisher = ServicePublisher.ServicePublisher() self.servicepublisher.RegisterService(self.servicename, self.ip_addr, self.port) diff -r ccf59c1f0b45 -r c1e5b9f19483 CodeFileTreeNode.py --- a/CodeFileTreeNode.py Thu Aug 17 16:26:32 2017 +0300 +++ b/CodeFileTreeNode.py Thu Aug 17 17:25:17 2017 +0300 @@ -113,8 +113,8 @@ '<%s>' % self.CODEFILE_NAME, '<%s xmlns:xhtml="http://www.w3.org/1999/xhtml">' % self.CODEFILE_NAME) for cre, repl in [ - (re.compile("(?)(?:)(?!)"), "]]>")]: + (re.compile("(?)(?:)(?!)"), "]]>")]: codefile_xml = cre.sub(repl, codefile_xml) try: diff -r ccf59c1f0b45 -r c1e5b9f19483 IDEFrame.py --- a/IDEFrame.py Thu Aug 17 16:26:32 2017 +0300 +++ b/IDEFrame.py Thu Aug 17 17:25:17 2017 +0300 @@ -260,9 +260,9 @@ others = [t for t in tabs if t != tab] 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 - other["pos"][0] == tab["pos"][0] + tab["size"][0] + TAB_BORDER): + if other["pos"][1] == tab["pos"][1] and \ + other["size"][1] == tab["size"][1] and \ + other["pos"][0] == tab["pos"][0] + tab["size"][0] + TAB_BORDER: tab["size"] = (tab["size"][0] + other["size"][0] + TAB_BORDER, tab["size"][1]) tab["pages"].extend(other["pages"]) @@ -275,9 +275,9 @@ others = [t for t in tabs if t != tab] 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 - other["pos"][1] == tab["pos"][1] + tab["size"][1] + TAB_BORDER): + if other["pos"][0] == tab["pos"][0] and \ + other["size"][0] == tab["size"][0] and \ + other["pos"][1] == tab["pos"][1] + tab["size"][1] + TAB_BORDER: tab["size"] = (tab["size"][0], tab["size"][1] + other["size"][1] + TAB_BORDER) tab["pages"].extend(other["pages"]) @@ -677,32 +677,32 @@ # Icons for other items for imgname, itemtype in [ - # editables - ("PROJECT", ITEM_PROJECT), - #("POU", ITEM_POU), - #("VARIABLE", ITEM_VARIABLE), - ("TRANSITION", ITEM_TRANSITION), - ("ACTION", ITEM_ACTION), - ("CONFIGURATION", ITEM_CONFIGURATION), - ("RESOURCE", ITEM_RESOURCE), - ("DATATYPE", ITEM_DATATYPE), - # uneditables - ("DATATYPES", ITEM_DATATYPES), - ("FUNCTION", ITEM_FUNCTION), - ("FUNCTIONBLOCK", ITEM_FUNCTIONBLOCK), - ("PROGRAM", ITEM_PROGRAM), - ("VAR_LOCAL", ITEM_VAR_LOCAL), - ("VAR_LOCAL", ITEM_VAR_GLOBAL), - ("VAR_LOCAL", ITEM_VAR_EXTERNAL), - ("VAR_LOCAL", ITEM_VAR_TEMP), - ("VAR_INPUT", ITEM_VAR_INPUT), - ("VAR_OUTPUT", ITEM_VAR_OUTPUT), - ("VAR_INOUT", ITEM_VAR_INOUT), - ("TRANSITIONS", ITEM_TRANSITIONS), - ("ACTIONS", ITEM_ACTIONS), - ("CONFIGURATIONS", ITEM_CONFIGURATIONS), - ("RESOURCES", ITEM_RESOURCES), - ("PROPERTIES", ITEM_PROPERTIES)]: + # editables + ("PROJECT", ITEM_PROJECT), + #("POU", ITEM_POU), + #("VARIABLE", ITEM_VARIABLE), + ("TRANSITION", ITEM_TRANSITION), + ("ACTION", ITEM_ACTION), + ("CONFIGURATION", ITEM_CONFIGURATION), + ("RESOURCE", ITEM_RESOURCE), + ("DATATYPE", ITEM_DATATYPE), + # uneditables + ("DATATYPES", ITEM_DATATYPES), + ("FUNCTION", ITEM_FUNCTION), + ("FUNCTIONBLOCK", ITEM_FUNCTIONBLOCK), + ("PROGRAM", ITEM_PROGRAM), + ("VAR_LOCAL", ITEM_VAR_LOCAL), + ("VAR_LOCAL", ITEM_VAR_GLOBAL), + ("VAR_LOCAL", ITEM_VAR_EXTERNAL), + ("VAR_LOCAL", ITEM_VAR_TEMP), + ("VAR_INPUT", ITEM_VAR_INPUT), + ("VAR_OUTPUT", ITEM_VAR_OUTPUT), + ("VAR_INOUT", ITEM_VAR_INOUT), + ("TRANSITIONS", ITEM_TRANSITIONS), + ("ACTIONS", ITEM_ACTIONS), + ("CONFIGURATIONS", ITEM_CONFIGURATIONS), + ("RESOURCES", ITEM_RESOURCES), + ("PROPERTIES", ITEM_PROPERTIES)]: self.TreeImageDict[itemtype] = self.TreeImageList.Add(GetBitmap(imgname)) # Assign icon list to TreeCtrls @@ -1749,8 +1749,8 @@ if item != self.LastToolTipItem and self.LastToolTipItem is not None: self.ProjectTree.SetToolTip(None) self.LastToolTipItem = None - if (self.LastToolTipItem != item and - item_infos["type"] in [ITEM_POU, ITEM_TRANSITION, ITEM_ACTION]): + if self.LastToolTipItem != item and \ + item_infos["type"] in [ITEM_POU, ITEM_TRANSITION, ITEM_ACTION]: bodytype = self.Controler.GetEditedElementBodyType( item_infos["tagname"]) if item_infos["type"] == ITEM_POU: diff -r ccf59c1f0b45 -r c1e5b9f19483 PLCControler.py --- a/PLCControler.py Thu Aug 17 16:26:32 2017 +0300 +++ b/PLCControler.py Thu Aug 17 17:25:17 2017 +0300 @@ -408,8 +408,8 @@ specific_values_tuple, specific_values_translation = \ _SpecificValuesTuples.get(args[0][0], _BlockSpecificValues) - if (args[0][0] == "step" and len(self.SpecificValues) < 3 or - args[0][0] == "transition" and len(self.SpecificValues) < 4): + if args[0][0] == "step" and len(self.SpecificValues) < 3 or \ + args[0][0] == "transition" and len(self.SpecificValues) < 4: self.SpecificValues.append([None]) elif args[0][0] == "actionBlock" and len(self.SpecificValues) < 1: self.SpecificValues.append([[]]) diff -r ccf59c1f0b45 -r c1e5b9f19483 PLCGenerator.py --- a/PLCGenerator.py Thu Aug 17 16:26:32 2017 +0300 +++ b/PLCGenerator.py Thu Aug 17 17:25:17 2017 +0300 @@ -717,8 +717,7 @@ InOutVariableClass)): expression = instance.getexpression() var_type = self.GetVariableType(expression) - if (isinstance(pou, TransitionObjClass) - and expression == pou.getname()): + if isinstance(pou, TransitionObjClass) and expression == pou.getname(): var_type = "BOOL" elif (not isinstance(pou, (TransitionObjClass, ActionObjClass)) and pou.getpouType() == "function" and expression == pou.getname()): @@ -1158,9 +1157,9 @@ else: for i, variable in enumerate(output_variables): blockPointx, blockPointy = variable.connectionPointOut.getrelPositionXY() - if (connectionPoint is None or - block.getx() + blockPointx == connectionPoint.getx() and - block.gety() + blockPointy == connectionPoint.gety()): + if connectionPoint is None or \ + block.getx() + blockPointx == connectionPoint.getx() and \ + block.gety() + blockPointy == connectionPoint.gety(): output_variable = variable output_parameter = variable.getformalParameter() output_idx = i diff -r ccf59c1f0b45 -r c1e5b9f19483 ProjectController.py --- a/ProjectController.py Thu Aug 17 16:26:32 2017 +0300 +++ b/ProjectController.py Thu Aug 17 17:25:17 2017 +0300 @@ -1582,8 +1582,7 @@ self.IECdebug_lock.acquire() for debug_tick, debug_buff in Traces: debug_vars = UnpackDebugBuffer(debug_buff, self.TracedIECTypes) - if (debug_vars is not None and - len(debug_vars) == len(self.TracedIECPath)): + if debug_vars is not None and len(debug_vars) == len(self.TracedIECPath): for IECPath, values_buffer, value in izip( self.TracedIECPath, self.DebugValuesBuffers, diff -r ccf59c1f0b45 -r c1e5b9f19483 controls/CustomTree.py --- a/controls/CustomTree.py Thu Aug 17 16:26:32 2017 +0300 +++ b/controls/CustomTree.py Thu Aug 17 17:25:17 2017 +0300 @@ -117,8 +117,8 @@ item, flags = self.HitTest(pos) bitmap_rect = self.GetBitmapRect() - if (bitmap_rect.InsideXY(pos.x, pos.y) or - flags & wx.TREE_HITTEST_NOWHERE) and self.AddMenu is not None: + if ((bitmap_rect.InsideXY(pos.x, pos.y) or + flags & wx.TREE_HITTEST_NOWHERE) and self.AddMenu is not None): wx.CallAfter(self.PopupMenuXY, self.AddMenu, pos.x, pos.y) event.Skip() diff -r ccf59c1f0b45 -r c1e5b9f19483 controls/DebugVariablePanel/DebugVariableGraphicViewer.py --- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Aug 17 16:26:32 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Aug 17 17:25:17 2017 +0300 @@ -1171,8 +1171,8 @@ # Display cursor in canvas if a cursor tick is defined and it is # include in values tick range - if (self.CursorTick is not None and - start_tick <= self.CursorTick <= end_tick): + if self.CursorTick is not None and \ + start_tick <= self.CursorTick <= end_tick: # Define a vertical line to display cursor position if no # line is already defined @@ -1241,8 +1241,8 @@ # Display cursor in canvas if a cursor tick is defined and it is # include in values tick range - if (self.CursorTick is not None and - start_tick <= self.CursorTick <= end_tick): + if self.CursorTick is not None and \ + start_tick <= self.CursorTick <= end_tick: # Define a vertical line to display cursor x coordinate # if no line is already defined @@ -1287,8 +1287,9 @@ z_min, z_max = merge_ranges([(z_min, z_max)]) # Check that x, y and z data are not empty - if (x_data is not None and y_data is not None and - z_data is not None): + if x_data is not None and \ + y_data is not None and \ + z_data is not None: # Get common data length so that each value has an x, y # and z coordinate @@ -1301,8 +1302,8 @@ # Display cursor in canvas if a cursor tick is defined and # it is include in values tick range - if (self.CursorTick is not None and - start_tick <= self.CursorTick <= end_tick): + if self.CursorTick is not None and \ + start_tick <= self.CursorTick <= end_tick: # Get Z coordinate for cursor z_cursor, z_forced = items[2].GetValue( diff -r ccf59c1f0b45 -r c1e5b9f19483 controls/DebugVariablePanel/DebugVariableItem.py --- a/controls/DebugVariablePanel/DebugVariableItem.py Thu Aug 17 16:26:32 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableItem.py Thu Aug 17 17:25:17 2017 +0300 @@ -160,8 +160,7 @@ @param index: Variable value index @return: Variable data type """ - if (self.VariableType in ["STRING", "WSTRING"] and - index < len(self.RawData)): + if self.VariableType in ["STRING", "WSTRING"] and index < len(self.RawData): return self.RawData[index][0] return "" @@ -309,10 +308,8 @@ @param value: New value """ # Remove quote and double quote surrounding string value to get raw value - if (self.VariableType == "STRING" and - value.startswith("'") and value.endswith("'") or - self.VariableType == "WSTRING" and - value.startswith('"') and value.endswith('"')): + if self.VariableType == "STRING" and value.startswith("'") and value.endswith("'") or \ + self.VariableType == "WSTRING" and value.startswith('"') and value.endswith('"'): value = value[1:-1] # Store variable value @@ -376,8 +373,8 @@ idx = numpy.argmin(abs(ticks - tick)) # Adjust data index according to constraint - if (adjust < 0 and ticks[idx] > tick and idx > 0 or - adjust > 0 and ticks[idx] < tick and idx < len(ticks)): + if adjust < 0 and ticks[idx] > tick and idx > 0 or \ + adjust > 0 and ticks[idx] < tick and idx < len(ticks): idx += adjust return idx diff -r ccf59c1f0b45 -r c1e5b9f19483 controls/DebugVariablePanel/DebugVariablePanel.py --- a/controls/DebugVariablePanel/DebugVariablePanel.py Thu Aug 17 16:26:32 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariablePanel.py Thu Aug 17 17:25:17 2017 +0300 @@ -241,8 +241,8 @@ self.CanvasRange.SetSelection(default_range_idx) for name, bitmap, help in [ - ("CurrentButton", "current", _("Go to current value")), - ("ExportGraphButton", "export_graph", _("Export graph values to clipboard"))]: + ("CurrentButton", "current", _("Go to current value")), + ("ExportGraphButton", "export_graph", _("Export graph values to clipboard"))]: button = wx.lib.buttons.GenBitmapButton(self, bitmap=GetBitmap(bitmap), size=wx.Size(28, 28), style=wx.NO_BORDER) @@ -440,9 +440,9 @@ x, y = panel.GetPosition() width, height = panel.GetSize() rect = wx.Rect(x, y, width, height) - if (rect.InsideXY(x_mouse, y_mouse) or - idx == 0 and y_mouse < 0 or - idx == len(self.GraphicPanels) - 1 and y_mouse > panel.GetPosition()[1]): + if rect.InsideXY(x_mouse, y_mouse) or \ + idx == 0 and y_mouse < 0 or \ + idx == len(self.GraphicPanels) - 1 and y_mouse > panel.GetPosition()[1]: panel.RefreshHighlight(x_mouse - x, y_mouse - y) else: panel.SetHighlight(HIGHLIGHT_NONE) @@ -947,9 +947,9 @@ size = self.GetSize() for panel in self.GraphicPanels: panel_size = panel.GetSize() - if (isinstance(panel, DebugVariableGraphicViewer) and - panel.GraphType == GRAPH_ORTHOGONAL and - panel_size.width == panel_size.height): + if isinstance(panel, DebugVariableGraphicViewer) and \ + panel.GraphType == GRAPH_ORTHOGONAL and \ + panel_size.width == panel_size.height: panel.SetCanvasHeight(size.width) self.RefreshGraphicsWindowScrollbars() self.GraphicsSizer.Layout() diff -r ccf59c1f0b45 -r c1e5b9f19483 controls/FolderTree.py --- a/controls/FolderTree.py Thu Aug 17 16:26:32 2017 +0300 +++ b/controls/FolderTree.py Thu Aug 17 17:25:17 2017 +0300 @@ -236,8 +236,8 @@ item, item_cookie = self.Tree.GetFirstChild(root) while item.IsOk(): if self.Tree.GetItemText(item) == parts[0]: - if (self.Tree.ItemHasChildren(item) and - not self.Tree.IsExpanded(item)): + if self.Tree.ItemHasChildren(item) and \ + not self.Tree.IsExpanded(item): self.Tree.Expand(item) wx.CallAfter(self._SelectItem, item, parts[1:]) else: diff -r ccf59c1f0b45 -r c1e5b9f19483 controls/SearchResultPanel.py --- a/controls/SearchResultPanel.py Thu Aug 17 16:26:32 2017 +0300 +++ b/controls/SearchResultPanel.py Thu Aug 17 17:25:17 2017 +0300 @@ -121,16 +121,16 @@ # Icons for other items for imgname, itemtype in [ - # editables - ("PROJECT", ITEM_PROJECT), - ("TRANSITION", ITEM_TRANSITION), - ("ACTION", ITEM_ACTION), - ("CONFIGURATION", ITEM_CONFIGURATION), - ("RESOURCE", ITEM_RESOURCE), - ("DATATYPE", ITEM_DATATYPE), - ("ACTION", "action_block"), - ("IL", "IL"), - ("ST", "ST")]: + # editables + ("PROJECT", ITEM_PROJECT), + ("TRANSITION", ITEM_TRANSITION), + ("ACTION", ITEM_ACTION), + ("CONFIGURATION", ITEM_CONFIGURATION), + ("RESOURCE", ITEM_RESOURCE), + ("DATATYPE", ITEM_DATATYPE), + ("ACTION", "action_block"), + ("IL", "IL"), + ("ST", "ST")]: self.TreeImageDict[itemtype] = self.TreeImageList.Add(GetBitmap(imgname)) for itemtype in ["function", "functionBlock", "program", diff -r ccf59c1f0b45 -r c1e5b9f19483 controls/VariablePanel.py --- a/controls/VariablePanel.py Thu Aug 17 16:26:32 2017 +0300 +++ b/controls/VariablePanel.py Thu Aug 17 17:25:17 2017 +0300 @@ -684,8 +684,8 @@ return self.TagName def IsFunctionBlockType(self, name): - if (isinstance(name, TupleType) or - self.ElementType != "function" and self.BodyType in ["ST", "IL"]): + if isinstance(name, TupleType) or \ + self.ElementType != "function" and self.BodyType in ["ST", "IL"]: return False else: return self.Controler.GetBlockType(name, debug=self.Debug) is not None diff -r ccf59c1f0b45 -r c1e5b9f19483 dialogs/BrowseLocationsDialog.py --- a/dialogs/BrowseLocationsDialog.py Thu Aug 17 16:26:32 2017 +0300 +++ b/dialogs/BrowseLocationsDialog.py Thu Aug 17 17:25:17 2017 +0300 @@ -131,12 +131,12 @@ # Icons for items for imgname, itemtype in [ - ("CONFIGURATION", LOCATION_CONFNODE), - ("RESOURCE", LOCATION_MODULE), - ("PROGRAM", LOCATION_GROUP), - ("VAR_INPUT", LOCATION_VAR_INPUT), - ("VAR_OUTPUT", LOCATION_VAR_OUTPUT), - ("VAR_LOCAL", LOCATION_VAR_MEMORY)]: + ("CONFIGURATION", LOCATION_CONFNODE), + ("RESOURCE", LOCATION_MODULE), + ("PROGRAM", LOCATION_GROUP), + ("VAR_INPUT", LOCATION_VAR_INPUT), + ("VAR_OUTPUT", LOCATION_VAR_OUTPUT), + ("VAR_LOCAL", LOCATION_VAR_MEMORY)]: self.TreeImageDict[itemtype] = self.TreeImageList.Add(GetBitmap(imgname)) # Assign icon list to TreeCtrls diff -r ccf59c1f0b45 -r c1e5b9f19483 dialogs/FBDVariableDialog.py --- a/dialogs/FBDVariableDialog.py Thu Aug 17 16:26:32 2017 +0300 +++ b/dialogs/FBDVariableDialog.py Thu Aug 17 17:25:17 2017 +0300 @@ -152,8 +152,7 @@ # Get variable expression and select corresponding value in name list # box if it exists selected = self.Expression.GetValue() - if (selected != "" and - self.VariableName.FindString(selected) != wx.NOT_FOUND): + if selected != "" and self.VariableName.FindString(selected) != wx.NOT_FOUND: self.VariableName.SetStringSelection(selected) else: self.VariableName.SetSelection(wx.NOT_FOUND) diff -r ccf59c1f0b45 -r c1e5b9f19483 editors/CodeFileEditor.py --- a/editors/CodeFileEditor.py Thu Aug 17 16:26:32 2017 +0300 +++ b/editors/CodeFileEditor.py Thu Aug 17 17:25:17 2017 +0300 @@ -575,8 +575,8 @@ def RemoveHighlight(self, start, end, highlight_type): highlight_type = HIGHLIGHT_TYPES.get(highlight_type, None) - if (highlight_type is not None and - (start, end, highlight_type) in self.Highlights): + if highlight_type is not None and \ + (start, end, highlight_type) in self.Highlights: self.Highlights.remove((start, end, highlight_type)) self.RefreshHighlightsTimer.Start(int(REFRESH_HIGHLIGHT_PERIOD * 1000), oneShot=True) diff -r ccf59c1f0b45 -r c1e5b9f19483 editors/FileManagementPanel.py --- a/editors/FileManagementPanel.py Thu Aug 17 16:26:32 2017 +0300 +++ b/editors/FileManagementPanel.py Thu Aug 17 17:25:17 2017 +0300 @@ -162,8 +162,8 @@ def OnEditButton(self, event): filepath = self.ManagedDir.GetPath() - if (os.path.isfile(filepath) and - os.path.splitext(filepath)[1] in self.EditableFileExtensions): + if os.path.isfile(filepath) and \ + os.path.splitext(filepath)[1] in self.EditableFileExtensions: self.Controler._OpenView(filepath + "::") event.Skip() diff -r ccf59c1f0b45 -r c1e5b9f19483 editors/TextViewer.py --- a/editors/TextViewer.py Thu Aug 17 16:26:32 2017 +0300 +++ b/editors/TextViewer.py Thu Aug 17 17:25:17 2017 +0300 @@ -943,8 +943,8 @@ EditorPanel.RemoveHighlight(self, infos, start, end, highlight_type) highlight_type = HIGHLIGHT_TYPES.get(highlight_type, None) - if (infos[0] == "body" and highlight_type is not None and - (infos[1], start, end, highlight_type) in self.Highlights): + if infos[0] == "body" and highlight_type is not None and \ + (infos[1], start, end, highlight_type) in self.Highlights: self.Highlights.remove((infos[1], start, end, highlight_type)) self.RefreshHighlightsTimer.Start(int(REFRESH_HIGHLIGHT_PERIOD * 1000), oneShot=True) diff -r ccf59c1f0b45 -r c1e5b9f19483 editors/Viewer.py --- a/editors/Viewer.py Thu Aug 17 16:26:32 2017 +0300 +++ b/editors/Viewer.py Thu Aug 17 17:25:17 2017 +0300 @@ -1238,8 +1238,7 @@ while len(instances) > 0: self.loadInstance(instances.popitem(0)[1], instances, selection) - if (selection is not None and - isinstance(self.SelectedElement, Graphic_Group)): + if selection is not None and isinstance(self.SelectedElement, Graphic_Group): self.SelectedElement.RefreshWireExclusion() self.SelectedElement.RefreshBoundingBox() @@ -1797,9 +1796,7 @@ def OnReplaceWireMenu(self, event): # Check that selected element is a wire before applying replace - if (self.SelectedElement is not None and - self.IsWire(self.SelectedElement)): - + if self.SelectedElement is not None and self.IsWire(self.SelectedElement): # Get wire redraw bbox to erase it from screen wire = self.SelectedElement redraw_rect = wire.GetRedrawRect() @@ -2317,8 +2314,7 @@ self.RefreshScrollBars() self.RefreshVisibleElements() else: - if (not event.Dragging() and - gettime() - self.LastHighlightCheckTime > REFRESH_PERIOD): + if not event.Dragging() and (gettime() - self.LastHighlightCheckTime) > REFRESH_PERIOD: self.LastHighlightCheckTime = gettime() highlighted = self.FindElement(event, connectors=False) if self.HighlightedElement is not None and self.HighlightedElement != highlighted: diff -r ccf59c1f0b45 -r c1e5b9f19483 plcopen/plcopen.py --- a/plcopen/plcopen.py Thu Aug 17 16:26:32 2017 +0300 +++ b/plcopen/plcopen.py Thu Aug 17 17:25:17 2017 +0300 @@ -216,8 +216,8 @@ "http://www.plcopen.org/xml/tc6.xsd", "http://www.plcopen.org/xml/tc6_0201") for cre, repl in [ - (re.compile("(?)(?:)(?!)"), "]]>")]: + (re.compile("(?)(?:)(?!)"), "]]>")]: project_xml = cre.sub(repl, project_xml) try: @@ -1319,8 +1319,9 @@ def hasblock(self, name=None, block_type=None): if self.getbodyType() in ["FBD", "LD", "SFC"]: for instance in self.getinstances(): - if (isinstance(instance, PLCOpenParser.GetElementClass("block", "fbdObjects")) and - (TextMatched(instance.getinstanceName(), name) or TextMatched(instance.gettypeName(), block_type))): + if isinstance(instance, PLCOpenParser.GetElementClass("block", "fbdObjects")) \ + and (TextMatched(instance.getinstanceName(), name) or + TextMatched(instance.gettypeName(), block_type)): return True if self.transitions: for transition in self.transitions.gettransition(): @@ -1565,8 +1566,8 @@ def hasblock(self, name=None, block_type=None): if self.getbodyType() in ["FBD", "LD", "SFC"]: for instance in self.getinstances(): - if (isinstance(instance, PLCOpenParser.GetElementClass("block", "fbdObjects")) and - (TextMatched(instance.getinstanceName(), name) or TextMatched(instance.gettypeName(), block_type))): + if isinstance(instance, PLCOpenParser.GetElementClass("block", "fbdObjects")) and \ + (TextMatched(instance.getinstanceName(), name) or TextMatched(instance.gettypeName(), block_type)): return True elif block_type is not None: return self.body.hasblock(block_type) @@ -1692,8 +1693,9 @@ instance.setexecutionOrderId(self.getnewExecutionOrderId()) elif isinstance(instance, PLCOpenParser.GetElementClass("continuation", "commonObjects")) and instance.getexecutionOrderId() == 0: for tmp_instance in self.getcontentInstances(): - if (isinstance(tmp_instance, PLCOpenParser.GetElementClass("connector", "commonObjects")) and - TextMatched(tmp_instance.getname(), instance.getname()) and tmp_instance.getexecutionOrderId() == 0): + if isinstance(tmp_instance, PLCOpenParser.GetElementClass("connector", "commonObjects")) and \ + TextMatched(tmp_instance.getname(), instance.getname()) and \ + tmp_instance.getexecutionOrderId() == 0: connections = tmp_instance.connectionPointIn.getconnections() if connections and len(connections) == 1: self.compileelementExecutionOrder(connections[0]) diff -r ccf59c1f0b45 -r c1e5b9f19483 py_ext/PythonFileCTNMixin.py --- a/py_ext/PythonFileCTNMixin.py Thu Aug 17 16:26:32 2017 +0300 +++ b/py_ext/PythonFileCTNMixin.py Thu Aug 17 17:25:17 2017 +0300 @@ -61,8 +61,8 @@ 'xmlns="http://www.w3.org/2001/XMLSchema"', 'xmlns:xhtml="http://www.w3.org/1999/xhtml"') for cre, repl in [ - (re.compile("(?)(?:)(?!)"), "]]>")]: + (re.compile("(?)(?:)(?!)"), "]]>")]: pythonfile_xml = cre.sub(repl, pythonfile_xml) try: