From 73d66b2bc3074052848914712cfbc114ecf88573 Mon Sep 17 00:00:00 2001
From: System User <operateur@rcm1.rcm>
Date: Tue, 27 Jul 2021 13:52:09 +0200
Subject: [PATCH] Initial commit of environment

---
 OpUtils.py   | 36 ++++++++++++++++++++++++++++++++++++
 pyprompt.ipy | 17 +++++++++++++++++
 2 files changed, 53 insertions(+)
 create mode 100644 OpUtils.py
 create mode 100644 pyprompt.ipy

diff --git a/OpUtils.py b/OpUtils.py
new file mode 100644
index 0000000..302aae6
--- /dev/null
+++ b/OpUtils.py
@@ -0,0 +1,36 @@
+# Module OpUtils
+# Usefull function for operation
+
+
+
+###############################################################################
+# FUNCTIONS ON DEVICE PROXY
+###############################################################################
+
+def searchattr(prx, attr, ignorecase=True):
+    """
+    Search in a tango device proxy for an attribute name.
+
+    PARAMETERS
+    ----------
+    prx: tango.DeviceProxy
+        Proxy to the device.
+
+    attr: string
+        String to search for.
+
+    ignorecase: bool
+        Case insensitive.
+    """
+    if ignorecase:
+        return [a for a in prx.get_attribute_list() if attr.lower() in a.lower()]
+    else:
+        return [a for a in prx.get_attribute_list() if attr in a]
+
+###############################################################################
+# FUNCTIONS ON TANGO DATABASE
+###############################################################################
+
+###############################################################################
+# FUNCTIONS ON ARCHIVER
+###############################################################################
diff --git a/pyprompt.ipy b/pyprompt.ipy
new file mode 100644
index 0000000..58b649c
--- /dev/null
+++ b/pyprompt.ipy
@@ -0,0 +1,17 @@
+# IPython prompt initialization for operation
+
+# Turn automagic on
+# This gives the possibility to use magic command without '%'.
+# i.e. cd, pwd, ...
+%automagic on
+
+
+# Import usefull packages
+import PyTango as tango
+import numpy as np
+import OpUtils as OU
+print("Imported: tango, np, OU")
+
+# Create a database object
+DB = tango.Database()
+print("Object DB created: tango database")
-- 
GitLab