From ba7dde1b0927fff307ebc304882ac3a2203ed19f Mon Sep 17 00:00:00 2001 From: Xin Hao Date: Fri, 5 Jan 2024 16:47:34 +0800 Subject: [PATCH 1/2] Make tag param optional for Node properties method --- nebula3/data/DataObject.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nebula3/data/DataObject.py b/nebula3/data/DataObject.py index a66b824c..0380fa03 100644 --- a/nebula3/data/DataObject.py +++ b/nebula3/data/DataObject.py @@ -1399,12 +1399,18 @@ def has_tag(self, tag): """ return True if tag in self._tag_indexes.keys() else False - def properties(self, tag): + def properties(self, tag = None): """get all properties of the specified tag :param tag: the tag name :return: the properties """ + if tag is None: + if len(self.tags) == 1: + tag = self.tags[0] + else: + raise InvalidKeyException("tag name is required") + if tag not in self._tag_indexes.keys(): raise InvalidKeyException(tag) From b211826f90b1b9301360a2392dd24f6559ee2ac8 Mon Sep 17 00:00:00 2001 From: Xin Hao Date: Fri, 5 Jan 2024 17:09:29 +0800 Subject: [PATCH 2/2] lint --- nebula3/data/DataObject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nebula3/data/DataObject.py b/nebula3/data/DataObject.py index 0380fa03..c97bcc2b 100644 --- a/nebula3/data/DataObject.py +++ b/nebula3/data/DataObject.py @@ -1399,7 +1399,7 @@ def has_tag(self, tag): """ return True if tag in self._tag_indexes.keys() else False - def properties(self, tag = None): + def properties(self, tag=None): """get all properties of the specified tag :param tag: the tag name