Skip to content

Commit

Permalink
Add default values to Pop to prevent exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: zhenshan.cao <[email protected]>
  • Loading branch information
czs007 committed Nov 25, 2024
1 parent 89cf1a9 commit 635dbe6
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 54 deletions.
96 changes: 48 additions & 48 deletions pymilvus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,65 +72,65 @@
from .settings import Config as DefaultConfig

__all__ = [
"AnnSearchRequest",
"BulkInsertState",
"Collection",
"CollectionSchema",
"Connections",
"DataType",
"DefaultConfig",
"ExceptionsMessage",
"FieldSchema",
"Function",
"FunctionType",
"Group",
"Hit",
"Hits",
"Index",
"IndexType",
"Milvus",
"MilvusClient",
"MilvusException",
"MilvusUnavailableException",
"MutationFuture",
"Partition",
"Prepare",
"RRFRanker",
"Replica",
"ResourceGroupInfo",
"Role",
"SearchFuture",
"SearchResult",
"Shard",
"Status",
"WeightedRanker",
"__version__",
"connections",
"loading_progress",
"index_building_progress",
"wait_for_index_building_complete",
"create_resource_group",
"create_user",
"db",
"delete_user",
"describe_resource_group",
"drop_collection",
"drop_resource_group",
"has_collection",
"list_collections",
"wait_for_loading_complete",
"has_partition",
"hybridts_to_datetime",
"hybridts_to_unixtime",
"index_building_progress",
"list_collections",
"list_resource_groups",
"list_usernames",
"loading_progress",
"mkts_from_datetime",
"mkts_from_hybridts",
"mkts_from_unixtime",
"mkts_from_datetime",
"hybridts_to_unixtime",
"hybridts_to_datetime",
"reset_password",
"create_user",
"transfer_node",
"transfer_replica",
"update_password",
"update_resource_groups",
"delete_user",
"list_usernames",
"SearchResult",
"Hits",
"Hit",
"Replica",
"Group",
"Shard",
"FieldSchema",
"Function",
"CollectionSchema",
"SearchFuture",
"MutationFuture",
"utility",
"db",
"DefaultConfig",
"Role",
"ExceptionsMessage",
"MilvusUnavailableException",
"BulkInsertState",
"create_resource_group",
"drop_resource_group",
"describe_resource_group",
"list_resource_groups",
"transfer_node",
"transfer_replica",
"Milvus",
"Prepare",
"Status",
"DataType",
"FunctionType",
"MilvusException",
"__version__",
"MilvusClient",
"ResourceGroupInfo",
"Connections",
"IndexType",
"AnnSearchRequest",
"RRFRanker",
"WeightedRanker",
"wait_for_index_building_complete",
"wait_for_loading_complete",
]
8 changes: 4 additions & 4 deletions pymilvus/bulk_writer/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ def append_row(self, row: dict):
if DYNAMIC_FIELD_NAME in row and not isinstance(row[DYNAMIC_FIELD_NAME], dict):
self._throw(f"Dynamic field '{DYNAMIC_FIELD_NAME}' value should be JSON format")

for k in row:
for k, v in row.items():
if k == DYNAMIC_FIELD_NAME:
dynamic_values.update(row[k])
dynamic_values.update(v)
continue

if k not in self._buffer:
dynamic_values[k] = self._raw_obj(row[k])
dynamic_values[k] = self._raw_obj(v)
else:
self._buffer[k].append(row[k])
self._buffer[k].append(v)

if DYNAMIC_FIELD_NAME in self._buffer:
self._buffer[DYNAMIC_FIELD_NAME].append(dynamic_values)
Expand Down
2 changes: 1 addition & 1 deletion pymilvus/client/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def is_legal_round_decimal(round_decimal: Any) -> bool:


def is_legal_guarantee_timestamp(ts: Any) -> bool:
return ts is None or isinstance(ts, int) and ts >= 0
return (ts is None) or (isinstance(ts, int) and ts >= 0)


def is_legal_user(user: Any) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion pymilvus/client/grpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def delete(
)
future = self._stub.Delete.future(req, timeout=timeout)
if kwargs.get("_async", False):
cb = kwargs.pop("_callback")
cb = kwargs.pop("_callback", None)
f = MutationFuture(future, cb, timeout=timeout, **kwargs)
f.add_callback(ts_utils.update_ts_on_mutation(collection_name))
return f
Expand Down

0 comments on commit 635dbe6

Please sign in to comment.