Skip to content

Commit

Permalink
Remove deprecations (#2050)
Browse files Browse the repository at this point in the history
  • Loading branch information
kounelisagis authored Aug 29, 2024
1 parent 2dc7562 commit e717557
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 304 deletions.
1 change: 0 additions & 1 deletion tiledb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
from .fragment import (
FragmentInfo,
FragmentInfoList,
FragmentsInfo,
copy_fragments_to_existing_array,
create_array_from_fragments,
)
Expand Down
23 changes: 0 additions & 23 deletions tiledb/filestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,29 +142,6 @@ def copy_to(

lt.Filestore._uri_export(ctx, filestore_array_uri, file_uri)

def uri_import(self, file_uri: str, mime_type: str = "AUTODETECT") -> None:
warnings.warn(
"Filestore.uri_import is deprecated; please use Filestore.copy_from",
DeprecationWarning,
)

if not isinstance(file_uri, str):
raise TypeError(
f"Unexpected file_uri type '{type(file_uri)}': expected str"
)

if not isinstance(mime_type, str):
raise TypeError(
f"Unexpected mime_type type '{type(mime_type)}': expected str"
)

lt.Filestore._uri_import(
self._ctx,
self._filestore_uri,
file_uri,
lt.Filestore._mime_type_from_str(mime_type),
)

def __len__(self) -> int:
"""
:rtype: int
Expand Down
76 changes: 0 additions & 76 deletions tiledb/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,38 +131,6 @@ def __init__(self, array_uri, include_mbrs=False, ctx=None):
if libtiledb_version() >= (2, 5, 0):
self.array_schema_name = fi.get_array_schema_name()

@property
def non_empty_domain(self):
raise tiledb.TileDBError(
"FragmentInfoList.non_empty_domain is deprecated; "
"you must use FragmentInfoList.nonempty_domain",
"This message will be removed in 0.21.0.",
)

@property
def to_vacuum_num(self):
raise tiledb.TileDBError(
"FragmentInfoList.to_vacuum_num is deprecated; "
"you must use len(FragmentInfoList.to_vacuum)",
"This message will be removed in 0.21.0.",
)

@property
def to_vacuum_uri(self):
raise tiledb.TileDBError(
"FragmentInfoList.to_vacuum_uri is deprecated; "
"you must use FragmentInfoList.to_vacuum",
"This message will be removed in 0.21.0.",
)

@property
def dense(self):
raise tiledb.TileDBError(
"FragmentInfoList.dense is deprecated; "
"you must use FragmentInfoList.sparse",
"This message will be removed in 0.21.0.",
)

def __getattr__(self, name):
if name == "mbrs":
raise AttributeError(
Expand Down Expand Up @@ -297,50 +265,6 @@ def __getattr__(self, name):
)
return self.__getattribute__(name)

@property
def non_empty_domain(self):
raise tiledb.TileDBError(
"FragmentInfo.non_empty_domain is deprecated; "
"you must use FragmentInfo.nonempty_domain. ",
"This message will be removed in 0.21.0.",
)

@property
def to_vacuum_num(self):
raise tiledb.TileDBError(
"FragmentInfo.to_vacuum_num is deprecated; "
"you must use len(FragmentInfoList.to_vacuum).",
"This message will be removed in 0.21.0.",
)

@property
def to_vacuum_uri(self):
raise tiledb.TileDBError(
"FragmentInfo.to_vacuum_uri is deprecated; "
"you must use FragmentInfoList.to_vacuum.",
"This message will be removed in 0.21.0.",
)

@property
def dense(self):
raise tiledb.TileDBError(
"FragmentInfo.dense is deprecated; you must use FragmentInfo.sparse",
"This message will be removed in 0.21.0.",
)


def FragmentsInfo(array_uri, ctx=None):
"""
Deprecated in 0.8.8.
Renamed to FragmentInfoList to make name more distinguishable from FragmentInfo.
"""

raise tiledb.TileDBError(
"FragmentsInfo is deprecated; you must use FragmentInfoList. "
"This message will be removed in 0.21.0.",
)


def create_array_from_fragments(
src_uri,
Expand Down
107 changes: 6 additions & 101 deletions tiledb/libtiledb.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1188,17 +1188,6 @@ cdef class Array(object):
"""The view attribute of this array."""
return self.view_attr

@property
def timestamp(self):
"""Deprecated in 0.9.2.
Use `timestamp_range`
"""
raise TileDBError(
"timestamp is deprecated; you must use timestamp_range. "
"This message will be removed in 0.21.0.",
)

@property
def timestamp_range(self):
"""Returns the timestamp range the array is opened at
Expand All @@ -1223,16 +1212,6 @@ cdef class Array(object):

return (int(timestamp_start), int(timestamp_end))

@property
def coords_dtype(self):
"""
Deprecated in 0.8.10
"""
raise TileDBError(
"`coords_dtype` is deprecated because combined coords have been "
"removed from libtiledb. This message will be removed in 0.21.0.",
)

@property
def uri(self):
"""Returns the URI of the array"""
Expand Down Expand Up @@ -1913,14 +1892,6 @@ cdef class Aggregation(object):

if isinstance(cond, str):
q.set_cond(QueryCondition(cond))
elif isinstance(cond, QueryCondition):
raise TileDBError(
"Passing `tiledb.QueryCondition` to `cond` is no longer "
"supported as of 0.19.0. Instead of "
"`cond=tiledb.QueryCondition('expression')` "
"you must use `cond='expression'`. This message will be "
"removed in 0.21.0.",
)
else:
raise TypeError("`cond` expects type str.")

Expand Down Expand Up @@ -2103,13 +2074,6 @@ cdef class Query(object):
"""List of attributes to include in Query."""
return self.attrs

@property
def attr_cond(self):
raise TileDBError(
"`attr_cond` is no longer supported. You must use `cond`. "
"This message will be removed in 0.21.0."
)

@property
def cond(self):
"""QueryCondition used to filter attributes or dimensions in Query."""
Expand Down Expand Up @@ -2288,9 +2252,8 @@ cdef class DenseArrayImpl(Array):
else:
return "DenseArray(uri={0!r}, mode=closed)".format(self.uri)

def query(self, attrs=None, attr_cond=None, cond=None, dims=None,
coords=False, order='C', use_arrow=None, return_arrow=False,
return_incomplete=False):
def query(self, attrs=None, cond=None, dims=None, coords=False, order='C',
use_arrow=None, return_arrow=False, return_incomplete=False):
"""Construct a proxy Query object for easy subarray queries of cells
for an item or region of the array across one or more attributes.
Expand Down Expand Up @@ -2341,24 +2304,12 @@ cdef class DenseArrayImpl(Array):
if not self.isopen or self.mode != 'r':
raise TileDBError("DenseArray must be opened in read mode")

if attr_cond is not None:
if cond is not None:
raise TileDBError("Both `attr_cond` and `cond` were passed. "
"Only use `cond`."
)

raise TileDBError(
"`attr_cond` is no longer supported. You must use `cond`. "
"This message will be removed in 0.21.0."
)

return Query(self, attrs=attrs, cond=cond, dims=dims,
coords=coords, order=order,
use_arrow=use_arrow, return_arrow=return_arrow,
return_incomplete=return_incomplete)

def subarray(self, selection, attrs=None, cond=None, attr_cond=None,
coords=False, order=None):
def subarray(self, selection, attrs=None, cond=None, coords=False, order=None):
"""Retrieve data cells for an item or region of the array.
Optionally subselect over attributes, return dense result coordinate values,
Expand Down Expand Up @@ -2398,12 +2349,6 @@ cdef class DenseArrayImpl(Array):
if not self.isopen or self.mode != 'r':
raise TileDBError("DenseArray must be opened in read mode")

if attr_cond is not None:
if cond is not None:
raise TileDBError("Both `attr_cond` and `cond` were passed. "
"Only use `cond`."
)

cdef tiledb_layout_t layout = TILEDB_UNORDERED
if order is None or order == 'C':
layout = TILEDB_ROW_MAJOR
Expand Down Expand Up @@ -2475,14 +2420,6 @@ cdef class DenseArrayImpl(Array):

if isinstance(cond, str):
q.set_cond(QueryCondition(cond))
elif isinstance(cond, QueryCondition):
raise TileDBError(
"Passing `tiledb.QueryCondition` to `cond` is no longer "
"supported as of 0.19.0. Instead of "
"`cond=tiledb.QueryCondition('expression')` "
"you must use `cond='expression'`. This message will be "
"removed in 0.21.0.",
)
else:
raise TypeError("`cond` expects type str.")

Expand Down Expand Up @@ -3362,9 +3299,8 @@ cdef class SparseArrayImpl(Array):

return result

def query(self, attrs=None, cond=None, attr_cond=None, dims=None,
index_col=True, coords=None, order='U', use_arrow=None,
return_arrow=None, return_incomplete=False):
def query(self, attrs=None, cond=None, dims=None, index_col=True, coords=None,
order='U', use_arrow=None, return_arrow=None, return_incomplete=False):
"""
Construct a proxy Query object for easy subarray queries of cells
for an item or region of the array across one or more attributes.
Expand Down Expand Up @@ -3415,17 +3351,6 @@ cdef class SparseArrayImpl(Array):
if not self.isopen or self.mode not in ('r', 'd'):
raise TileDBError("SparseArray must be opened in read or delete mode")

if attr_cond is not None:
if cond is not None:
raise TileDBError("Both `attr_cond` and `cond` were passed. "
"Only use `cond`."
)

raise TileDBError(
"`attr_cond` is no longer supported. You must use `cond`. "
"This message will be removed in 0.21.0."
)

# backwards compatibility
_coords = coords
if dims is False:
Expand Down Expand Up @@ -3480,8 +3405,7 @@ cdef class SparseArrayImpl(Array):
return result_dict


def subarray(self, selection, coords=True, attrs=None, cond=None,
attr_cond=None, order=None):
def subarray(self, selection, coords=True, attrs=None, cond=None, order=None):
"""
Retrieve dimension and data cells for an item or region of the array.
Expand Down Expand Up @@ -3529,17 +3453,6 @@ cdef class SparseArrayImpl(Array):
if not self.isopen or self.mode not in ('r', 'd'):
raise TileDBError("SparseArray is not opened in read or delete mode")

if attr_cond is not None:
if cond is not None:
raise TileDBError("Both `attr_cond` and `cond` were passed. "
"`attr_cond` is no longer supported. You must use `cond`. "
)

raise TileDBError(
"`attr_cond` is no longer supported. You must use `cond`. "
"This message will be removed in 0.21.0.",
)

cdef tiledb_layout_t layout = TILEDB_UNORDERED
if order is None or order == 'U':
layout = TILEDB_UNORDERED
Expand Down Expand Up @@ -3607,14 +3520,6 @@ cdef class SparseArrayImpl(Array):

if isinstance(cond, str):
q.set_cond(QueryCondition(cond))
elif isinstance(cond, QueryCondition):
raise TileDBError(
"Passing `tiledb.QueryCondition` to `cond` is no longer "
"supported as of 0.19.0. Instead of "
"`cond=tiledb.QueryCondition('expression')` "
"you must use `cond='expression'`. This message will be "
"removed in 0.21.0.",
)
else:
raise TypeError("`cond` expects type str.")

Expand Down
7 changes: 0 additions & 7 deletions tiledb/multirange_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,6 @@ def _get_pyquery(
if query and query.cond is not None:
if isinstance(query.cond, str):
pyquery.set_cond(QueryCondition(query.cond))
elif isinstance(query.cond, QueryCondition):
raise TileDBError(
"Passing `tiledb.QueryCondition` to `cond` is no longer supported "
"as of 0.19.0. Instead of `cond=tiledb.QueryCondition('expression')` "
"you must use `cond='expression'`. This message will be "
"removed in 0.21.0.",
)
else:
raise TypeError("`cond` expects type str.")

Expand Down
21 changes: 0 additions & 21 deletions tiledb/query_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,6 @@ def get_variable_from_node(self, node: QueryConditionNodeElem) -> Any:
variable = variable_node.id
elif isinstance(variable_node, ast.Constant):
variable = variable_node.value
elif isinstance(variable_node, ast.Constant) or isinstance(
variable_node, ast.Constant
):
# deprecated in 3.8
variable = variable_node.s
else:
raise TileDBError(
f"Incorrect type for variable name: {ast.dump(variable_node)}"
Expand Down Expand Up @@ -492,19 +487,3 @@ def visit_UnaryOp(self, node: ast.UnaryOp, sign: int = 1):
)

return node.operand

def visit_Num(self, node: ast.Constant) -> ast.Constant:
# deprecated in 3.8
return node

def visit_Str(self, node: ast.Constant) -> ast.Constant:
# deprecated in 3.8
return node

def visit_Bytes(self, node: ast.Constant) -> ast.Constant:
# deprecated in 3.8
return node

def visit_NameConstant(self, node: ast.Constant) -> ast.Constant:
# deprecated in 3.8
return node
16 changes: 0 additions & 16 deletions tiledb/tests/test_filestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,6 @@ def test_uri(self, text_fname):
assert data == fs.read(0, len(data))
assert len(fs) == len(data)

def test_deprecated_uri(self, text_fname):
path = self.path("test_uri")
schema = tiledb.ArraySchema.from_file(text_fname)
tiledb.Array.create(path, schema)

fs = tiledb.Filestore(path)
with pytest.warns(
DeprecationWarning, match="Filestore.uri_import is deprecated"
):
fs.uri_import(text_fname)

with open(text_fname, "rb") as text:
data = text.read()
assert data == fs.read(0, len(data))
assert len(fs) == len(data)

def test_multiple_writes(self):
path = self.path("test_buffer")
schema = tiledb.ArraySchema.from_file()
Expand Down
Loading

0 comments on commit e717557

Please sign in to comment.