clean-up: fix PEP8 E306 expected 1 blank line before a nested definition, found X
--- a/BeremizIDE.py Wed Aug 16 12:48:08 2017 +0300
+++ b/BeremizIDE.py Wed Aug 16 12:53:23 2017 +0300
@@ -1191,9 +1191,11 @@
sys.excepthook = handle_exception
init_old = threading.Thread.__init__
+
def init(self, *args, **kwargs):
init_old(self, *args, **kwargs)
run_old = self.run
+
def run_with_except_hook(*args, **kw):
try:
run_old(*args, **kw)
--- a/Beremiz_service.py Wed Aug 16 12:48:08 2017 +0300
+++ b/Beremiz_service.py Wed Aug 16 12:53:23 2017 +0300
@@ -547,9 +547,11 @@
def installThreadExcepthook():
init_old = threading.Thread.__init__
+
def init(self, *args, **kwargs):
init_old(self, *args, **kwargs)
run_old = self.run
+
def run_with_except_hook(*args, **kw):
try:
run_old(*args, **kw)
--- a/connectors/PYRO/__init__.py Wed Aug 16 12:48:08 2017 +0300
+++ b/connectors/PYRO/__init__.py Wed Aug 16 12:53:23 2017 +0300
@@ -63,6 +63,7 @@
% (Pyro.config.PYROSSL_CERTDIR))
Pyro.config.PYROSSL_CERT = "client.crt"
Pyro.config.PYROSSL_KEY = "client.key"
+
# Ugly Monkey Patching
def _gettimeout(self):
return self.timeout
--- a/connectors/WAMP/__init__.py Wed Aug 16 12:48:08 2017 +0300
+++ b/connectors/WAMP/__init__.py Wed Aug 16 12:53:23 2017 +0300
@@ -99,6 +99,7 @@
return conn
AddToDoBeforeQuit = confnodesroot.AppFrame.AddToDoBeforeQuit
+
def ThreadProc():
global _WampConnection
_WampConnection = RegisterWampClient()
@@ -107,6 +108,7 @@
def WampSessionProcMapper(funcname):
wampfuncname = '.'.join((ID, funcname))
+
def catcher_func(*args, **kwargs):
global _WampSession
if _WampSession is not None:
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Wed Aug 16 12:48:08 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Wed Aug 16 12:53:23 2017 +0300
@@ -977,6 +977,7 @@
@return: Function adding text to figure
"""
text_func = (self.Axes.text2D if self.Is3DCanvas() else self.Axes.text)
+
def AddText(*args, **kwargs):
args = [0, 0, ""]
kwargs["transform"] = self.Axes.transAxes
--- a/dialogs/ForceVariableDialog.py Wed Aug 16 12:48:08 2017 +0300
+++ b/dialogs/ForceVariableDialog.py Wed Aug 16 12:53:23 2017 +0300
@@ -48,6 +48,7 @@
def gen_get_string(delimiter):
STRING_MODEL = re.compile("%(delimiter)s([^%(delimiter)s]*)%(delimiter)s$" % {"delimiter": delimiter})
+
def get_string(v):
result = STRING_MODEL.match(v)
if result is not None:
--- a/editors/ConfTreeNodeEditor.py Wed Aug 16 12:48:08 2017 +0300
+++ b/editors/ConfTreeNodeEditor.py Wed Aug 16 12:53:23 2017 +0300
@@ -315,6 +315,7 @@
else:
button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), button)
# a fancy underline on mouseover
+
def setFontStyle(b, s):
def fn(event):
b.SetFont(s)
@@ -550,6 +551,7 @@
def GetBrowseCallBackFunction(self, name, textctrl, library, value_infos, path):
infos = [value_infos]
+
def OnBrowseButton(event):
dialog = BrowseValuesLibraryDialog(self, name, library, infos[0])
if dialog.ShowModal() == wx.ID_OK:
--- a/editors/Viewer.py Wed Aug 16 12:48:08 2017 +0300
+++ b/editors/Viewer.py Wed Aug 16 12:53:23 2017 +0300
@@ -1589,6 +1589,7 @@
def GetForceVariableMenuFunction(self, iec_path, element):
iec_type = self.GetDataType(iec_path)
+
def ForceVariableFunction(event):
if iec_type is not None:
dialog = ForceVariableDialog(self.ParentWindow, iec_type, str(element.GetValue()))
@@ -1936,6 +1937,7 @@
def GetAddToWireMenuCallBack(self, func, *args):
args += (self.SelectedElement,)
+
def AddToWireMenuCallBack(event):
func(wx.Rect(0, 0, 0, 0), *args)
return AddToWireMenuCallBack
--- a/plcopen/plcopen.py Wed Aug 16 12:48:08 2017 +0300
+++ b/plcopen/plcopen.py Wed Aug 16 12:53:23 2017 +0300
@@ -424,6 +424,7 @@
def gettypeElementFunc(element_type):
elements_xpath = PLCOpen_XPath(
"ppx:types/ppx:%(element_type)ss/ppx:%(element_type)s[@name=$name]" % locals())
+
def gettypeElement(self, name):
elements = elements_xpath(self, name=name)
if len(elements) == 1:
--- a/runtime/PLCObject.py Wed Aug 16 12:48:08 2017 +0300
+++ b/runtime/PLCObject.py Wed Aug 16 12:53:23 2017 +0300
@@ -171,6 +171,7 @@
# If python confnode is not enabled, we reuse _PythonIterator
# as a call that block pythonthread until StopPLC
self.PlcStopping = Event()
+
def PythonIterator(res, blkid):
self.PlcStopping.clear()
self.PlcStopping.wait()
@@ -286,6 +287,7 @@
v = t()
r = self.python_runtime_vars["_PySafeGetPLCGlob_"+name](ctypes.byref(v))
return self.python_runtime_vars["_"+name+"_unpack"](v)
+
def __setattr__(_self, name, value):
try:
t = self.python_runtime_vars["_"+name+"_ctype"]
--- a/xmlclass/xmlclass.py Wed Aug 16 12:48:08 2017 +0300
+++ b/xmlclass/xmlclass.py Wed Aug 16 12:53:23 2017 +0300
@@ -1655,6 +1655,7 @@
def generateSetChoiceByTypeMethod(factory, choice_types):
choices = dict([(choice["name"], choice) for choice in choice_types])
+
def setChoiceMethod(self, content_type):
if not choices.has_key(content_type):
raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type)
@@ -1668,6 +1669,7 @@
def generateAppendChoiceByTypeMethod(maxOccurs, factory, choice_types):
choices = dict([(choice["name"], choice) for choice in choice_types])
+
def appendChoiceMethod(self, content_type):
if not choices.has_key(content_type):
raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type)
@@ -1684,6 +1686,7 @@
def generateInsertChoiceByTypeMethod(maxOccurs, factory, choice_types):
choices = dict([(choice["name"], choice) for choice in choice_types])
+
def insertChoiceMethod(self, index, content_type):
if not choices.has_key(content_type):
raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type)
--- a/xmlclass/xsdschema.py Wed Aug 16 12:48:08 2017 +0300
+++ b/xmlclass/xsdschema.py Wed Aug 16 12:53:23 2017 +0300
@@ -51,6 +51,7 @@
def GenerateFloatXMLText(extra_values=[], decimal=None):
float_format = (lambda x: "{:.{width}f}".format(x, width=decimal).rstrip('0')
if decimal is not None else str)
+
def generateXMLTextMethod(value, name=None, indent=0):
text = ""
if name is not None: