From a140fbd9b7e97de9efef8510ba6dc262b89b07a0 Mon Sep 17 00:00:00 2001 From: Sicheng Pan Date: Mon, 9 Dec 2024 15:25:58 -0800 Subject: [PATCH] Rename type --- chromadb/db/impl/grpc/client.py | 6 +++--- chromadb/db/mixins/sysdb.py | 6 +++--- chromadb/db/system.py | 4 ++-- chromadb/segment/impl/manager/distributed.py | 2 +- chromadb/types.py | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/chromadb/db/impl/grpc/client.py b/chromadb/db/impl/grpc/client.py index e01bfd68bff..ea89ef24424 100644 --- a/chromadb/db/impl/grpc/client.py +++ b/chromadb/db/impl/grpc/client.py @@ -35,7 +35,7 @@ from chromadb.telemetry.opentelemetry.grpc import OtelInterceptor from chromadb.types import ( Collection, - CollectionSegments, + CollectionAndSegments, Database, Metadata, OptionalArgument, @@ -367,11 +367,11 @@ def get_collections( raise InternalError() @overrides - def get_collection_with_segments(self, collection_id: UUID) -> CollectionSegments: + def get_collection_with_segments(self, collection_id: UUID) -> CollectionAndSegments: try: request = GetCollectionWithSegmentsRequest(id=collection_id.hex) response: GetCollectionWithSegmentsResponse = self._sys_db_stub.GetCollectionWithSegments(request) - return CollectionSegments( + return CollectionAndSegments( collection=from_proto_collection(response.collection), segments=[from_proto_segment(segment) for segment in response.segments] ) diff --git a/chromadb/db/mixins/sysdb.py b/chromadb/db/mixins/sysdb.py index bd24df187e1..8c7f2b843ee 100644 --- a/chromadb/db/mixins/sysdb.py +++ b/chromadb/db/mixins/sysdb.py @@ -24,7 +24,7 @@ ) from chromadb.ingest import Producer from chromadb.types import ( - CollectionSegments, + CollectionAndSegments, Database, OptionalArgument, Segment, @@ -491,13 +491,13 @@ def get_collections( return collections @override - def get_collection_with_segments(self, collection_id: UUID) -> CollectionSegments: + def get_collection_with_segments(self, collection_id: UUID) -> CollectionAndSegments: collections = self.get_collections(id=collection_id) if len(collections) == 0: raise InvalidCollectionException( f"Collection {collection_id} does not exist." ) - return CollectionSegments( + return CollectionAndSegments( collection=collections[0], segments=self.get_segments(collection=collection_id), ) diff --git a/chromadb/db/system.py b/chromadb/db/system.py index 6a2b9c1b2c9..ec440e836ee 100644 --- a/chromadb/db/system.py +++ b/chromadb/db/system.py @@ -4,7 +4,7 @@ from chromadb.api.configuration import CollectionConfigurationInternal from chromadb.types import ( Collection, - CollectionSegments, + CollectionAndSegments, Database, Tenant, Metadata, @@ -133,7 +133,7 @@ def get_collections( def get_collection_with_segments( self, collection_id: UUID - ) -> CollectionSegments: + ) -> CollectionAndSegments: """Get a consistent snapshot of a collection by id. This will return a collection with segment information that matches the collection version and log position. """ diff --git a/chromadb/segment/impl/manager/distributed.py b/chromadb/segment/impl/manager/distributed.py index 62ccb3114d3..7acdaa4d860 100644 --- a/chromadb/segment/impl/manager/distributed.py +++ b/chromadb/segment/impl/manager/distributed.py @@ -18,7 +18,7 @@ OpenTelemetryGranularity, trace_method, ) -from chromadb.types import Collection, CollectionSegments, Operation, Segment, SegmentScope +from chromadb.types import Collection, CollectionAndSegments, Operation, Segment, SegmentScope class DistributedSegmentManager(SegmentManager): diff --git a/chromadb/types.py b/chromadb/types.py index bffa95878de..363f4cacf83 100644 --- a/chromadb/types.py +++ b/chromadb/types.py @@ -178,7 +178,7 @@ class Segment(TypedDict): metadata: Optional[Metadata] file_paths: Mapping[str, Sequence[str]] -class CollectionSegments(TypedDict): +class CollectionAndSegments(TypedDict): collection: Collection segments: Sequence[Segment]