# HG changeset patch # User Andrey Skvortsov # Date 1502802078 -10800 # Node ID dd94b9a68c61a312717f6411ae0fe16b0c7b734e # Parent b789b695b5c64f7487abc915cb2b195f0a2cdd3a clean-up: fix PEP8 E303 too many blank lines diff -r b789b695b5c6 -r dd94b9a68c61 Beremiz.py --- a/Beremiz.py Tue Aug 15 15:50:30 2017 +0300 +++ b/Beremiz.py Tue Aug 15 16:01:18 2017 +0300 @@ -23,7 +23,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - import os import sys import getopt @@ -60,7 +59,6 @@ wx.Yield() time.sleep(0.01); - def Usage(self): print "Usage:" print "%s [Options] [Projectpath] [Buildpath]" % sys.argv[0] diff -r b789b695b5c6 -r dd94b9a68c61 BeremizIDE.py --- a/BeremizIDE.py Tue Aug 15 15:50:30 2017 +0300 +++ b/BeremizIDE.py Tue Aug 15 16:01:18 2017 +0300 @@ -41,8 +41,6 @@ def Bpath(*args): return os.path.join(beremiz_dir, *args) - - import wx.lib.buttons import wx.lib.statbmp import wx.stc @@ -398,7 +396,6 @@ # found here. os.environ["PATH"] = os.getcwd()+';'+os.environ["PATH"] - def __init__(self, parent, projectOpen=None, buildpath=None, ctr=None, debug=True): # Add beremiz's icon in top left corner of the frame self.icon = wx.Icon(Bpath("images", "brz.ico"), wx.BITMAP_TYPE_ICO) diff -r b789b695b5c6 -r dd94b9a68c61 Beremiz_service.py --- a/Beremiz_service.py Tue Aug 15 15:50:30 2017 +0300 +++ b/Beremiz_service.py Tue Aug 15 16:01:18 2017 +0300 @@ -143,12 +143,10 @@ # Define locale domain loc.AddCatalog(domain) - import locale global default_locale default_locale = locale.getdefaultlocale()[1] - # sys.stdout.encoding = default_locale # if Beremiz_service is started from Beremiz IDE # sys.stdout.encoding is None (that means 'ascii' encoding'). @@ -197,7 +195,6 @@ else: event(self, function) - def __init__(self, parent, message, caption = _("Please enter text"), defaultValue = "", style = wx.OK|wx.CANCEL|wx.CENTRE, pos = wx.DefaultPosition): wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos) diff -r b789b695b5c6 -r dd94b9a68c61 IDEFrame.py --- a/IDEFrame.py Tue Aug 15 15:50:30 2017 +0300 +++ b/IDEFrame.py Tue Aug 15 16:01:18 2017 +0300 @@ -86,7 +86,6 @@ ] = [wx.NewId() for _init_coll_DefaultEditorToolBar_Items in range(18)] - # Define behaviour of each Toolbar item according to current POU body type # Informations meaning are in this order: # - Item is toggled @@ -653,7 +652,6 @@ self.AUIManager.Update() - ## Constructor of the PLCOpenEditor class. # @param parent The parent window. # @param controler The controler been used by PLCOpenEditor (default: None). @@ -729,7 +727,6 @@ "notebooks": notebooks, } - # Initialize Printing configuring elements self.PrintData = wx.PrintData() self.PrintData.SetPaperId(wx.PAPER_A4) @@ -923,7 +920,6 @@ else: event.Veto() - def GetCopyBuffer(self, primary_selection=False): data = None if primary_selection and wx.Platform == '__WXMSW__': diff -r b789b695b5c6 -r dd94b9a68c61 PLCControler.py --- a/PLCControler.py Tue Aug 15 15:50:30 2017 +0300 +++ b/PLCControler.py Tue Aug 15 16:01:18 2017 +0300 @@ -481,7 +481,6 @@ else: self.LastSave = -1 - def Buffering(self, currentstate): """ Add a new state in buffer @@ -497,7 +496,6 @@ self.MinIndex = (self.MinIndex + 1) % UNDO_BUFFER_LENGTH self.MinIndex = max(self.MinIndex, 0) - def Current(self): """ Return current state of buffer @@ -1740,7 +1738,6 @@ return result return None - # Return Data Type Object def GetDataType(self, typename, debug = False): project = self.GetProject(debug) diff -r b789b695b5c6 -r dd94b9a68c61 PLCOpenEditor.py --- a/PLCOpenEditor.py Tue Aug 15 15:50:30 2017 +0300 +++ b/PLCOpenEditor.py Tue Aug 15 16:01:18 2017 +0300 @@ -73,7 +73,6 @@ else: app = wx.PySimpleApp() - from util.misc import InstallLocalRessources InstallLocalRessources(beremiz_dir) diff -r b789b695b5c6 -r dd94b9a68c61 ProjectController.py --- a/ProjectController.py Tue Aug 15 15:50:30 2017 +0300 +++ b/ProjectController.py Tue Aug 15 16:01:18 2017 +0300 @@ -736,8 +736,6 @@ plc_file.close() return True - - def _Compile_ST_to_SoftPLC(self): self.logger.write(_("Compiling IEC Program into C code...\n")) buildpath = self._getBuildPath() @@ -1039,7 +1037,6 @@ plc_main_code += targets.GetCode("plc_main_tail.c") return plc_main_code - def _Build(self): """ Method called by user to (re)build SoftPLC and confnode tree @@ -1321,7 +1318,6 @@ def UpdateButtons(self): wx.CallAfter(self._UpdateButtons) - def UpdatePLCLog(self, log_count): if log_count: if self.AppFrame is not None: @@ -1790,7 +1786,6 @@ # _("Cannot compare latest build to target. Please build.\n")) self.EnableMethod("_Transfer", False) - def _Disconnect(self): self._SetConnector(None) @@ -1911,7 +1906,6 @@ }, ] - def EnableMethod(self, method, value): for d in self.StatusMethods: if d["method"]==method: diff -r b789b695b5c6 -r dd94b9a68c61 canfestival/canfestival.py --- a/canfestival/canfestival.py Tue Aug 15 15:50:30 2017 +0300 +++ b/canfestival/canfestival.py Tue Aug 15 16:01:18 2017 +0300 @@ -509,7 +509,6 @@ else: can_driver_name = "" - format_dict = {"locstr": "_".join(map(str, self.GetCurrentLocation())), "candriver": can_driver_name, "nodes_includes": "", diff -r b789b695b5c6 -r dd94b9a68c61 canfestival/config_utils.py --- a/canfestival/config_utils.py Tue Aug 15 15:50:30 2017 +0300 +++ b/canfestival/config_utils.py Tue Aug 15 16:01:18 2017 +0300 @@ -202,7 +202,6 @@ return len(nodeRpdoIndexes), len(nodeTpdoIndexes) - def PrepareMasterNode(self): """ Add mandatory entries for DCF generation into MasterNode. @@ -250,7 +249,6 @@ self.MasterNode.SetEntry(0x1280 + idx, 0x02, TSDO_cobid) self.MasterNode.SetEntry(0x1280 + idx, 0x03, nodeid) - def GetMasterNode(self): """ Return MasterNode. diff -r b789b695b5c6 -r dd94b9a68c61 controls/DebugVariablePanel/DebugVariableGraphicViewer.py --- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Tue Aug 15 15:50:30 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Tue Aug 15 16:01:18 2017 +0300 @@ -1252,7 +1252,6 @@ else: self.VLine.set_xdata((x_cursor, x_cursor)) - # Define a horizontal line to display cursor y # coordinate if no line is already defined if self.HLine is None: diff -r b789b695b5c6 -r dd94b9a68c61 controls/EnhancedStatusBar.py --- a/controls/EnhancedStatusBar.py Tue Aug 15 15:50:30 2017 +0300 +++ b/controls/EnhancedStatusBar.py Tue Aug 15 16:01:18 2017 +0300 @@ -101,7 +101,6 @@ wx.EVT_SIZE(self, self.OnSize) wx.CallAfter(self.OnSize, None) - def OnSize(self, event): """Handles The wx.EVT_SIZE Events For The StatusBar. @@ -192,11 +191,9 @@ elif verticalalignment == ESB_ALIGN_BOTTOM: widget.SetPosition((xpos, rect.height-widgetsize[1])) - if event is not None: event.Skip() - def AddWidget(self, widget, horizontalalignment=ESB_ALIGN_CENTER_HORIZONTAL, verticalalignment=ESB_ALIGN_CENTER_VERTICAL, pos = -1): """Add A Widget To The EnhancedStatusBar. @@ -238,7 +235,6 @@ '"ESB_ALIGN_CENTER_VERTICAL", "ESB_ALIGN_TOP", "ESB_ALIGN_BOTTOM"' \ '"ESB_EXACT_FIT"' - try: self.RemoveChild(self._items[pos].widget) self._items[pos].widget.Destroy() diff -r b789b695b5c6 -r dd94b9a68c61 dialogs/DiscoveryDialog.py --- a/dialogs/DiscoveryDialog.py Tue Aug 15 15:50:30 2017 +0300 +++ b/dialogs/DiscoveryDialog.py Tue Aug 15 16:01:18 2017 +0300 @@ -198,7 +198,6 @@ def removeService(self, zeroconf, _type, name): wx.CallAfter(self._removeService, name) - def _removeService(self, name): ''' called when a service with the desired type goes offline. diff -r b789b695b5c6 -r dd94b9a68c61 dialogs/FindInPouDialog.py --- a/dialogs/FindInPouDialog.py Tue Aug 15 15:50:30 2017 +0300 +++ b/dialogs/FindInPouDialog.py Tue Aug 15 16:01:18 2017 +0300 @@ -33,7 +33,6 @@ if parent and parent.icon: self.SetIcon(parent.icon) - def __init__(self, parent): wx.Dialog.__init__(self, parent, title=_("Find"), style=wx.CAPTION|wx.CLOSE_BOX|wx.CLIP_CHILDREN|wx.RESIZE_BORDER) @@ -123,7 +122,6 @@ # clear message after dialog size calculation self.SetStatusText("") - self.ParentWindow = parent self.Bind(wx.EVT_CLOSE, self.OnCloseFrame) diff -r b789b695b5c6 -r dd94b9a68c61 editors/CodeFileEditor.py --- a/editors/CodeFileEditor.py Tue Aug 15 15:50:30 2017 +0300 +++ b/editors/CodeFileEditor.py Tue Aug 15 16:01:18 2017 +0300 @@ -444,8 +444,6 @@ lineNum = lineNum + 1 - - def Expand(self, line, doExpand, force=False, visLevels=0, level=-1): lastChild = self.GetLastChild(line, level) line = line + 1 diff -r b789b695b5c6 -r dd94b9a68c61 editors/ConfTreeNodeEditor.py --- a/editors/ConfTreeNodeEditor.py Tue Aug 15 15:50:30 2017 +0300 +++ b/editors/ConfTreeNodeEditor.py Tue Aug 15 16:01:18 2017 +0300 @@ -479,7 +479,6 @@ sizer.Layout() self.RefreshScrollbars() - def GetItemChannelChangedFunction(self, dir): def OnConfNodeTreeItemChannelChanged(event): confnode_IECChannel = self.Controler.BaseParams.getIEC_Channel() diff -r b789b695b5c6 -r dd94b9a68c61 editors/ResourceEditor.py --- a/editors/ResourceEditor.py Tue Aug 15 15:50:30 2017 +0300 +++ b/editors/ResourceEditor.py Tue Aug 15 16:01:18 2017 +0300 @@ -212,7 +212,6 @@ row_highlights.pop(col) - class ResourceEditor(EditorPanel): VARIABLE_PANEL_TYPE = "resource" diff -r b789b695b5c6 -r dd94b9a68c61 editors/Viewer.py --- a/editors/Viewer.py Tue Aug 15 15:50:30 2017 +0300 +++ b/editors/Viewer.py Tue Aug 15 16:01:18 2017 +0300 @@ -440,7 +440,6 @@ message.Destroy() - class DebugInstanceName(DebugDataConsumer): VALUE_TRANSLATION = {True: _("Active"), False: _("Inactive")} @@ -1181,7 +1180,6 @@ # Refresh functions #------------------------------------------------------------------------------- - def ElementNeedRefresh(self, element): self.ElementRefreshList_lock.acquire() self.ElementRefreshList.append(element) @@ -3249,7 +3247,6 @@ # Model delete functions #------------------------------------------------------------------------------- - def DeleteBlock(self, block): elements = [] for output in block.GetConnectors()["outputs"]: diff -r b789b695b5c6 -r dd94b9a68c61 graphics/GraphicCommons.py --- a/graphics/GraphicCommons.py Tue Aug 15 15:50:30 2017 +0300 +++ b/graphics/GraphicCommons.py Tue Aug 15 16:01:18 2017 +0300 @@ -192,7 +192,6 @@ return pos - def DirectionChoice(v_base, v_target, dir_target): """ Function that choose a direction during the wire points generation diff -r b789b695b5c6 -r dd94b9a68c61 graphics/SFC_Objects.py --- a/graphics/SFC_Objects.py Tue Aug 15 15:50:30 2017 +0300 +++ b/graphics/SFC_Objects.py Tue Aug 15 16:01:18 2017 +0300 @@ -1970,7 +1970,6 @@ else: return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling) - # Refreshes the action block model def RefreshModel(self, move=True): self.Parent.RefreshActionBlockModel(self) diff -r b789b695b5c6 -r dd94b9a68c61 i18n/mki18n.py --- a/i18n/mki18n.py Tue Aug 15 15:50:30 2017 +0300 +++ b/i18n/mki18n.py Tue Aug 15 16:01:18 2017 +0300 @@ -110,7 +110,6 @@ return languageDict - def processCustomFiles(filein, fileout, regexp, prefix = ''): appfil_file = open(filein, 'r') messages_file = open(fileout, 'r') diff -r b789b695b5c6 -r dd94b9a68c61 runtime/PLCObject.py --- a/runtime/PLCObject.py Tue Aug 15 15:50:30 2017 +0300 +++ b/runtime/PLCObject.py Tue Aug 15 16:01:18 2017 +0300 @@ -139,7 +139,6 @@ def _GetLibFileName(self): return os.path.join(self.workingdir, self.CurrentPLCFilename) - def LoadPLC(self): """ Load PLC library @@ -182,7 +181,6 @@ self.PlcStopping.set() self._stopPLC = __StopPLC - self._ResetDebugVariables = self.PLClibraryHandle.ResetDebugVariables self._ResetDebugVariables.restype = None @@ -322,8 +320,6 @@ self.PythonRuntimeCall("init") - - def PythonRuntimeCleanup(self): if self.python_runtime_vars is not None: self.PythonRuntimeCall("cleanup") @@ -554,7 +550,6 @@ self._TracesAutoSuspend() self._TracesFlush() - def RemoteExec(self, script, *kwargs): try: exec script in kwargs diff -r b789b695b5c6 -r dd94b9a68c61 svgui/pyjs/build.py --- a/svgui/pyjs/build.py Tue Aug 15 15:50:30 2017 +0300 +++ b/svgui/pyjs/build.py Tue Aug 15 16:01:18 2017 +0300 @@ -242,7 +242,6 @@ copy_boilerplate(data_dir, "tree_white.gif", output) copy_boilerplate(data_dir, "history.html", output) - ## all.cache.html app_files = generateAppFiles(data_dir, js_includes, app_name, debug, output, dynamic, cache_buster, optimize) diff -r b789b695b5c6 -r dd94b9a68c61 svgui/pyjs/jsonrpc/django/jsonrpc.py --- a/svgui/pyjs/jsonrpc/django/jsonrpc.py Tue Aug 15 15:50:30 2017 +0300 +++ b/svgui/pyjs/jsonrpc/django/jsonrpc.py Tue Aug 15 16:01:18 2017 +0300 @@ -178,9 +178,6 @@ return "unrecognised command" - - - # The following is incredibly convenient for saving vast amounts of # coding, avoiding doing silly things like this: # jsonresult = {'field1': djangoobject.field1, diff -r b789b695b5c6 -r dd94b9a68c61 svgui/pyjs/pyjs.py --- a/svgui/pyjs/pyjs.py Tue Aug 15 15:50:30 2017 +0300 +++ b/svgui/pyjs/pyjs.py Tue Aug 15 16:01:18 2017 +0300 @@ -236,7 +236,6 @@ if decl: print >>self.output, decl - if self.debug: haltException = self.module_prefix + "HaltException" print >>self.output, haltException + ' = function () {' @@ -459,25 +458,20 @@ print >>self.output, "};" print >>self.output, "%s.__name__ = '%s';\n" % (function_name, node.name) - self._kwargs_parser(node, function_name, normal_arg_names, None) - def _return(self, node, current_klass): expr = self.expr(node.value, current_klass) # in python a function call always returns None, so we do it # here too print >>self.output, " return " + expr + ";" - def _break(self, node, current_klass): print >>self.output, " break;" - def _continue(self, node, current_klass): print >>self.output, " continue;" - def _callfunc(self, v, current_klass): if isinstance(v.node, ast.Name): @@ -633,7 +627,6 @@ else: raise TranslationError("unsupported type (in _getattr)", v.expr) - def modpfx(self): return strip_py(self.module_prefix) @@ -717,7 +710,6 @@ return call_name - def _getattr2(self, v, current_klass, attr_name): if isinstance(v.expr, ast.Getattr): call_name = self._getattr2(v.expr, current_klass, v.attrname + "." + attr_name) @@ -729,7 +721,6 @@ return call_name - def _class(self, node): """ Handle a class definition. @@ -769,7 +760,6 @@ if child.name == "__init__": init_method = child - if len(node.bases) == 0: base_class = "pyjslib.__Object" elif len(node.bases) == 1: @@ -855,7 +845,6 @@ print >> self.output, class_name_+".__initialize__();" - def classattr(self, node, current_klass): self._assign(node, current_klass, True) @@ -918,7 +907,6 @@ self._varargs_handler(node, varargname, declared_arg_names, current_klass) local_arg_names.append(varargname) - # stack of local variable names for this function call self.local_arg_stack.append(local_arg_names) @@ -1035,7 +1023,6 @@ print >>self.output, ' }' print >>self.output, ' }' - def get_line_trace(self, node): lineNum = "Unknown" srcLine = "" @@ -1064,7 +1051,6 @@ rhs = self.expr(node.expr, current_klass) print >>self.output, " " + lhs + " " + op + " " + rhs + ";" - def _assign(self, node, current_klass, top_level = False): if len(node.nodes) != 1: tempvar = '__temp'+str(node.lineno) @@ -1176,7 +1162,6 @@ print "b", repr(node.expr), rhs print >>self.output, " " + lhs + " " + op + " " + rhs + ";" - def _discard(self, node, current_klass): if isinstance(node.expr, ast.CallFunc): @@ -1207,7 +1192,6 @@ else: raise TranslationError("unsupported type (in _discard)", node.expr) - def _if(self, node, current_klass): for i in range(len(node.tests)): test, consequence = node.tests[i] @@ -1225,7 +1209,6 @@ self._if_test(keyword, test, consequence, current_klass) - def _if_test(self, keyword, test, consequence, current_klass): if test: expr = self.expr(test, current_klass) @@ -1242,7 +1225,6 @@ print >>self.output, " }" - def _from(self, node): for name in node.names: # look up "hack" in AppTranslator as to how findFile gets here @@ -1256,7 +1238,6 @@ else: self.imported_classes[name[0]] = node.modname - def _compare(self, node, current_klass): lhs = self.expr(node.expr, current_klass) @@ -1280,7 +1261,6 @@ return "(" + lhs + " " + op + " " + rhs + ")" - def _not(self, node, current_klass): expr = self.expr(node.expr, current_klass) @@ -1349,7 +1329,6 @@ } """ % locals() - def _while(self, node, current_klass): test = self.expr(node.test, current_klass) print >>self.output, " while (pyjslib.bool(" + test + ")) {" @@ -1360,7 +1339,6 @@ raise TranslationError("unsupported type (in _while)", node.body) print >>self.output, " }" - def _const(self, node): if isinstance(node.value, int): return str(node.value) @@ -1539,7 +1517,6 @@ raise TranslationError("unsupported type (in expr)", node) - import cStringIO @@ -1726,7 +1703,6 @@ return imported_modules_str + module_str - def translate(self, module_name, is_app=True, debug=False, library_modules=[]): app_code = cStringIO.StringIO() diff -r b789b695b5c6 -r dd94b9a68c61 targets/typemapping.py --- a/targets/typemapping.py Tue Aug 15 15:50:30 2017 +0300 +++ b/targets/typemapping.py Tue Aug 15 16:01:18 2017 +0300 @@ -114,7 +114,6 @@ return None - LogLevels = ["CRITICAL", "WARNING", "INFO", "DEBUG"] LogLevelsCount = len(LogLevels) LogLevelsDict = dict(zip(LogLevels, range(LogLevelsCount))) diff -r b789b695b5c6 -r dd94b9a68c61 util/ProcessLogger.py --- a/util/ProcessLogger.py Tue Aug 15 15:50:30 2017 +0300 +++ b/util/ProcessLogger.py Tue Aug 15 16:01:18 2017 +0300 @@ -151,7 +151,6 @@ self.errt.start() self.startsem.release() - def output(self, v): self.outdata.append(v) self.outlen += 1 @@ -215,7 +214,6 @@ self.kill() self.finishsem.release() - def spin(self): self.finishsem.acquire() return [self.exitcode, "".join(self.outdata), "".join(self.errdata)] diff -r b789b695b5c6 -r dd94b9a68c61 version.py --- a/version.py Tue Aug 15 15:50:30 2017 +0300 +++ b/version.py Tue Aug 15 16:01:18 2017 +0300 @@ -88,7 +88,6 @@ "Edouard Tisserant ", "Laurent Bessard ") - info.License = ('\n This program is free software; you can redistribute it and/or\n' ' modify it under the terms of the GNU General Public License\n' ' as published by the Free Software Foundation; either version 2\n' diff -r b789b695b5c6 -r dd94b9a68c61 wxglade_hmi/wxglade_hmi.py --- a/wxglade_hmi/wxglade_hmi.py Tue Aug 15 15:50:30 2017 +0300 +++ b/wxglade_hmi/wxglade_hmi.py Tue Aug 15 16:01:18 2017 +0300 @@ -56,7 +56,6 @@ # define name for wxGlade gui file return os.path.join(project_path, "hmi.wxg") - def GetWxGladePath(self): path = None try: