Skip to content

Commit

Permalink
Correct typing
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenv committed Nov 7, 2023
1 parent 63208a0 commit 4477714
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 0 additions & 2 deletions apis/python/src/tiledbsoma/_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@
from typing_extensions import Self

from . import _funcs, _tdb_handles
from . import pytiledbsoma as clib
from ._common_nd_array import NDArray
from ._dataframe import DataFrame
from ._dense_nd_array import DenseNDArray
from ._exception import SOMAError, is_does_not_exist_error
from ._sparse_nd_array import SparseNDArray
from ._tdb_handles import DataFrameWrapper
from ._tiledb_object import AnyTileDBObject, TileDBObject
from ._types import OpenTimestamp
from ._util import (
Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
from somacore import options
from typing_extensions import Self

from . import _arrow_types, _util, pytiledbsoma as clib
from . import _arrow_types, _util
from . import pytiledbsoma as clib
from ._constants import SOMA_JOINID
from ._query_condition import QueryCondition
from ._read_iters import TableReadIter
Expand Down
1 change: 1 addition & 0 deletions apis/python/src/tiledbsoma/_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def open(
obj.close()
raise


def _open_internal(
opener: Callable[
[str, options.OpenMode, SOMATileDBContext, Optional[OpenTimestamp]], _Wrapper
Expand Down
10 changes: 9 additions & 1 deletion apis/python/src/tiledbsoma/_tdb_handles.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from somacore import options
from typing_extensions import Literal, Self

from . import _tdb_handles
from . import pytiledbsoma as clib
from ._exception import DoesNotExistError, SOMAError, is_does_not_exist_error
from ._types import OpenTimestamp
Expand Down Expand Up @@ -64,7 +65,13 @@ def open(
return GroupWrapper.open(uri, mode, context, timestamp)
raise SOMAError(f"{uri!r} has unknown storage type {obj_type!r}")

def _get_wrapper(uri: str, mode: options.OpenMode, context: SOMATileDBContext, timestamp: OpenTimestamp):

def _get_wrapper(
uri: str,
mode: options.OpenMode,
context: SOMATileDBContext,
timestamp: Optional[OpenTimestamp] = None,
) -> _tdb_handles.DataFrameWrapper:
open_mode = clib.OpenMode.read if mode == "r" else clib.OpenMode.write
config = {k: str(v) for k, v in context.tiledb_config.items()}
timestamp_ms = context._open_timestamp_ms(timestamp)
Expand All @@ -74,6 +81,7 @@ def _get_wrapper(uri: str, mode: options.OpenMode, context: SOMATileDBContext, t
else:
raise SOMAError(f"clib.SOMAObject {obj.type!r} not yet supported")


@attrs.define(eq=False, hash=False, slots=False)
class Wrapper(Generic[_RawHdl_co], metaclass=abc.ABCMeta):
"""Wrapper for TileDB handles to manage lifecycle and metadata.
Expand Down

0 comments on commit 4477714

Please sign in to comment.