From a2a77f98c89c97a88f9dbda689309ed61b49399c Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Sun, 30 Apr 2023 22:36:06 +0200
Subject: [PATCH] Fixes deprecation

---
 ohmpi.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ohmpi.py b/ohmpi.py
index a72513a2..3ef668a4 100644
--- a/ohmpi.py
+++ b/ohmpi.py
@@ -153,12 +153,12 @@ class OhmPi(object):
                 self.controller = None
                 self.exec_logger.warning('No connection to control broker.'
                                          ' Use python/ipython to interact with OhmPi object...')
-            self.get_deprecated_methods()
 
-    def get_deprecated_methods(self):
+    @classmethod
+    def get_deprecated_methods(cls):
         for i in getmembers(deprecated, isfunction):
-            self.exec_logger.debug(f'Adding deprecated method {i[0]}.')
-            setattr(self, i[0], i[1])
+            print(f'Adding {i[0]} (deprecated)')
+            setattr(cls, i[0], i[1])
 
     @staticmethod
     def append_and_save(filename: str, last_measurement: dict, cmd_id=None):
@@ -1243,6 +1243,7 @@ print(f'local date and time : {current_time.strftime("%Y-%m-%d %H:%M:%S")}')
 
 # for testing
 if __name__ == "__main__":
+    OhmPi.get_deprecated_methods()
     ohmpi = OhmPi(settings=OHMPI_CONFIG['settings'])
     if ohmpi.controller is not None:
         ohmpi.controller.loop_forever()
-- 
GitLab