Skip to content

Commit

Permalink
ARROW-17649: [Python] Remove remaining deprecated APIs from <= 1.0.0 (#…
Browse files Browse the repository at this point in the history
…14401)

Authored-by: Alenka Frim <frim.alenka@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
  • Loading branch information
AlenkaF committed Oct 14, 2022
1 parent 6bf9a54 commit 44058ff
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 49 deletions.
7 changes: 2 additions & 5 deletions python/pyarrow/array.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,9 @@ def array(object obj, type=None, mask=None, size=None, from_pandas=None,
index_type = type.index_type
value_type = type.value_type
if values.ordered != type.ordered:
warnings.warn(
raise ValueError(
"The 'ordered' flag of the passed categorical values "
"does not match the 'ordered' of the specified type. "
"Using the flag of the values, but in the future this "
"mismatch will raise a ValueError.",
FutureWarning, stacklevel=2)
"does not match the 'ordered' of the specified type. ")
else:
index_type = None
value_type = None
Expand Down
9 changes: 0 additions & 9 deletions python/pyarrow/ipc.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -655,15 +655,6 @@ cdef class RecordBatchReader(_Weakrefable):

return pyarrow_wrap_schema(c_schema)

def get_next_batch(self):
"""DEPRECATED: return the next record batch.
Use read_next_batch instead."""
import warnings
warnings.warn('Please use read_next_batch instead of '
'get_next_batch', FutureWarning)
return self.read_next_batch()

def read_next_batch(self):
"""
Read next RecordBatch from the stream.
Expand Down
13 changes: 0 additions & 13 deletions python/pyarrow/scalar.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -836,19 +836,6 @@ cdef class DictionaryScalar(Scalar):
"""
return self.value.as_py() if self.is_valid else None

@property
def index_value(self):
warnings.warn("`index_value` property is deprecated as of 1.0.0"
"please use the `index` property instead",
FutureWarning)
return self.index

@property
def dictionary_value(self):
warnings.warn("`dictionary_value` property is deprecated as of 1.0.0, "
"please use the `value` property instead", FutureWarning)
return self.value


cdef class UnionScalar(Scalar):
"""
Expand Down
5 changes: 3 additions & 2 deletions python/pyarrow/tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3813,10 +3813,11 @@ def test_dictionary_from_pandas_specified_type():
with pytest.raises(pa.ArrowInvalid):
result = pa.array(cat, type=typ)

# mismatching order -> raise error (for now a deprecation warning)
# mismatching order -> raise error
typ = pa.dictionary(
index_type=pa.int8(), value_type=pa.string(), ordered=True)
with pytest.warns(FutureWarning, match="The 'ordered' flag of the passed"):
msg = "The 'ordered' flag of the passed categorical values "
with pytest.raises(ValueError, match=msg):
result = pa.array(cat, type=typ)
assert result.to_pylist() == ['a', 'b']

Expand Down
5 changes: 0 additions & 5 deletions python/pyarrow/tests/test_scalars.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,11 +632,6 @@ def test_dictionary():
assert s.index.equals(i)
assert s.dictionary.equals(dictionary)

with pytest.warns(FutureWarning):
assert s.index_value.equals(i)
with pytest.warns(FutureWarning):
assert s.dictionary_value.as_py() == v

restored = pickle.loads(pickle.dumps(s))
assert restored.equals(s)

Expand Down
15 changes: 0 additions & 15 deletions python/pyarrow/types.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,6 @@ cdef class DataType(_Weakrefable):
raise ValueError("Non-fixed width type")
return ty.bit_width()

@property
def num_children(self):
"""
The number of child fields.
"""
import warnings
warnings.warn("num_children is deprecated, use num_fields",
FutureWarning)
return self.num_fields

@property
def num_fields(self):
"""
Expand Down Expand Up @@ -1317,11 +1307,6 @@ cdef class Field(_Weakrefable):
else:
return wrapped

def add_metadata(self, metadata):
warnings.warn("The 'add_metadata' method is deprecated, use "
"'with_metadata' instead", FutureWarning, stacklevel=2)
return self.with_metadata(metadata)

def with_metadata(self, metadata):
"""
Add metadata as dict of string keys and values to Field
Expand Down

0 comments on commit 44058ff

Please sign in to comment.