# HG changeset patch # User Andrey Skvortsov # Date 1508400183 -10800 # Node ID fb73a6b6622d66c467ec1f67e9aad21d2a0e1eec # Parent da5f1fa46f2bce4a189968ec344c30cdd56f0377 fix pylint warning '(bad-continuation) Wrong hanging indentation before block' diff -r da5f1fa46f2b -r fb73a6b6622d BeremizIDE.py --- a/BeremizIDE.py Thu Oct 19 10:57:35 2017 +0300 +++ b/BeremizIDE.py Thu Oct 19 11:03:03 2017 +0300 @@ -348,8 +348,8 @@ self.SetAcceleratorTable(wx.AcceleratorTable(accels)) self.LogConsole = CustomStyledTextCtrl( - name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0), - size=wx.Size(0, 0)) + name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0), + size=wx.Size(0, 0)) self.LogConsole.Bind(wx.EVT_SET_FOCUS, self.OnLogConsoleFocusChanged) self.LogConsole.Bind(wx.EVT_KILL_FOCUS, self.OnLogConsoleFocusChanged) self.LogConsole.Bind(wx.stc.EVT_STC_UPDATEUI, self.OnLogConsoleUpdateUI) @@ -584,12 +584,12 @@ return True def GetTabInfos(self, tab): - if (isinstance(tab, EditorPanel) and - not isinstance(tab, (Viewer, - TextViewer, - ResourceEditor, - ConfigurationEditor, - DataTypeEditor))): + if isinstance(tab, EditorPanel) and \ + not isinstance(tab, (Viewer, + TextViewer, + ResourceEditor, + ConfigurationEditor, + DataTypeEditor)): return ("confnode", tab.Controler.CTNFullName(), tab.GetTagName()) elif (isinstance(tab, TextViewer) and (tab.Controler is None or isinstance(tab.Controler, MiniTextControler))): diff -r da5f1fa46f2b -r fb73a6b6622d IDEFrame.py --- a/IDEFrame.py Thu Oct 19 10:57:35 2017 +0300 +++ b/IDEFrame.py Thu Oct 19 11:03:03 2017 +0300 @@ -1268,19 +1268,19 @@ def SetDeleteFunctions(self): self.DeleteFunctions = { ITEM_DATATYPE: GetDeleteElementFunction( - PLCControler.ProjectRemoveDataType, - check_function=self.CheckDataTypeIsUsedBeforeDeletion), + PLCControler.ProjectRemoveDataType, + check_function=self.CheckDataTypeIsUsedBeforeDeletion), ITEM_POU: GetDeleteElementFunction( - PLCControler.ProjectRemovePou, - check_function=self.CheckPouIsUsedBeforeDeletion), + PLCControler.ProjectRemovePou, + check_function=self.CheckPouIsUsedBeforeDeletion), ITEM_TRANSITION: GetDeleteElementFunction( - PLCControler.ProjectRemovePouTransition, ITEM_POU), + PLCControler.ProjectRemovePouTransition, ITEM_POU), ITEM_ACTION: GetDeleteElementFunction( - PLCControler.ProjectRemovePouAction, ITEM_POU), + PLCControler.ProjectRemovePouAction, ITEM_POU), ITEM_CONFIGURATION: GetDeleteElementFunction( - PLCControler.ProjectRemoveConfiguration), + PLCControler.ProjectRemoveConfiguration), ITEM_RESOURCE: GetDeleteElementFunction( - PLCControler.ProjectRemoveConfigurationResource, ITEM_CONFIGURATION) + PLCControler.ProjectRemoveConfigurationResource, ITEM_CONFIGURATION) } def OnDeleteMenu(self, event): @@ -1777,7 +1777,7 @@ if self.LastToolTipItem != item and \ item_infos["type"] in [ITEM_POU, ITEM_TRANSITION, ITEM_ACTION]: bodytype = self.Controler.GetEditedElementBodyType( - item_infos["tagname"]) + item_infos["tagname"]) if item_infos["type"] == ITEM_POU: block_type = { "program": _("Program"), diff -r da5f1fa46f2b -r fb73a6b6622d PLCControler.py --- a/PLCControler.py Thu Oct 19 10:57:35 2017 +0300 +++ b/PLCControler.py Thu Oct 19 11:03:03 2017 +0300 @@ -202,8 +202,8 @@ self.TreeStack[-1].append(var) def AddVariable(self, context, *args): - self.Variables.append(_VariableInfos(*(_translate_args( - [_StringValue] * 5 + [_BoolValue] + [_StringValue], args) + + self.Variables.append(_VariableInfos(*( + _translate_args([_StringValue] * 5 + [_BoolValue] + [_StringValue], args) + [self.GetType(), self.GetTree()]))) # ------------------------------------------------------------------------------- @@ -1590,9 +1590,9 @@ def GetConfNodeDataTypes(self, exclude=None, only_locatables=False): return [{"name": _("%s Data Types") % confnodetypes["name"], "list": [ - datatype.getname() - for datatype in confnodetypes["types"].getdataTypes() - if not only_locatables or self.IsLocatableDataType(datatype)]} + datatype.getname() + for datatype in confnodetypes["types"].getdataTypes() + if not only_locatables or self.IsLocatableDataType(datatype)]} for confnodetypes in self.ConfNodeTypes] def GetVariableLocationTree(self): @@ -2989,7 +2989,7 @@ SELECTION_CONVERGENCE: "selectionConvergence", SIMULTANEOUS_DIVERGENCE: "simultaneousDivergence", SIMULTANEOUS_CONVERGENCE: "simultaneousConvergence"}.get( - divergence_type), "sfcObjects") + divergence_type), "sfcObjects") divergence.setlocalId(id) element.addinstance(divergence) diff -r da5f1fa46f2b -r fb73a6b6622d PLCGenerator.py --- a/PLCGenerator.py Thu Oct 19 10:57:35 2017 +0300 +++ b/PLCGenerator.py Thu Oct 19 11:03:03 2017 +0300 @@ -497,11 +497,14 @@ [StepClass, TransitionClass, JumpStepClass, SelectionConvergenceClass, SelectionDivergenceClass, SimultaneousConvergenceClass, SimultaneousDivergenceClass] = [ - PLCOpenParser.GetElementClass(instance_name, "sfcObjects") - for instance_name in [ - "step", "transition", "jumpStep", - "selectionConvergence", "selectionDivergence", - "simultaneousConvergence", "simultaneousDivergence"]] + PLCOpenParser.GetElementClass(instance_name, "sfcObjects") + for instance_name in ["step", + "transition", + "jumpStep", + "selectionConvergence", + "selectionDivergence", + "simultaneousConvergence", + "simultaneousDivergence"]] TransitionObjClass = PLCOpenParser.GetElementClass("transition", "transitions") ActionObjClass = PLCOpenParser.GetElementClass("action", "actions") @@ -905,7 +908,7 @@ text = body_content.getanyText() self.ParentGenerator.GeneratePouProgramInText(text.upper()) self.Program = [(ReIndentText(text, len(self.CurrentIndent)), - (self.TagName, "body", len(self.CurrentIndent)))] + (self.TagName, "body", len(self.CurrentIndent)))] elif body_type == "SFC": self.IndentRight() for instance in body.getcontentInstances(): diff -r da5f1fa46f2b -r fb73a6b6622d ProjectController.py --- a/ProjectController.py Thu Oct 19 10:57:35 2017 +0300 +++ b/ProjectController.py Thu Oct 19 11:03:03 2017 +0300 @@ -756,11 +756,11 @@ self.logger.write(_("Compiling IEC Program into C code...\n")) buildpath = self._getBuildPath() buildcmd = "\"%s\" %s -I \"%s\" -T \"%s\" \"%s\"" % ( - self.iec2c_cfg.getCmd(), - self.iec2c_cfg.getOptions(), - iec2c_libpath, - buildpath, - self._getIECcodepath()) + self.iec2c_cfg.getCmd(), + self.iec2c_cfg.getOptions(), + iec2c_libpath, + buildpath, + self._getIECcodepath()) try: # Invoke compiler. Output files are listed to stdout, errors to stderr @@ -874,7 +874,7 @@ """ return ([(C_file_name, self.plcCFLAGS) - for C_file_name in self.PLCGeneratedCFiles], + for C_file_name in self.PLCGeneratedCFiles], "", # no ldflags False) # do not expose retreive/publish calls @@ -1027,22 +1027,22 @@ if not self.BeremizRoot.getDisable_Extensions(): plc_main_code = targets.GetCode("plc_main_head.c") % { "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]), + "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([ - "__retrieve_%s();" % locstr for locstr in locstrs]), + "__retrieve_%s();" % locstr for locstr in locstrs]), "publish_calls": "\n ".join([ # Call publish in reverse order - "__publish_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]), + "__publish_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]), "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)]), + "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([ - "if(init_level >= %d) " % i + - "__cleanup_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]) + "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") % { @@ -1161,11 +1161,14 @@ # Template based part of C code generation # files are stacked at the beginning, as files of confnode tree root - for generator, filename, name in [ - # 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")]: + c_source = [ + # 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") + ] + + for generator, filename, name in c_source: try: # Do generate code = generator() @@ -1494,11 +1497,11 @@ IECdebug_data = self.IECdebug_datas.get(IECPath, None) if IECdebug_data is None: IECdebug_data = [ - WeakKeyDictionary(), # Callables - [], # Data storage [(tick, data),...] - "Registered", # Variable status - None, - buffer_list] # Forced value + WeakKeyDictionary(), # Callables + [], # Data storage [(tick, data),...] + "Registered", # Variable status + None, + buffer_list] # Forced value self.IECdebug_datas[IECPath] = IECdebug_data else: IECdebug_data[4] |= buffer_list @@ -1821,9 +1824,9 @@ self._getProjectFilesPath()]: extrafiles.extend( - [(name, open(os.path.join(extrafilespath, name), - 'rb').read()) - for name in os.listdir(extrafilespath)]) + [(name, open(os.path.join(extrafilespath, name), + 'rb').read()) + for name in os.listdir(extrafilespath)]) # Send PLC on target builder = self.GetBuilder() diff -r da5f1fa46f2b -r fb73a6b6622d canfestival/canfestival.py --- a/canfestival/canfestival.py Thu Oct 19 10:57:35 2017 +0300 +++ b/canfestival/canfestival.py Thu Oct 19 11:03:03 2017 +0300 @@ -519,23 +519,24 @@ else: can_driver_name = "" - format_dict = {"locstr": "_".join(map(str, self.GetCurrentLocation())), - "candriver": can_driver_name, - "nodes_includes": "", - "board_decls": "", - "nodes_init": "", - "nodes_open": "", - "nodes_stop": "", - "nodes_close": "", - "nodes_send_sync": "", - "nodes_proceed_sync": "", - "slavebootups": "", - "slavebootup_register": "", - "post_sync": "", - "post_sync_register": "", - "pre_op": "", - "pre_op_register": "", - } + format_dict = { + "locstr": "_".join(map(str, self.GetCurrentLocation())), + "candriver": can_driver_name, + "nodes_includes": "", + "board_decls": "", + "nodes_init": "", + "nodes_open": "", + "nodes_stop": "", + "nodes_close": "", + "nodes_send_sync": "", + "nodes_proceed_sync": "", + "slavebootups": "", + "slavebootup_register": "", + "post_sync": "", + "post_sync_register": "", + "pre_op": "", + "pre_op_register": "", + } for child in self.IECSortedChildren(): childlocstr = "_".join(map(str, child.GetCurrentLocation())) nodename = "OD_%s" % childlocstr @@ -547,8 +548,8 @@ child_data = getattr(child, "CanFestivalNode") # Apply sync setting format_dict["nodes_init"] += 'NODE_MASTER_INIT(%s, %s)\n ' % ( - nodename, - child_data.getNodeId()) + nodename, + child_data.getNodeId()) if child_data.getSync_TPDOs(): format_dict["nodes_send_sync"] += 'NODE_SEND_SYNC(%s)\n ' % (nodename) format_dict["nodes_proceed_sync"] += 'NODE_PROCEED_SYNC(%s)\n ' % (nodename) @@ -591,16 +592,16 @@ format_dict["post_sync_register"] += ( "%s_Data.post_sync = %s_post_sync;\n" % (nodename, nodename)) format_dict["nodes_init"] += 'NODE_SLAVE_INIT(%s, %s)\n ' % ( - nodename, - child_data.getNodeId()) + nodename, + child_data.getNodeId()) # Include generated OD headers format_dict["nodes_includes"] += '#include "%s.h"\n' % (nodename) # Declare CAN channels according user filled config format_dict["board_decls"] += 'BOARD_DECL(%s, "%s", "%s")\n' % ( - nodename, - child.GetCanDevice(), - child_data.getCAN_Baudrate()) + nodename, + child.GetCanDevice(), + child_data.getCAN_Baudrate()) format_dict["nodes_open"] += 'NODE_OPEN(%s)\n ' % (nodename) format_dict["nodes_close"] += 'NODE_CLOSE(%s)\n ' % (nodename) format_dict["nodes_stop"] += 'NODE_STOP(%s)\n ' % (nodename) diff -r da5f1fa46f2b -r fb73a6b6622d controls/CustomStyledTextCtrl.py --- a/controls/CustomStyledTextCtrl.py Thu Oct 19 10:57:35 2017 +0300 +++ b/controls/CustomStyledTextCtrl.py Thu Oct 19 11:03:03 2017 +0300 @@ -97,10 +97,9 @@ if not event.Dragging(): x, _y = event.GetPosition() margin_width = reduce( - lambda x, y: x + y, - [self.GetMarginWidth(i) - for i in xrange(3)], - 0) + lambda x, y: x + y, + [self.GetMarginWidth(i) for i in xrange(3)], + 0) if x <= margin_width: self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW)) else: diff -r da5f1fa46f2b -r fb73a6b6622d controls/CustomTable.py --- a/controls/CustomTable.py Thu Oct 19 10:57:35 2017 +0300 +++ b/controls/CustomTable.py Thu Oct 19 11:03:03 2017 +0300 @@ -88,8 +88,18 @@ grid.CloseEditControl() grid.BeginBatch() for current, new, delmsg, addmsg in [ - (self._rows, self.GetNumberRows(), wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED, wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED), - (self._cols, self.GetNumberCols(), wx.grid.GRIDTABLE_NOTIFY_COLS_DELETED, wx.grid.GRIDTABLE_NOTIFY_COLS_APPENDED), + ( + self._rows, + self.GetNumberRows(), + wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED, + wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED + ), + ( + 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) diff -r da5f1fa46f2b -r fb73a6b6622d controls/DebugVariablePanel/DebugVariableGraphicViewer.py --- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Oct 19 10:57:35 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Oct 19 11:03:03 2017 +0300 @@ -306,15 +306,14 @@ # Add buttons for zooming on current displayed data range self.Buttons.append( - GraphButton(0, 0, "fit_graph", self.OnZoomFitButton)) + GraphButton(0, 0, "fit_graph", self.OnZoomFitButton)) # Add buttons for changing canvas size with predefined height for size, bitmap in zip( [SIZE_MINI, SIZE_MIDDLE, SIZE_MAXI], ["minimize_graph", "middle_graph", "maximize_graph"]): - self.Buttons.append( - GraphButton(0, 0, bitmap, - self.GetOnChangeSizeButton(size))) + self.Buttons.append(GraphButton(0, 0, bitmap, + self.GetOnChangeSizeButton(size))) # Add buttons for exporting graph values to clipboard and close graph for bitmap, callback in [ @@ -430,8 +429,7 @@ ("force", self.OnForceItemButton), ("export_graph_mini", self.OnExportItemGraphButton), ("delete_graph", self.OnRemoveItemButton)]: - self.ContextualButtons.append( - GraphButton(0, 0, bitmap, callback)) + self.ContextualButtons.append(GraphButton(0, 0, bitmap, callback)) # If buttons are shown at left side or upper side of rect, positions # will be set in reverse order @@ -598,7 +596,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: @@ -1117,15 +1115,15 @@ else: # X coordinate labels are in figure lower side self.AxesLabels[0].set_position( - (0.1, CANVAS_PADDING * graph_ratio)) + (0.1, CANVAS_PADDING * graph_ratio)) self.Labels[0].set_position( - (0.95, CANVAS_PADDING * graph_ratio)) + (0.95, CANVAS_PADDING * graph_ratio)) # Y coordinate labels are vertical and in figure left side self.AxesLabels[1].set_position( - (0.05, 2 * CANVAS_PADDING * graph_ratio)) + (0.05, 2 * CANVAS_PADDING * graph_ratio)) self.Labels[1].set_position( - (0.05, 1.0 - CANVAS_PADDING * graph_ratio)) + (0.05, 1.0 - CANVAS_PADDING * graph_ratio)) # Update subplots self.Figure.subplots_adjust() @@ -1149,7 +1147,7 @@ # Get data and range for each variable displayed for idx, item in enumerate(self.Items): data, min_value, max_value = item.GetDataAndValueRange( - start_tick, end_tick, not self.ZoomFit) + start_tick, end_tick, not self.ZoomFit) # Check that data is not empty if data is not None: @@ -1199,10 +1197,11 @@ # Get data and range for first variable (X coordinate) x_data, x_min, x_max = items[0].GetDataAndValueRange( - start_tick, end_tick, not self.ZoomFit) + start_tick, end_tick, not self.ZoomFit) + # Get data and range for second variable (Y coordinate) y_data, y_min, y_max = items[1].GetDataAndValueRange( - start_tick, end_tick, not self.ZoomFit) + start_tick, end_tick, not self.ZoomFit) # Normalize X and Y coordinates value range x_min, x_max = merge_ranges([(x_min, x_max)]) @@ -1211,9 +1210,9 @@ # Get X and Y coordinates for cursor if cursor tick is defined if self.CursorTick is not None: x_cursor, _x_forced = items[0].GetValue( - self.CursorTick, raw=True) + self.CursorTick, raw=True) y_cursor, _y_forced = items[1].GetValue( - self.CursorTick, raw=True) + self.CursorTick, raw=True) # Get common data length so that each value has an x and y # coordinate @@ -1281,7 +1280,7 @@ # Get data and range for third variable (Z coordinate) z_data, z_min, z_max = items[2].GetDataAndValueRange( - start_tick, end_tick, not self.ZoomFit) + start_tick, end_tick, not self.ZoomFit) # Normalize Z coordinate value range z_min, z_max = merge_ranges([(z_min, z_max)]) @@ -1307,7 +1306,7 @@ # Get Z coordinate for cursor z_cursor, _z_forced = items[2].GetValue( - self.CursorTick, raw=True) + self.CursorTick, raw=True) # Add 3 lines parallel to x, y and z axis to display # cursor position in 3D @@ -1332,11 +1331,11 @@ # Get value and forced flag for each variable displayed in graph # If cursor tick is not defined get value and flag of last received # or get value and flag of variable at cursor tick - values, forced = apply(zip, [ - (item.GetValue(self.CursorTick) - if self.CursorTick is not None - else (item.GetValue(), item.IsForced())) - for item in self.Items]) + values, forced = apply(zip, [( + item.GetValue(self.CursorTick) + if self.CursorTick is not None + else (item.GetValue(), item.IsForced()) + ) for item in self.Items]) # Get path of each variable displayed simplified using panel variable # name mask diff -r da5f1fa46f2b -r fb73a6b6622d controls/DebugVariablePanel/DebugVariableItem.py --- a/controls/DebugVariablePanel/DebugVariableItem.py Thu Oct 19 10:57:35 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableItem.py Thu Oct 19 11:03:03 2017 +0300 @@ -342,14 +342,14 @@ # Get raw value if asked if not raw: value = TYPE_TRANSLATOR.get( - self.VariableType, str)(value) + self.VariableType, str)(value) return value, forced # Return raw value if asked if not raw and self.VariableType in ["STRING", "WSTRING"]: return TYPE_TRANSLATOR.get( - self.VariableType, str)(self.Value) + self.VariableType, str)(self.Value) return self.Value def GetNearestData(self, tick, adjust): diff -r da5f1fa46f2b -r fb73a6b6622d controls/DebugVariablePanel/DebugVariablePanel.py --- a/controls/DebugVariablePanel/DebugVariablePanel.py Thu Oct 19 10:57:35 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariablePanel.py Thu Oct 19 11:03:03 2017 +0300 @@ -847,10 +847,10 @@ target_panel = self.GraphicPanels[target_idx] graph_type = target_panel.GraphType if target_panel != source_panel: - if (merge_type == GRAPH_PARALLEL and graph_type != merge_type or - merge_type == GRAPH_ORTHOGONAL and - (graph_type == GRAPH_PARALLEL and len(target_panel.Items) > 1 or - graph_type == GRAPH_ORTHOGONAL and len(target_panel.Items) >= 3)): + if merge_type == GRAPH_PARALLEL and graph_type != merge_type or \ + merge_type == GRAPH_ORTHOGONAL and ( + graph_type == GRAPH_PARALLEL and len(target_panel.Items) > 1 or + graph_type == GRAPH_ORTHOGONAL and len(target_panel.Items) >= 3): return if source_panel is not None: diff -r da5f1fa46f2b -r fb73a6b6622d controls/DebugVariablePanel/DebugVariableTextViewer.py --- a/controls/DebugVariablePanel/DebugVariableTextViewer.py Thu Oct 19 10:57:35 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableTextViewer.py Thu Oct 19 11:03:03 2017 +0300 @@ -205,7 +205,7 @@ # Get item variable path masked according Debug Variable Panel mask item_path = item.GetVariable( - self.ParentWindow.GetVariableNameMask()) + self.ParentWindow.GetVariableNameMask()) # Draw item variable path at Viewer left side w, h = gc.GetTextExtent(item_path) @@ -240,7 +240,7 @@ # Calculate item path bounding box _width, height = self.GetSize() item_path = item.GetVariable( - self.ParentWindow.GetVariableNameMask()) + self.ParentWindow.GetVariableNameMask()) w, h = self.GetTextExtent(item_path) # Test if mouse has been pressed in this bounding box. In that case diff -r da5f1fa46f2b -r fb73a6b6622d controls/DebugVariablePanel/DebugVariableViewer.py --- a/controls/DebugVariablePanel/DebugVariableViewer.py Thu Oct 19 10:57:35 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableViewer.py Thu Oct 19 11:03:03 2017 +0300 @@ -307,7 +307,7 @@ srcY = srcBBox.y - (srcPos.y if destBBox.y == 0 else 0) srcBmp = _convert_agg_to_wx_bitmap( - srcPanel.get_renderer(), None) + srcPanel.get_renderer(), None) srcDC = wx.MemoryDC() srcDC.SelectObject(srcBmp) @@ -429,4 +429,4 @@ @param item: Item to release value """ self.ParentWindow.ReleaseDataValue( - item.GetVariable().upper()) + item.GetVariable().upper()) diff -r da5f1fa46f2b -r fb73a6b6622d controls/LibraryPanel.py --- a/controls/LibraryPanel.py Thu Oct 19 10:57:35 2017 +0300 +++ b/controls/LibraryPanel.py Thu Oct 19 11:03:03 2017 +0300 @@ -232,7 +232,7 @@ # Tree item doesn't exist, add new one to category item else: blocktype_item = self.Tree.AppendItem( - category_item, blocktype["name"]) + category_item, blocktype["name"]) # See comment when adding category if wx.Platform != '__WXMSW__': blocktype_item, category_cookie = \ diff -r da5f1fa46f2b -r fb73a6b6622d controls/LogViewer.py --- a/controls/LogViewer.py Thu Oct 19 10:57:35 2017 +0300 +++ b/controls/LogViewer.py Thu Oct 19 11:03:03 2017 +0300 @@ -512,9 +512,9 @@ current_message = message self.LogMessages.insert(message_idx, message) self.LogMessagesTimestamp = numpy.insert( - self.LogMessagesTimestamp, - [message_idx], - [message.Timestamp]) + self.LogMessagesTimestamp, + [message_idx], + [message.Timestamp]) self.CurrentMessage = self.LogMessages.index(current_message) if message_idx == 0 and self.FilterLogMessage(message, timestamp): return message, 0 diff -r da5f1fa46f2b -r fb73a6b6622d controls/PouInstanceVariablesPanel.py --- a/controls/PouInstanceVariablesPanel.py Thu Oct 19 10:57:35 2017 +0300 +++ b/controls/PouInstanceVariablesPanel.py Thu Oct 19 11:03:03 2017 +0300 @@ -419,8 +419,8 @@ if item_infos.var_class == ITEM_RESOURCE: if instance_path != "": tagname = self.Controller.ComputeConfigurationResourceName( - instance_path, - item_infos.name) + instance_path, + item_infos.name) else: tagname = None else: diff -r da5f1fa46f2b -r fb73a6b6622d controls/VariablePanel.py --- a/controls/VariablePanel.py Thu Oct 19 10:57:35 2017 +0300 +++ b/controls/VariablePanel.py Thu Oct 19 11:03:03 2017 +0300 @@ -395,7 +395,7 @@ location = "%M" + location if element_type == "functionBlock": configs = self.ParentWindow.Controler.GetProjectConfigNames( - self.ParentWindow.Debug) + self.ParentWindow.Debug) if len(configs) == 0: return if not var_name.upper() in [ @@ -619,7 +619,7 @@ row_content.Class = self.Filter row_content.Name = self.Controler.GenerateNewName( - self.TagName, None, name + "%d", start_idx) + self.TagName, None, name + "%d", start_idx) if self.Filter == "All" and len(self.Values) > 0: self.Values.insert(new_row, row_content) diff -r da5f1fa46f2b -r fb73a6b6622d dialogs/BlockPreviewDialog.py --- a/dialogs/BlockPreviewDialog.py Thu Oct 19 10:57:35 2017 +0300 +++ b/dialogs/BlockPreviewDialog.py Thu Oct 19 11:03:03 2017 +0300 @@ -173,13 +173,11 @@ # Get list of variables defined in POU self.VariableList = { var.Name: (var.Class, var.Type) - for var in self.Controller.GetEditedElementInterfaceVars( - self.TagName) + for var in self.Controller.GetEditedElementInterfaceVars(self.TagName) if var.Edit} # Add POU name to variable list if POU is a function - returntype = self.Controller.GetEditedElementInterfaceReturnType( - self.TagName) + returntype = self.Controller.GetEditedElementInterfaceReturnType(self.TagName) if returntype is not None: self.VariableList[ self.Controller.GetEditedElementName(self.TagName)] = \ diff -r da5f1fa46f2b -r fb73a6b6622d dialogs/BrowseValuesLibraryDialog.py --- a/dialogs/BrowseValuesLibraryDialog.py Thu Oct 19 10:57:35 2017 +0300 +++ b/dialogs/BrowseValuesLibraryDialog.py Thu Oct 19 11:03:03 2017 +0300 @@ -38,12 +38,14 @@ title=_('Browse %s values library') % name) self.staticText1 = wx.StaticText( - label=_('Choose a value for %s:') % name, name='staticText1', parent=self, - pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) + label=_('Choose a value for %s:') % name, + name='staticText1', parent=self, + pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) self.ValuesLibrary = wx.TreeCtrl( - name='ValuesLibrary', parent=self, pos=wx.Point(0, 0), - size=wx.Size(400, 200), style=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT) + name='ValuesLibrary', parent=self, pos=wx.Point(0, 0), + size=wx.Size(400, 200), + style=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT) self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE) diff -r da5f1fa46f2b -r fb73a6b6622d dialogs/ConnectionDialog.py --- a/dialogs/ConnectionDialog.py Thu Oct 19 10:57:35 2017 +0300 +++ b/dialogs/ConnectionDialog.py Thu Oct 19 11:03:03 2017 +0300 @@ -106,7 +106,7 @@ else: self.ConnectionName.ChangeValue( controller.GenerateNewName( - tagname, None, "Connection%d", 0)) + tagname, None, "Connection%d", 0)) self.Fit() # Connector radio button is default control having keyboard focus diff -r da5f1fa46f2b -r fb73a6b6622d dialogs/FBDVariableDialog.py --- a/dialogs/FBDVariableDialog.py Thu Oct 19 10:57:35 2017 +0300 +++ b/dialogs/FBDVariableDialog.py Thu Oct 19 11:03:03 2017 +0300 @@ -142,7 +142,7 @@ """ # Get variable class to select POU variable applicable var_class = VARIABLE_CLASSES_DICT_REVERSE[ - self.Class.GetStringSelection()] + self.Class.GetStringSelection()] # Refresh names in name list box by selecting variables in POU variables # list that can be applied to variable class @@ -205,7 +205,7 @@ expression = self.Expression.GetValue() values = { "class": VARIABLE_CLASSES_DICT_REVERSE[ - self.Class.GetStringSelection()], + self.Class.GetStringSelection()], "expression": expression, "var_type": self.VariableList.get(expression, (None, None))[1], "executionOrder": self.ExecutionOrder.GetValue()} diff -r da5f1fa46f2b -r fb73a6b6622d dialogs/FindInPouDialog.py --- a/dialogs/FindInPouDialog.py Thu Oct 19 10:57:35 2017 +0300 +++ b/dialogs/FindInPouDialog.py Thu Oct 19 11:03:03 2017 +0300 @@ -66,7 +66,7 @@ direction_staticbox = wx.StaticBox(panel, label=_("Direction")) direction_staticboxsizer = wx.StaticBoxSizer( - direction_staticbox, wx.VERTICAL) + direction_staticbox, wx.VERTICAL) params_sizer.AddSizer(direction_staticboxsizer, 1, border=5, flag=wx.GROW | wx.RIGHT) @@ -81,7 +81,7 @@ options_staticbox = wx.StaticBox(panel, label=_("Options")) options_staticboxsizer = wx.StaticBoxSizer( - options_staticbox, wx.VERTICAL) + options_staticbox, wx.VERTICAL) params_sizer.AddSizer(options_staticboxsizer, 1, flag=wx.GROW) self.CaseSensitive = wx.CheckBox(panel, label=_("Case sensitive")) diff -r da5f1fa46f2b -r fb73a6b6622d dialogs/LDElementDialog.py --- a/dialogs/LDElementDialog.py Thu Oct 19 10:57:35 2017 +0300 +++ b/dialogs/LDElementDialog.py Thu Oct 19 11:03:03 2017 +0300 @@ -194,9 +194,9 @@ # Set graphic element displayed, creating a LD element self.Element = self.ElementClass( - self.Preview, - self.GetElementModifier(), - value) + self.Preview, + self.GetElementModifier(), + value) button = self.ButtonSizer.GetAffirmativeButton() button.Enable(value != "") diff -r da5f1fa46f2b -r fb73a6b6622d dialogs/SFCStepDialog.py --- a/dialogs/SFCStepDialog.py Thu Oct 19 10:57:35 2017 +0300 +++ b/dialogs/SFCStepDialog.py Thu Oct 19 11:03:03 2017 +0300 @@ -94,7 +94,7 @@ # Set default name for step self.StepName.ChangeValue(controller.GenerateNewName( - tagname, None, "Step%d", 0)) + tagname, None, "Step%d", 0)) self.Fit() diff -r da5f1fa46f2b -r fb73a6b6622d doc/conf.py --- a/doc/conf.py Thu Oct 19 10:57:35 2017 +0300 +++ b/doc/conf.py Thu Oct 19 11:03:03 2017 +0300 @@ -184,8 +184,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'Beremiz.tex', u'Beremiz Documentation', - u'Beremiz Documentation Authors', 'manual'), + ('index', 'Beremiz.tex', u'Beremiz Documentation', + u'Beremiz Documentation Authors', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -228,9 +228,9 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'Beremiz', u'Beremiz Documentation', - u'Beremiz Documentation Authors', 'Beremiz', 'One line description of project.', - 'Miscellaneous'), + ('index', 'Beremiz', u'Beremiz Documentation', + u'Beremiz Documentation Authors', 'Beremiz', 'One line description of project.', + 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. diff -r da5f1fa46f2b -r fb73a6b6622d editors/CodeFileEditor.py --- a/editors/CodeFileEditor.py Thu Oct 19 10:57:35 2017 +0300 +++ b/editors/CodeFileEditor.py Thu Oct 19 11:03:03 2017 +0300 @@ -142,7 +142,7 @@ self.COMMENT_HEADER * (len_headers - len_headers / 2) self.SectionsComments[section] = { - "comment": section_comment, + "comment": section_comment, } for i, section in enumerate(self.Controler.SECTIONS_NAMES): @@ -322,11 +322,9 @@ newline_size = 1 # Disable to type any character in section header lines - if (self.GetLineState(self.LineFromPosition(current_pos)) and - not text_selected and - key not in NAVIGATION_KEYS + [ - wx.WXK_RETURN, - wx.WXK_NUMPAD_ENTER]): + if self.GetLineState(self.LineFromPosition(current_pos)) and \ + not text_selected and \ + key not in NAVIGATION_KEYS + [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]: return # Disable to delete line between code and header lines @@ -706,7 +704,7 @@ name = row_content["Name"] start_idx = 0 row_content["Name"] = self.Controler.GenerateNewName( - name + "%d", start_idx) + name + "%d", start_idx) else: row_content = self.VariablesDefaultValue.copy() self.Table.InsertRow(new_row, row_content) diff -r da5f1fa46f2b -r fb73a6b6622d editors/DataTypeEditor.py --- a/editors/DataTypeEditor.py Thu Oct 19 10:57:35 2017 +0300 +++ b/editors/DataTypeEditor.py Thu Oct 19 11:03:03 2017 +0300 @@ -263,11 +263,11 @@ enumerated_panel_sizer = wx.BoxSizer(wx.HORIZONTAL) self.EnumeratedValues = CustomEditableListBox( - self.EnumeratedPanel, - label=_("Values:"), - style=(wx.gizmos.EL_ALLOW_NEW | - wx.gizmos.EL_ALLOW_EDIT | - wx.gizmos.EL_ALLOW_DELETE)) + self.EnumeratedPanel, + label=_("Values:"), + style=(wx.gizmos.EL_ALLOW_NEW | + wx.gizmos.EL_ALLOW_EDIT | + wx.gizmos.EL_ALLOW_DELETE)) setattr(self.EnumeratedValues, "_OnLabelEndEdit", self.OnEnumeratedValueEndEdit) for func in ["_OnAddButton", "_OnDelButton", "_OnUpButton", "_OnDownButton"]: setattr(self.EnumeratedValues, func, self.OnEnumeratedValuesChanged) @@ -328,11 +328,11 @@ flag=wx.ALL) self.ArrayDimensions = CustomEditableListBox( - self.ArrayPanel, - label=_("Dimensions:"), - style=(wx.gizmos.EL_ALLOW_NEW | - wx.gizmos.EL_ALLOW_EDIT | - wx.gizmos.EL_ALLOW_DELETE)) + self.ArrayPanel, + label=_("Dimensions:"), + style=(wx.gizmos.EL_ALLOW_NEW | + wx.gizmos.EL_ALLOW_EDIT | + wx.gizmos.EL_ALLOW_DELETE)) for func in ["_OnLabelEndEdit", "_OnAddButton", "_OnDelButton", "_OnUpButton", "_OnDownButton"]: setattr(self.ArrayDimensions, func, self.OnDimensionsChanged) diff -r da5f1fa46f2b -r fb73a6b6622d editors/DebugViewer.py --- a/editors/DebugViewer.py Thu Oct 19 10:57:35 2017 +0300 +++ b/editors/DebugViewer.py Thu Oct 19 11:03:03 2017 +0300 @@ -148,7 +148,7 @@ # Subscribe data consumer to DataProducer result = self.DataProducer.SubscribeDebugIECVariable( - iec_path, consumer, buffer_list) + iec_path, consumer, buffer_list) if result is not None and consumer != self: # Store data consumer if successfully subscribed and inform @@ -168,8 +168,7 @@ # Unsubscribe consumer from DataProducer if iec_path is not None: - self.DataProducer.UnsubscribeDebugIECVariable( - iec_path, consumer) + self.DataProducer.UnsubscribeDebugIECVariable(iec_path, consumer) def SubscribeAllDataConsumers(self): """ @@ -192,8 +191,7 @@ # Unsubscribe all data consumers in list for consumer, iec_path in self.DataConsumers.iteritems(): - self.DataProducer.UnsubscribeDebugIECVariable( - iec_path, consumer) + self.DataProducer.UnsubscribeDebugIECVariable(iec_path, consumer) self.DataConsumers = {} @@ -207,7 +205,7 @@ # Search for variable informations in project compilation files data_type = self.DataProducer.GetDebugIECVariableType( - iec_path.upper()) + iec_path.upper()) if data_type is not None: return data_type diff -r da5f1fa46f2b -r fb73a6b6622d editors/TextViewer.py --- a/editors/TextViewer.py Thu Oct 19 10:57:35 2017 +0300 +++ b/editors/TextViewer.py Thu Oct 19 11:03:03 2017 +0300 @@ -281,8 +281,8 @@ self.RefreshVariableTree() blockinfo = self.Controler.GetBlockType(blocktype, blockinputs, self.Debug) hint = ',\n '.join( - [" " + fctdecl[0]+" := (*"+fctdecl[1]+"*)" for fctdecl in blockinfo["inputs"]] + - [" " + fctdecl[0]+" => (*"+fctdecl[1]+"*)" for fctdecl in blockinfo["outputs"]]) + [" " + fctdecl[0]+" := (*"+fctdecl[1]+"*)" for fctdecl in blockinfo["inputs"]] + + [" " + fctdecl[0]+" => (*"+fctdecl[1]+"*)" for fctdecl in blockinfo["outputs"]]) if values[1] == "function": event.SetDragText(blocktype+"(\n "+hint+")") else: @@ -514,10 +514,12 @@ def RefreshVariableTree(self): words = self.TagName.split("::") - self.Variables = self.GenerateVariableTree( - [(variable.Name, variable.Type, variable.Tree) - for variable in self.Controler.GetEditedElementInterfaceVars( - self.TagName, True, self.Debug)]) + self.Variables = self.GenerateVariableTree([ + (variable.Name, variable.Type, variable.Tree) + for variable in + self.Controler.GetEditedElementInterfaceVars( + self.TagName, True, self.Debug) + ]) if self.Controler.GetEditedElementType(self.TagName, self.Debug)[1] == "function" or words[0] == "T" and self.TextSyntax == "IL": return_type, (var_tree, _var_dimension) = self.Controler.GetEditedElementInterfaceReturnType(self.TagName, True, self.Debug) if return_type is not None: diff -r da5f1fa46f2b -r fb73a6b6622d editors/Viewer.py --- a/editors/Viewer.py Thu Oct 19 10:57:35 2017 +0300 +++ b/editors/Viewer.py Thu Oct 19 11:03:03 2017 +0300 @@ -590,8 +590,9 @@ # Add Wire Menu items to the given menu def AddWireMenuItems(self, menu, delete=False, replace=False): - [ID_ADD_SEGMENT, ID_DELETE_SEGMENT, ID_REPLACE_WIRE, - ] = [wx.NewId() for dummy in xrange(3)] + [ + ID_ADD_SEGMENT, ID_DELETE_SEGMENT, ID_REPLACE_WIRE, + ] = [wx.NewId() for dummy in xrange(3)] # Create menu items self.AddMenuItems(menu, [ @@ -637,7 +638,7 @@ if self.CurrentLanguage != "SFC": self.AddMenuItems(menu, [ - (ID_ADD_COIL, wx.ITEM_NORMAL, _(u'Coil'), '', self.GetAddMenuCallBack(self.AddNewCoil))]) + (ID_ADD_COIL, wx.ITEM_NORMAL, _(u'Coil'), '', self.GetAddMenuCallBack(self.AddNewCoil))]) menu.AppendSeparator() @@ -658,7 +659,7 @@ None]) self.AddMenuItems(menu, [ - (ID_ADD_COMMENT, wx.ITEM_NORMAL, _(u'Comment'), '', self.GetAddMenuCallBack(self.AddNewComment))]) + (ID_ADD_COMMENT, wx.ITEM_NORMAL, _(u'Comment'), '', self.GetAddMenuCallBack(self.AddNewComment))]) # Add Default Menu items to the given menu def AddDefaultMenuItems(self, menu, edit=False, block=False): @@ -667,9 +668,9 @@ # Create menu items self.AddMenuItems(menu, [ - (ID_EDIT_BLOCK, wx.ITEM_NORMAL, _(u'Edit Block'), '', self.OnEditBlockMenu), - (ID_ADJUST_BLOCK_SIZE, wx.ITEM_NORMAL, _(u'Adjust Block Size'), '', self.OnAdjustBlockSizeMenu), - (ID_DELETE, wx.ITEM_NORMAL, _(u'Delete'), '', self.OnDeleteMenu)]) + (ID_EDIT_BLOCK, wx.ITEM_NORMAL, _(u'Edit Block'), '', self.OnEditBlockMenu), + (ID_ADJUST_BLOCK_SIZE, wx.ITEM_NORMAL, _(u'Adjust Block Size'), '', self.OnAdjustBlockSizeMenu), + (ID_DELETE, wx.ITEM_NORMAL, _(u'Delete'), '', self.OnDeleteMenu)]) menu.Enable(ID_EDIT_BLOCK, edit) @@ -693,9 +694,9 @@ # Create menu items self.AddMenuItems(menu, [ - (ID_CUT, wx.ITEM_NORMAL, _(u'Cut'), '', self.GetClipboardCallBack(self.Cut)), - (ID_COPY, wx.ITEM_NORMAL, _(u'Copy'), '', self.GetClipboardCallBack(self.Copy)), - (ID_PASTE, wx.ITEM_NORMAL, _(u'Paste'), '', self.GetAddMenuCallBack(self.Paste))]) + (ID_CUT, wx.ITEM_NORMAL, _(u'Cut'), '', self.GetClipboardCallBack(self.Cut)), + (ID_COPY, wx.ITEM_NORMAL, _(u'Copy'), '', self.GetClipboardCallBack(self.Copy)), + (ID_PASTE, wx.ITEM_NORMAL, _(u'Paste'), '', self.GetAddMenuCallBack(self.Paste))]) menu.Enable(ID_CUT, block) menu.Enable(ID_COPY, block) @@ -1510,9 +1511,8 @@ wire.EndConnected = end_connector connected.RefreshConnectors() self.AddWire(wire) - if selection is not None and ( - selection[1].get((id, refLocalId), False) or - selection[1].get((refLocalId, id), False)): + if selection is not None and (selection[1].get((id, refLocalId), False) or + selection[1].get((refLocalId, id), False)): self.SelectInGroup(wire) else: links_connected = False @@ -1831,7 +1831,7 @@ # Get a new default connection name connection_name = self.Controler.GenerateNewName( - self.TagName, None, "Connection%d", 0) + self.TagName, None, "Connection%d", 0) # Create a connector to connect to wire id = self.GetNewId() @@ -2051,10 +2051,11 @@ WEST: [WEST, EAST], NORTH: [NORTH, SOUTH], SOUTH: [SOUTH, NORTH]}[connector.GetDirection()] - wire = Wire(self, *map(list, zip( - [wx.Point(pos.x, pos.y), - wx.Point(scaled_pos.x, scaled_pos.y)], - directions))) + wire = Wire(self, + *map(list, zip( + [wx.Point(pos.x, pos.y), + wx.Point(scaled_pos.x, scaled_pos.y)], + directions))) wire.oldPos = scaled_pos wire.Handle = (HANDLE_POINT, 0) wire.ProcessDragging(0, 0, event, None) @@ -2968,7 +2969,7 @@ dialog.SetValues({ "type": powerrail.GetType(), "pin_number": len(powerrail.GetConnectors()[ - ("outputs" if powerrail_type == LEFTRAIL else "inputs")])}) + ("outputs" if powerrail_type == LEFTRAIL else "inputs")])}) if dialog.ShowModal() == wx.ID_OK: values = dialog.GetValues() rect = powerrail.GetRedrawRect(1, 1) diff -r da5f1fa46f2b -r fb73a6b6622d plcopen/plcopen.py --- a/plcopen/plcopen.py Thu Oct 19 10:57:35 2017 +0300 +++ b/plcopen/plcopen.py Thu Oct 19 11:03:03 2017 +0300 @@ -209,8 +209,8 @@ PLCOpen_v1_xml = PLCOpen_v1_file.read() PLCOpen_v1_file.close() PLCOpen_v1_xml = PLCOpen_v1_xml.replace( - "http://www.plcopen.org/xml/tc6.xsd", - "http://www.plcopen.org/xml/tc6_0201") + "http://www.plcopen.org/xml/tc6.xsd", + "http://www.plcopen.org/xml/tc6_0201") PLCOpen_v1_xsd = etree.XMLSchema(etree.fromstring(PLCOpen_v1_xml)) # XPath for file compatibility process diff -r da5f1fa46f2b -r fb73a6b6622d plcopen/structures.py --- a/plcopen/structures.py Thu Oct 19 10:57:35 2017 +0300 +++ b/plcopen/structures.py Thu Oct 19 11:03:03 2017 +0300 @@ -180,9 +180,9 @@ 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]: diff -r da5f1fa46f2b -r fb73a6b6622d py_ext/PythonFileCTNMixin.py --- a/py_ext/PythonFileCTNMixin.py Thu Oct 19 10:57:35 2017 +0300 +++ b/py_ext/PythonFileCTNMixin.py Thu Oct 19 11:03:03 2017 +0300 @@ -99,21 +99,29 @@ location_str = "_".join(map(str, self.GetCurrentLocation())) configname = self.GetCTRoot().GetProjectConfigNames()[0] + def _onchangecode(var): + return '"' + var.getonchange() + \ + "('" + var.getname() + "')\"" \ + if var.getonchange() else '""' + + def _onchange(var): + return repr(var.getonchange()) \ + if var.getonchange() else None + pyextname = self.CTNName() - varinfos = map(lambda variable: { - "name": variable.getname(), - "desc": repr(variable.getdesc()), - "onchangecode": '"' + variable.getonchange() + - "('" + variable.getname() + "')\"" - if variable.getonchange() else '""', - "onchange": repr(variable.getonchange()) - if variable.getonchange() else None, - "opts": repr(variable.getopts()), - "configname": configname.upper(), - "uppername": variable.getname().upper(), - "IECtype": variable.gettype(), - "pyextname": pyextname}, - self.CodeFile.variables.variable) + varinfos = map( + lambda variable: { + "name": variable.getname(), + "desc": repr(variable.getdesc()), + "onchangecode": _onchangecode(variable), + "onchange": _onchange(variable), + "opts": repr(variable.getopts()), + "configname": configname.upper(), + "uppername": variable.getname().upper(), + "IECtype": variable.gettype(), + "pyextname": pyextname + }, + self.CodeFile.variables.variable) # python side PLC global variables access stub globalstubs = "\n".join([ """\ @@ -250,9 +258,9 @@ varpub = "\n".join([(varpubonchangefmt if varinfo["onchange"] else varpubfmt) % varinfo for varinfo in varinfos]) - varinit = "\n".join([varinitonchangefmt % dict( - onchangelen=len(varinfo["onchangecode"]), **varinfo) - for varinfo in varinfos if varinfo["onchange"]]) + varinit = "\n".join([varinitonchangefmt % + dict(onchangelen=len(varinfo["onchangecode"]), **varinfo) + for varinfo in varinfos if varinfo["onchange"]]) loc_dict = { "vardec": vardec, diff -r da5f1fa46f2b -r fb73a6b6622d runtime/NevowServer.py --- a/runtime/NevowServer.py Thu Oct 19 10:57:35 2017 +0300 +++ b/runtime/NevowServer.py Thu Oct 19 11:03:03 2017 +0300 @@ -50,23 +50,26 @@ class DefaultPLCStartedHMI(PLCHMI): - docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[ - tags.h1["PLC IS NOW STARTED"], - ]) + docFactory = loaders.stan( + tags.div(render=tags.directive('liveElement'))[ + tags.h1["PLC IS NOW STARTED"], + ]) class PLCStoppedHMI(PLCHMI): - docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[ - tags.h1["PLC IS STOPPED"], - ]) + docFactory = loaders.stan( + tags.div(render=tags.directive('liveElement'))[ + tags.h1["PLC IS STOPPED"], + ]) class MainPage(athena.LiveElement): jsClass = u"WebInterface.PLC" - docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[ - tags.div(id='content')[ - tags.div(render=tags.directive('PLCElement')), - ]]) + docFactory = loaders.stan( + tags.div(render=tags.directive('liveElement'))[ + tags.div(id='content')[ + tags.div(render=tags.directive('PLCElement'))] + ]) def __init__(self, *a, **kw): athena.LiveElement.__init__(self, *a, **kw) diff -r da5f1fa46f2b -r fb73a6b6622d runtime/PLCObject.py --- a/runtime/PLCObject.py Thu Oct 19 10:57:35 2017 +0300 +++ b/runtime/PLCObject.py Thu Oct 19 11:03:03 2017 +0300 @@ -48,9 +48,9 @@ lib_ext = { - "linux2": ".so", - "win32": ".dll", - }.get(sys.platform, "") + "linux2": ".so", + "win32": ".dll", +}.get(sys.platform, "") def PLCprint(message): @@ -85,8 +85,8 @@ # Get the last transfered PLC if connector must be restart try: self.CurrentPLCFilename = open( - self._GetMD5FileName(), - "r").read().strip() + lib_ext + self._GetMD5FileName(), + "r").read().strip() + lib_ext if self.LoadPLC(): self.PLCStatus = "Stopped" except Exception: @@ -560,5 +560,5 @@ _e_type, e_value, e_traceback = sys.exc_info() line_no = traceback.tb_lineno(get_last_traceback(e_traceback)) return (-1, "RemoteExec script failed!\n\nLine %d: %s\n\t%s" % - (line_no, e_value, script.splitlines()[line_no - 1])) + (line_no, e_value, script.splitlines()[line_no - 1])) return (0, kwargs.get("returnVal", None)) diff -r da5f1fa46f2b -r fb73a6b6622d runtime/ServicePublisher.py --- a/runtime/ServicePublisher.py Thu Oct 19 10:57:35 2017 +0300 +++ b/runtime/ServicePublisher.py Thu Oct 19 11:03:03 2017 +0300 @@ -64,11 +64,11 @@ self.ip_32b = socket.inet_aton(ip) self.server.register_service( - zeroconf.ServiceInfo(service_type, - self.service_name, - self.ip_32b, - self.port, - properties=self.serviceproperties)) + zeroconf.ServiceInfo(service_type, + self.service_name, + self.ip_32b, + self.port, + properties=self.serviceproperties)) self.retrytimer = None def UnRegisterService(self): diff -r da5f1fa46f2b -r fb73a6b6622d runtime/WampClient.py --- a/runtime/WampClient.py Thu Oct 19 10:57:35 2017 +0300 +++ b/runtime/WampClient.py Thu Oct 19 11:03:03 2017 +0300 @@ -36,18 +36,19 @@ _WampSession = None _PySrv = None -ExposedCalls = ["StartPLC", - "StopPLC", - "ForceReload", - "GetPLCstatus", - "NewPLC", - "MatchMD5", - "SetTraceVariablesList", - "GetTraceVariables", - "RemoteExec", - "GetLogMessage", - "ResetLogCount", - ] +ExposedCalls = [ + "StartPLC", + "StopPLC", + "ForceReload", + "GetPLCstatus", + "NewPLC", + "MatchMD5", + "SetTraceVariablesList", + "GetTraceVariables", + "RemoteExec", + "GetLogMessage", + "ResetLogCount", +] SubscribedEvents = [] diff -r da5f1fa46f2b -r fb73a6b6622d svgui/pyjs/jsonrpc/django/jsonrpc.py --- a/svgui/pyjs/jsonrpc/django/jsonrpc.py Thu Oct 19 10:57:35 2017 +0300 +++ b/svgui/pyjs/jsonrpc/django/jsonrpc.py Thu Oct 19 11:03:03 2017 +0300 @@ -78,20 +78,20 @@ # contains the list of arguments in each field field_names = { - 'CharField': ['max_length', 'min_length'], - 'IntegerField': ['max_value', 'min_value'], - 'FloatField': ['max_value', 'min_value'], - 'DecimalField': ['max_value', 'min_value', 'max_digits', 'decimal_places'], - 'DateField': ['input_formats'], - 'DateTimeField': ['input_formats'], - 'TimeField': ['input_formats'], - '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'], - 'FilePathField': ['path', 'match', 'recursive', 'choices'], - 'IPAddressField': ['max_length', 'min_length'], - } + 'CharField': ['max_length', 'min_length'], + 'IntegerField': ['max_value', 'min_value'], + 'FloatField': ['max_value', 'min_value'], + 'DecimalField': ['max_value', 'min_value', 'max_digits', 'decimal_places'], + 'DateField': ['input_formats'], + 'DateTimeField': ['input_formats'], + 'TimeField': ['input_formats'], + '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'], + 'FilePathField': ['path', 'match', 'recursive', 'choices'], + 'IPAddressField': ['max_length', 'min_length'], +} def describe_field_errors(field): diff -r da5f1fa46f2b -r fb73a6b6622d svgui/svgui_server.py --- a/svgui/svgui_server.py Thu Oct 19 10:57:35 2017 +0300 +++ b/svgui/svgui_server.py Thu Oct 19 11:03:03 2017 +0300 @@ -114,8 +114,8 @@ jsClass = u"LiveSVGPage.LiveSVGWidget" docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[ - tags.xml(loaders.xmlfile(os.path.join(NS.WorkingDir, svgfile))), - ]) + tags.xml(loaders.xmlfile(os.path.join(NS.WorkingDir, svgfile))), + ]) def HMIinitialisation(self): gadgets = [] diff -r da5f1fa46f2b -r fb73a6b6622d tests/tools/check_source.sh --- a/tests/tools/check_source.sh Thu Oct 19 10:57:35 2017 +0300 +++ b/tests/tools/check_source.sh Thu Oct 19 11:03:03 2017 +0300 @@ -205,6 +205,7 @@ disable=$disable,W0123 # (eval-used) Use of eval disable=$disable,I0011 # (locally-disabled) Locally disabling ungrouped-imports (C0412) disable=$disable,R0204 # (redefined-variable-type) Redefinition of current type from X to Y + disable=$disable,R0201 # (no-self-use) Method could be a function # It'd be nice to fix warnings below some day disable=$disable,C0111 # missing-docstring @@ -265,7 +266,8 @@ enable=$enable,W0233 # (non-parent-init-called) __init__ method from a non direct base class 'X' is called enable=$enable,W0601 # (global-variable-undefined) Global variable 'X' undefined at the module level enable=$enable,W0623 # (redefine-in-handler) Redefining name 'X' from outer scope (line Y) in exception handler - enable=$enable,W0106 # (expression-not-assigned) + enable=$enable,W0106 # (expression-not-assigned) Expression "X" is assigned to nothing + enable=$enable,C0330 # (bad-continuation) Wrong hanging indentation before block # enable= options= diff -r da5f1fa46f2b -r fb73a6b6622d util/ProcessLogger.py --- a/util/ProcessLogger.py Thu Oct 19 10:57:35 2017 +0300 +++ b/util/ProcessLogger.py Thu Oct 19 11:03:03 2017 +0300 @@ -117,10 +117,10 @@ 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 and wx.Platform == '__WXMSW__': @@ -139,16 +139,16 @@ self.Proc = subprocess.Popen(self.Command, **popenargs) self.outt = outputThread( - self.Proc, - self.Proc.stdout, - self.output, - self.finish) + self.Proc, + self.Proc.stdout, + self.output, + self.finish) self.outt.start() self.errt = outputThread( - self.Proc, - self.Proc.stderr, - self.errors) + self.Proc, + self.Proc.stderr, + self.errors) self.errt.start() self.startsem.release() diff -r da5f1fa46f2b -r fb73a6b6622d wxglade_hmi/wxglade_hmi.py --- a/wxglade_hmi/wxglade_hmi.py Thu Oct 19 10:57:35 2017 +0300 +++ b/wxglade_hmi/wxglade_hmi.py Thu Oct 19 11:03:03 2017 +0300 @@ -124,10 +124,9 @@ 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']]) - for x in hmi_frames]) + for x in hmi_frames]) global_hmi = ("global %s\n" % ",".join( - [x["name"] for x in hmi_frames]) - if len(hmi_frames) > 0 else "") + [x["name"] for x in hmi_frames]) if len(hmi_frames) > 0 else "") init_hmi = "\n".join(["""\ def OnCloseFrame(evt): wx.MessageBox(_("Please stop PLC to close")) @@ -138,7 +137,7 @@ """ % x for x in hmi_frames]) cleanup_hmi = "\n".join( ["if %(name)s is not None: %(name)s.Destroy()" % x - for x in hmi_frames]) + for x in hmi_frames]) self.PreSectionsTexts = { "globals": define_hmi, diff -r da5f1fa46f2b -r fb73a6b6622d xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Thu Oct 19 10:57:35 2017 +0300 +++ b/xmlclass/xmlclass.py Thu Oct 19 11:03:03 2017 +0300 @@ -945,7 +945,7 @@ equivalences[self.etreeNamespaceFormat % name] = True def AddDistinctionBetweenParentsInLookupClass( - self, lookup_classes, parent, typeinfos): + self, lookup_classes, parent, typeinfos): parent = (self.etreeNamespaceFormat % parent if parent is not None else None) parent_class = lookup_classes.get(parent)