From 6f7d8eabe84273b7a17f057719a37ce6a1fbbdb2 Mon Sep 17 00:00:00 2001 From: Julia Dark <24235303+jp-dark@users.noreply.github.com> Date: Wed, 27 Mar 2024 18:54:19 -0400 Subject: [PATCH] Add back deprecated function `tiledbsoma_build_index` (#2344) * Add back deprecated function `tiledbsoma_build_index` * Add function to __all__ --- apis/python/src/tiledbsoma/__init__.py | 3 ++- apis/python/src/tiledbsoma/_indexer.py | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/apis/python/src/tiledbsoma/__init__.py b/apis/python/src/tiledbsoma/__init__.py index 6e11dea753..337aebce38 100644 --- a/apis/python/src/tiledbsoma/__init__.py +++ b/apis/python/src/tiledbsoma/__init__.py @@ -157,7 +157,7 @@ get_storage_engine, show_package_versions, ) -from ._indexer import IntIndexer +from ._indexer import IntIndexer, tiledbsoma_build_index from ._measurement import Measurement from ._sparse_nd_array import SparseNDArray from .options import SOMATileDBContext, TileDBCreateOptions @@ -193,6 +193,7 @@ "SOMATileDBContext", "SparseNDArray", "TileDBCreateOptions", + "tiledbsoma_build_index", "tiledbsoma_stats_disable", "tiledbsoma_stats_dump", "tiledbsoma_stats_enable", diff --git a/apis/python/src/tiledbsoma/_indexer.py b/apis/python/src/tiledbsoma/_indexer.py index f2e904d999..fdc8d63e95 100644 --- a/apis/python/src/tiledbsoma/_indexer.py +++ b/apis/python/src/tiledbsoma/_indexer.py @@ -6,6 +6,7 @@ import numpy.typing as npt import pandas as pd import pyarrow as pa +from somacore.query.types import IndexLike from tiledbsoma import pytiledbsoma as clib @@ -23,6 +24,26 @@ ] +def tiledbsoma_build_index( + data: IndexerDataType, *, context: Optional["SOMATileDBContext"] = None +) -> IndexLike: + """Initialize re-indexer for provided indices. + + Deprecated. Provides the same functionality as the``IntIndexer`` class. + + Args: + data: + Integer keys used to build the index (hash) table. + context: + ``SOMATileDBContext`` object containing concurrecy level. + + Lifecycle: + Deprecated. + """ + + return IntIndexer(data, context=context) + + class IntIndexer: """A re-indexer for unique integer indices. @@ -33,7 +54,7 @@ class IntIndexer: def __init__( self, data: IndexerDataType, *, context: Optional["SOMATileDBContext"] = None ): - """Initialize re-indexer for provied indices. + """Initialize re-indexer for provided indices. Args: data: