Skip to content

Commit

Permalink
Style & Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atroyn committed Oct 19, 2024
1 parent 64e0c52 commit b91c9e5
Show file tree
Hide file tree
Showing 19 changed files with 931 additions and 673 deletions.
24 changes: 12 additions & 12 deletions chromadb/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ def _get(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where: Optional[Where] = None,
sort: Optional[str] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
where_document: Optional[WhereDocument] = {},
where_document: Optional[WhereDocument] = None,
include: Include = IncludeMetadataDocumentsEmbeddings,
) -> GetResult:
"""[Internal] Returns entries from a collection specified by UUID.
Expand All @@ -253,8 +253,8 @@ def _delete(
self,
collection_id: UUID,
ids: Optional[IDs],
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
) -> None:
"""[Internal] Deletes entries from a collection specified by UUID.
Expand All @@ -275,8 +275,8 @@ def _query(
collection_id: UUID,
query_embeddings: Embeddings,
n_results: int = 10,
where: Where = {},
where_document: WhereDocument = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
include: Include = IncludeMetadataDocumentsEmbeddingsDistances,
) -> QueryResult:
"""[Internal] Performs a nearest neighbors query on a collection specified by UUID.
Expand Down Expand Up @@ -643,13 +643,13 @@ def _get(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where: Optional[Where] = None,
sort: Optional[str] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
where_document: Optional[WhereDocument] = {},
where_document: Optional[WhereDocument] = None,
include: Include = ["metadatas", "documents"], # type: ignore[list-item]
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
Expand Down Expand Up @@ -708,8 +708,8 @@ def _query(
collection_id: UUID,
query_embeddings: Embeddings,
n_results: int = 10,
where: Where = {},
where_document: WhereDocument = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
include: Include = ["metadatas", "documents", "distances"], # type: ignore[list-item]
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
Expand All @@ -722,8 +722,8 @@ def _delete(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
) -> None:
Expand Down
24 changes: 12 additions & 12 deletions chromadb/api/async_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ async def _get(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where: Optional[Where] = None,
sort: Optional[str] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
where_document: Optional[WhereDocument] = {},
where_document: Optional[WhereDocument] = None,
include: Include = ["embeddings", "metadatas", "documents"], # type: ignore[list-item]
) -> GetResult:
"""[Internal] Returns entries from a collection specified by UUID.
Expand All @@ -244,8 +244,8 @@ async def _delete(
self,
collection_id: UUID,
ids: Optional[IDs],
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
) -> None:
"""[Internal] Deletes entries from a collection specified by UUID.
Expand All @@ -266,8 +266,8 @@ async def _query(
collection_id: UUID,
query_embeddings: Embeddings,
n_results: int = 10,
where: Where = {},
where_document: WhereDocument = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
include: Include = ["embeddings", "metadatas", "documents", "distances"], # type: ignore[list-item]
) -> QueryResult:
"""[Internal] Performs a nearest neighbors query on a collection specified by UUID.
Expand Down Expand Up @@ -634,13 +634,13 @@ async def _get(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where: Optional[Where] = None,
sort: Optional[str] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
where_document: Optional[WhereDocument] = {},
where_document: Optional[WhereDocument] = None,
include: Include = ["metadatas", "documents"], # type: ignore[list-item]
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
Expand Down Expand Up @@ -699,8 +699,8 @@ async def _query(
collection_id: UUID,
query_embeddings: Embeddings,
n_results: int = 10,
where: Where = {},
where_document: WhereDocument = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
include: Include = ["metadatas", "documents", "distances"], # type: ignore[list-item]
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
Expand All @@ -713,8 +713,8 @@ async def _delete(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
) -> None:
Expand Down
12 changes: 6 additions & 6 deletions chromadb/api/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,13 @@ async def _get(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where: Optional[Where] = None,
sort: Optional[str] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
where_document: Optional[WhereDocument] = {},
where_document: Optional[WhereDocument] = None,
include: Include = ["embeddings", "metadatas", "documents"], # type: ignore[list-item]
) -> GetResult:
return await self._server._get(
Expand All @@ -384,8 +384,8 @@ async def _delete(
self,
collection_id: UUID,
ids: Optional[IDs],
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
) -> None:
await self._server._delete(
collection_id=collection_id,
Expand All @@ -402,8 +402,8 @@ async def _query(
collection_id: UUID,
query_embeddings: Embeddings,
n_results: int = 10,
where: Where = {},
where_document: WhereDocument = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
include: Include = ["embeddings", "metadatas", "documents", "distances"], # type: ignore[list-item]
) -> QueryResult:
return await self._server._query(
Expand Down
12 changes: 6 additions & 6 deletions chromadb/api/async_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,13 @@ async def _get(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where: Optional[Where] = None,
sort: Optional[str] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
where_document: Optional[WhereDocument] = {},
where_document: Optional[WhereDocument] = None,
include: Include = ["metadatas", "documents"], # type: ignore[list-item]
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
Expand Down Expand Up @@ -414,8 +414,8 @@ async def _delete(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
) -> None:
Expand Down Expand Up @@ -545,8 +545,8 @@ async def _query(
collection_id: UUID,
query_embeddings: Embeddings,
n_results: int = 10,
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
include: Include = ["metadatas", "documents", "distances"], # type: ignore[list-item]
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
Expand Down
12 changes: 6 additions & 6 deletions chromadb/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,13 @@ def _get(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where: Optional[Where] = None,
sort: Optional[str] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
where_document: Optional[WhereDocument] = {},
where_document: Optional[WhereDocument] = None,
include: Include = ["embeddings", "metadatas", "documents"], # type: ignore[list-item]
) -> GetResult:
return self._server._get(
Expand All @@ -346,8 +346,8 @@ def _delete(
self,
collection_id: UUID,
ids: Optional[IDs],
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
) -> None:
self._server._delete(
collection_id=collection_id,
Expand All @@ -364,8 +364,8 @@ def _query(
collection_id: UUID,
query_embeddings: Embeddings,
n_results: int = 10,
where: Where = {},
where_document: WhereDocument = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
include: Include = ["embeddings", "metadatas", "documents", "distances"], # type: ignore[list-item]
) -> QueryResult:
return self._server._query(
Expand Down
12 changes: 6 additions & 6 deletions chromadb/api/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,13 @@ def _get(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where: Optional[Where] = None,
sort: Optional[str] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
where_document: Optional[WhereDocument] = {},
where_document: Optional[WhereDocument] = None,
include: Include = ["metadatas", "documents"], # type: ignore[list-item]
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
Expand Down Expand Up @@ -372,8 +372,8 @@ def _delete(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
) -> None:
Expand Down Expand Up @@ -518,8 +518,8 @@ def _query(
collection_id: UUID,
query_embeddings: Embeddings,
n_results: int = 10,
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
include: Include = ["metadatas", "documents", "distances"], # type: ignore[list-item]
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
Expand Down
Loading

0 comments on commit b91c9e5

Please sign in to comment.