From 6e51e6c563a68356c41e6cea6469b3d24fdf6b4f Mon Sep 17 00:00:00 2001
From: vermeul <swen@ethz.ch>
Date: Tue, 2 Mar 2021 15:22:15 +0100
Subject: [PATCH] added call possibility for properties

---
 pybis/src/python/pybis/property.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/pybis/src/python/pybis/property.py b/pybis/src/python/pybis/property.py
index d1866a27a7f..8bd83a36fe0 100644
--- a/pybis/src/python/pybis/property.py
+++ b/pybis/src/python/pybis/property.py
@@ -50,6 +50,16 @@ class PropertyHolder():
                 props[code] = value
         return props
 
+    def __call__(self, prop, val=None):
+        """Yet another way to set/get the values to a property:
+        sample.props('$name', 'new value')
+        sample.props('$name')  # returns 'new value'
+        """
+        if val is None:
+            return getattr(self, prop)
+        else:
+            setattr(self, prop, val)
+
     def __getitem__(self, key):
         """For properties that contain either a dot or a dash or any other non-valid method character,
         a user can use a key-lookup instead, e.g. sample.props['my-weird.property-name']
-- 
GitLab