Skip to content

Commit ddfec0a

Browse files
lithomas1JulianWgs
authored andcommitted
CLN: Remove useless Validation functions (pandas-dev#41936)
1 parent 15cbecd commit ddfec0a

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

pandas/_libs/lib.pyx

+8-19
Original file line numberDiff line numberDiff line change
@@ -1711,7 +1711,7 @@ cdef class Validator:
17111711
if not self.is_valid(values[i]):
17121712
return False
17131713

1714-
return self.finalize_validate()
1714+
return True
17151715

17161716
@cython.wraparound(False)
17171717
@cython.boundscheck(False)
@@ -1724,7 +1724,7 @@ cdef class Validator:
17241724
if not self.is_valid_skipna(values[i]):
17251725
return False
17261726

1727-
return self.finalize_validate_skipna()
1727+
return True
17281728

17291729
cdef bint is_valid(self, object value) except -1:
17301730
return self.is_value_typed(value)
@@ -1742,18 +1742,6 @@ cdef class Validator:
17421742
cdef bint is_array_typed(self) except -1:
17431743
return False
17441744

1745-
cdef inline bint finalize_validate(self):
1746-
return True
1747-
1748-
cdef bint finalize_validate_skipna(self):
1749-
"""
1750-
If we _only_ saw non-dtype-specific NA values, even if they are valid
1751-
for this dtype, we do not infer this dtype.
1752-
"""
1753-
# TODO(phillipc): Remove the existing validate methods and replace them
1754-
# with the skipna versions upon full deprecation of skipna=False
1755-
return True
1756-
17571745

17581746
@cython.internal
17591747
cdef class BoolValidator(Validator):
@@ -1905,14 +1893,14 @@ cdef bint is_bytes_array(ndarray values, bint skipna=False):
19051893
@cython.internal
19061894
cdef class TemporalValidator(Validator):
19071895
cdef:
1908-
Py_ssize_t generic_null_count
1896+
bint all_generic_na
19091897

19101898
def __cinit__(self, Py_ssize_t n, dtype dtype=np.dtype(np.object_),
19111899
bint skipna=False):
19121900
self.n = n
19131901
self.dtype = dtype
19141902
self.skipna = skipna
1915-
self.generic_null_count = 0
1903+
self.all_generic_na = True
19161904

19171905
cdef inline bint is_valid(self, object value) except -1:
19181906
return self.is_value_typed(value) or self.is_valid_null(value)
@@ -1925,15 +1913,16 @@ cdef class TemporalValidator(Validator):
19251913
cdef:
19261914
bint is_typed_null = self.is_valid_null(value)
19271915
bint is_generic_null = value is None or util.is_nan(value)
1928-
self.generic_null_count += is_typed_null and is_generic_null
1916+
if not is_generic_null:
1917+
self.all_generic_na = False
19291918
return self.is_value_typed(value) or is_typed_null or is_generic_null
19301919

1931-
cdef inline bint finalize_validate_skipna(self):
1920+
cdef bint _validate_skipna(self, ndarray values) except -1:
19321921
"""
19331922
If we _only_ saw non-dtype-specific NA values, even if they are valid
19341923
for this dtype, we do not infer this dtype.
19351924
"""
1936-
return self.generic_null_count != self.n
1925+
return Validator._validate_skipna(self, values) and not self.all_generic_na
19371926

19381927

19391928
@cython.internal

0 commit comments

Comments
 (0)