merge
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Thu, 18 Oct 2018 18:37:01 +0200
changeset 2315 523559fe6352
parent 2309 d8fb90a2e11f (diff)
parent 2314 e927c101ce6d (current diff)
child 2317 b7330f3461dd
merge
Beremiz_service.py
runtime/PyroServer.py
runtime/WampClient.py
--- a/BeremizIDE.py	Thu Oct 18 13:17:48 2018 +0200
+++ b/BeremizIDE.py	Thu Oct 18 18:37:01 2018 +0200
@@ -25,6 +25,7 @@
 
 
 from __future__ import absolute_import
+from __future__ import print_function
 import os
 import sys
 import tempfile
--- a/Beremiz_service.py	Thu Oct 18 13:17:48 2018 +0200
+++ b/Beremiz_service.py	Thu Oct 18 18:37:01 2018 +0200
@@ -388,6 +388,7 @@
         res = (None, sys.exc_info())
     return res
 
+
 if enabletwisted:
     import warnings
     with warnings.catch_warnings():
@@ -440,6 +441,7 @@
 
 # Exception hooks
 
+
 def LogException(*exp):
     LogMessageAndException("", exp)
 
--- a/bacnet/bacnet.py	Thu Oct 18 13:17:48 2018 +0200
+++ b/bacnet/bacnet.py	Thu Oct 18 18:37:01 2018 +0200
@@ -416,7 +416,7 @@
             self.ObjTables["MSO_Obj"].ChangesToSave = False
             self.ObjTables["MSI_Obj"].ChangesToSave = False
             return True
-        except:
+        except Exception:
             return _("Unable to save to file \"%s\"!") % filepath
 
     def LoadFromFile(self, filepath):
@@ -426,7 +426,7 @@
             self.ObjTablesData = pickle.load(fd)
             fd.close()
             return True
-        except:
+        except Exception:
             return _("Unable to load file \"%s\"!") % filepath
 
     def _ExportBacnetSlave(self):
--- a/runtime/PLCObject.py	Thu Oct 18 13:17:48 2018 +0200
+++ b/runtime/PLCObject.py	Thu Oct 18 18:37:01 2018 +0200
@@ -23,7 +23,7 @@
 
 
 from __future__ import absolute_import
-from threading import Thread, Lock, Semaphore, Event, Condition
+from threading import Thread, Lock, Semaphore, Event
 import ctypes
 import os
 import sys
@@ -60,7 +60,6 @@
     sys.stdout.flush()
 
 
-
 def RunInMain(func):
     def func_wrapper(*args, **kwargs):
         return MainWorker.call(func, *args, **kwargs)
--- a/runtime/PyroServer.py	Thu Oct 18 13:17:48 2018 +0200
+++ b/runtime/PyroServer.py	Thu Oct 18 18:37:01 2018 +0200
@@ -9,6 +9,8 @@
 
 # See COPYING file for copyrights details.
 
+from __future__ import absolute_import
+from __future__ import print_function
 import sys
 
 import Pyro
@@ -16,6 +18,7 @@
 import runtime
 from runtime.ServicePublisher import ServicePublisher
 
+
 class Server(object):
     def __init__(self, servicename, ip_addr, port):
         self.continueloop = True
@@ -47,8 +50,8 @@
             # taking too small timeout value may cause
             # unwanted diconnection when IDE is kept busy for long periods
             self.daemon.setTimeout(60)
-	
-            pyro_obj=Pyro.core.ObjBase()
+
+            pyro_obj = Pyro.core.ObjBase()
             pyro_obj.delegateTo(runtime.GetPLCObjectSingleton())
 
             self.daemon.connect(pyro_obj, "PLCObject")
@@ -73,6 +76,3 @@
             self.servicepublisher.UnRegisterService()
             self.servicepublisher = None
         self.daemon.shutdown(True)
-
-
-
--- a/runtime/WampClient.py	Thu Oct 18 13:17:48 2018 +0200
+++ b/runtime/WampClient.py	Thu Oct 18 18:37:01 2018 +0200
@@ -148,6 +148,7 @@
         ID = self.config.extra["ID"]
         self.publish(unicode(ID+'.'+eventID), value)
 
+
 class ReconnectingWampWebSocketClientFactory(WampWebSocketClientFactory, ReconnectingClientFactory):
 
     def __init__(self, config, *args, **kwargs):
@@ -343,13 +344,16 @@
     global _PySrv
     _PySrv = pysrv
 
+
 def PublishEvent(eventID, value):
     if getWampStatus() == "Attached":
-         _WampSession.publish(eventID, value)
+        _WampSession.publish(eventID, value)
+
 
 def PublishEventWithOwnID(eventID, value):
     if getWampStatus() == "Attached":
-         _WampSession.publishWithOwnID(eventID, value)
+        _WampSession.publishWithOwnID(eventID, value)
+
 
 # WEB CONFIGURATION INTERFACE
 WAMP_SECRET_URL = "secret"
--- a/runtime/Worker.py	Thu Oct 18 13:17:48 2018 +0200
+++ b/runtime/Worker.py	Thu Oct 18 18:37:01 2018 +0200
@@ -12,6 +12,7 @@
 import thread
 from threading import Lock, Condition
 
+
 class job(object):
     """
     job to be executed by a worker
--- a/runtime/__init__.py	Thu Oct 18 13:17:48 2018 +0200
+++ b/runtime/__init__.py	Thu Oct 18 18:37:01 2018 +0200
@@ -2,23 +2,25 @@
 # -*- coding: utf-8 -*-
 
 from __future__ import absolute_import
+from __future__ import print_function
 import traceback
+import sys
 
 from runtime.Worker import worker
 MainWorker = worker()
 
-from runtime.PLCObject import PLCObject
+from runtime.PLCObject import PLCObject  # noqa # pylint: disable=wrong-import-position
+
 
 _PLCObjectSingleton = None
 
+
 def GetPLCObjectSingleton():
-    global _PLCObjectSingleton
-    assert(_PLCObjectSingleton is not None)
+    assert _PLCObjectSingleton is not None
     return _PLCObjectSingleton
 
 
 def LogMessageAndException(msg, exp=None):
-    global _PLCObjectSingleton
     if exp is None:
         exp = sys.exc_info()
     if _PLCObjectSingleton is not None:
@@ -26,6 +28,7 @@
     print(msg)
     traceback.print_exception(*exp)
 
-def CreatePLCObjectSingleton(*args):
+
+def CreatePLCObjectSingleton(*args, **kwargs):
     global _PLCObjectSingleton
-    _PLCObjectSingleton = PLCObject(*args)
+    _PLCObjectSingleton = PLCObject(*args, **kwargs)