Skip to content

Commit

Permalink
fix rebase confict
Browse files Browse the repository at this point in the history
Signed-off-by: Xianhui.Lin <xianhui.lin@zilliz.com>
  • Loading branch information
JsDove committed Dec 16, 2024
1 parent 2599b7a commit 2da0b19
Showing 1 changed file with 4 additions and 32 deletions.
36 changes: 4 additions & 32 deletions pymilvus/client/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,10 @@ def __init__(self, info: Any) -> None:
def __str__(self) -> str:
return f"DatabaseInfo(name={self.name}, properties={self.properties})"

def to_dict(self) -> Dict[str, Any]:
"""Converts the DatabaseInfo instance to a dictionary."""
return {"name": self.name, "properties": self.properties}


class ExtraList(list):
"""
Expand Down Expand Up @@ -1013,35 +1017,3 @@ def get_cost_extra(status: Optional[common_pb2.Status] = None):
# Construct extra dict, the cost unit is the vcu, similar to tokenlike the
def construct_cost_extra(cost: int):
return {"cost": cost}

class DatabaseInfo:
"""
Represents the information of a database.
Atributes:
name (str): The name of the database.
properties (dict): The properties of the database.
Example:
DatabaseInfo(name="test_db", id=1, properties={"key": "value"})
"""

@property
def name(self) -> str:
return self._name

@property
def properties(self) -> Dict:
return self._properties

def __init__(self, info: Any) -> None:
self._name = info.db_name
self._properties = {}

for p in info.properties:
self.properties[p.key] = p.value

def __str__(self) -> str:
return f"DatabaseInfo(name={self.name}, properties={self.properties})"

def to_dict(self) -> Dict[str, Any]:
"""Converts the DatabaseInfo instance to a dictionary."""
return {"name": self.name, "properties": self.properties}

0 comments on commit 2da0b19

Please sign in to comment.