From 469e25fdbb03fa4ee66d2e80c1a389d5688b0121 Mon Sep 17 00:00:00 2001 From: Xin Hao Date: Fri, 5 Jan 2024 21:04:18 +0800 Subject: [PATCH 1/2] Make tag param optional for Node properties method (#302) * Make tag param optional for Node properties method * lint --- 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..c97bcc2b 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 fce0b09b4e3ffe8c04d9d1df214351fbb64ecd24 Mon Sep 17 00:00:00 2001 From: Xin Hao Date: Mon, 8 Jan 2024 09:38:59 +0800 Subject: [PATCH 2/2] feat: Add get_prop_names methods for scan results (#297) * feat: Add get_prop_names methods for scan results * tests: Add more Python versions * fix Python test version 3.10 * Update dev.txt * Drop Python 3.6 3.7 3.8 --- .github/workflows/run_test.yaml | 4 ++-- nebula3/sclient/BaseResult.py | 14 ++++++++++++++ requirements/dev.txt | 19 +++++-------------- setup.py | 2 +- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/run_test.yaml b/.github/workflows/run_test.yaml index 89bf4866..ce790c10 100644 --- a/.github/workflows/run_test.yaml +++ b/.github/workflows/run_test.yaml @@ -14,7 +14,7 @@ jobs: strategy: max-parallel: 2 matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.9, '3.10', 3.11, 3.12] steps: - name: Maximize runner space @@ -24,7 +24,7 @@ jobs: remove-dotnet: 'true' remove-android: 'true' remove-haskell: 'true' - + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 diff --git a/nebula3/sclient/BaseResult.py b/nebula3/sclient/BaseResult.py index 28c7446a..38236582 100644 --- a/nebula3/sclient/BaseResult.py +++ b/nebula3/sclient/BaseResult.py @@ -81,6 +81,13 @@ def as_node(self): return Node(vertex).set_decode_type(self._decode_type) + def get_prop_names(self): + """get all prop names from the vertex data + + :return: list + """ + return self._col_names[self.PROP_START_INDEX :] + def get_prop_values(self): """get all prop values from the vertex data @@ -197,6 +204,13 @@ def as_relationship(self): return Relationship(edge).set_decode_type(self._decode_type) + def get_prop_names(self): + """get all prop names from the edge data + + :return: list + """ + return self._col_names[self.PROP_START_INDEX :] + def get_prop_values(self): """get all prop values from the edge data diff --git a/requirements/dev.txt b/requirements/dev.txt index f4e2f5ad..187b4d3c 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,10 +1,9 @@ # -# This file is autogenerated by pip-compile with Python 3.9 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # pip-compile requirements/dev.in # - attrs==23.1.0 # via pytest build==1.0.3 @@ -12,12 +11,12 @@ build==1.0.3 click==8.1.7 # via pip-tools coverage[toml]==7.2.7 - # via pytest-cov -importlib-metadata==6.7.0 - # via build + # via + # coverage + # pytest-cov iniconfig==2.0.0 # via pytest -numpy==1.21.6 +numpy==1.26.3 # via pandas packaging==23.2 # via @@ -49,18 +48,10 @@ six==1.16.0 # via python-dateutil toml==0.10.2 # via pytest -tomli==2.0.1 - # via - # build - # coverage - # pip-tools - # pyproject-hooks wcwidth==0.2.8 # via prettytable wheel==0.41.2 # via pip-tools -zipp==3.15.0 - # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/setup.py b/setup.py index 2e282025..7bc39bea 100644 --- a/setup.py +++ b/setup.py @@ -29,6 +29,6 @@ 'pytz >= 2021.1', ], packages=find_packages(), - platforms=['3.6, 3.7'], + platforms=['3.9, 3.10, 3.11, 3.12'], package_dir={'nebula3': 'nebula3'}, )