Skip to content

Commit afc90b9

Browse files
Bennuroot
authored andcommitted
Modify the code style for milvus_helper.py
Signed-off-by: Bennu <[email protected]>
1 parent b3af33a commit afc90b9

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

recserving/milvus_tool/milvus_helper.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
from milvus import Milvus, IndexType
216
from config import MILVUS_HOST, MILVUS_PORT, collection_param
317
import sys
@@ -7,7 +21,8 @@ class MilvusHelper():
721
def __init__(self):
822
try:
923
self.client = Milvus(host=MILVUS_HOST, port=MILVUS_PORT)
10-
print("Successfully connect to Milvus with IP:{} and PORT:{}".format(MILVUS_HOST, MILVUS_PORT))
24+
print("Successfully connect to Milvus with IP:{} and PORT:{}".
25+
format(MILVUS_HOST, MILVUS_PORT))
1126
except Exception as e:
1227
print("Failed to connect Milvus: {}".format(e))
1328
sys.exit(1)
@@ -34,7 +49,8 @@ def creat_collection(self, collection_name):
3449
def delete_collection(self, collection_name):
3550
try:
3651
if self.has_collection(collection_name):
37-
status = self.client.drop_collection(collection_name=collection_name)
52+
status = self.client.drop_collection(
53+
collection_name=collection_name)
3854
print(status)
3955
else:
4056
print("collection {} doesn't exist".format(collection_name))
@@ -45,7 +61,8 @@ def delete_collection(self, collection_name):
4561
def count(self, collection_name):
4662
try:
4763
if self.has_collection(collection_name):
48-
status, num = self.client.count_entities(collection_name=collection_name)
64+
status, num = self.client.count_entities(
65+
collection_name=collection_name)
4966
return num
5067
else:
5168
print("collection {} doesn't exist".format(collection_name))

0 commit comments

Comments
 (0)