From 50003059b44dcfb4bb2a7aa4209018743ec3da82 Mon Sep 17 00:00:00 2001 From: Yang Xuan Date: Wed, 12 Jun 2019 10:26:14 +0800 Subject: [PATCH] feat(python): add python version support, delete LICENSE Former-commit-id: 1bea25c86f112328f874fb03803504e02a1221dc --- python/sdk/LICENSE | 21 --------------------- python/sdk/client/Client.py | 9 +++++---- python/sdk/examples/example.py | 3 ++- python/sdk/pytest.ini | 2 +- python/sdk/setup.py | 9 ++++++--- python/sdk/tests/TestClient.py | 2 +- 6 files changed, 15 insertions(+), 31 deletions(-) delete mode 100644 python/sdk/LICENSE diff --git a/python/sdk/LICENSE b/python/sdk/LICENSE deleted file mode 100644 index 44fe606a..00000000 --- a/python/sdk/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 上海赜睿信息科技有限公司(Zilliz) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/python/sdk/client/Client.py b/python/sdk/client/Client.py index a3b56247..cc3d69ba 100644 --- a/python/sdk/client/Client.py +++ b/python/sdk/client/Client.py @@ -34,10 +34,10 @@ class Prepare(object): @classmethod def table_schema(cls, - table_name, *, + table_name, dimension, - index_type, - store_raw_vector): + index_type=IndexType.INVALIDE, + store_raw_vector = False): """ :param table_name: str, (Required) name of table @@ -206,7 +206,8 @@ class MegaSearch(ConnectIntf): if top_k_query_results: for top_k in top_k_query_results: - res.append(TopKQueryResult([QueryResult(qr.id, qr.score) + if top_k: + res.append(TopKQueryResult([QueryResult(qr.id, qr.score) for qr in top_k.query_result_arrays])) except (TApplicationException, TException) as e: diff --git a/python/sdk/examples/example.py b/python/sdk/examples/example.py index 45de4fbb..ec478edc 100644 --- a/python/sdk/examples/example.py +++ b/python/sdk/examples/example.py @@ -10,7 +10,8 @@ def main(): print('# Client version: {}'.format(mega.client_version())) # Connect - param = {'host': '192.168.1.129', 'port': '33001'} + # Please change HOST and PORT to correct one + param = {'host': 'HOST', 'port': 'PORT'} cnn_status = mega.connect(**param) print('# Connect Status: {}'.format(cnn_status)) diff --git a/python/sdk/pytest.ini b/python/sdk/pytest.ini index ffc723ad..3aebf092 100644 --- a/python/sdk/pytest.ini +++ b/python/sdk/pytest.ini @@ -2,4 +2,4 @@ log_format = [%(asctime)s-%(levelname)s-%(name)s]: %(message)s (%(filename)s:%(lineno)s) log_cli = true -log_level = 30 \ No newline at end of file +log_level = 20 \ No newline at end of file diff --git a/python/sdk/setup.py b/python/sdk/setup.py index 3d40338b..176661cd 100644 --- a/python/sdk/setup.py +++ b/python/sdk/setup.py @@ -1,6 +1,5 @@ import setuptools -# TODO long_description = '' setuptools.setup( @@ -11,8 +10,12 @@ setuptools.setup( description="Sdk for using MegaSearch", packages=setuptools.find_packages(), classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", "Operating System :: OS Independent", ], + + + python_requires='>=3.4' ) \ No newline at end of file diff --git a/python/sdk/tests/TestClient.py b/python/sdk/tests/TestClient.py index bc6dd550..aef507bb 100644 --- a/python/sdk/tests/TestClient.py +++ b/python/sdk/tests/TestClient.py @@ -211,7 +211,7 @@ class TestVector: table_name = fake.table_name() res, table_schema = client.describe_table(table_name) assert res == Status.SUCCESS - assert isinstance(table_schema, TableSchema) + assert isinstance(table_schema, ttypes.TableSchema) def test_false_decribe_table(self, client): table_name = fake.table_name() -- GitLab