From 89cc496009a4662946a33f9893a9b16b6e35da92 Mon Sep 17 00:00:00 2001 From: Julia Dark Date: Wed, 27 Mar 2024 17:31:19 -0400 Subject: [PATCH] Add back deprecated function `tiledbsoma_build_index` --- apis/python/src/tiledbsoma/__init__.py | 2 +- apis/python/src/tiledbsoma/_indexer.py | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/apis/python/src/tiledbsoma/__init__.py b/apis/python/src/tiledbsoma/__init__.py index 6e11dea753..d50bb9b792 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 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: