Skip to content

Commit 3bbce11

Browse files
lithomas1iynehz
authored andcommitted
CLN: Remove useless Validation functions (pandas-dev#41936)
1 parent b48aaae commit 3bbce11

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
@@ -1713,7 +1713,7 @@ cdef class Validator:
17131713
if not self.is_valid(values[i]):
17141714
return False
17151715

1716-
return self.finalize_validate()
1716+
return True
17171717

17181718
@cython.wraparound(False)
17191719
@cython.boundscheck(False)
@@ -1726,7 +1726,7 @@ cdef class Validator:
17261726
if not self.is_valid_skipna(values[i]):
17271727
return False
17281728

1729-
return self.finalize_validate_skipna()
1729+
return True
17301730

17311731
cdef bint is_valid(self, object value) except -1:
17321732
return self.is_value_typed(value)
@@ -1744,18 +1744,6 @@ cdef class Validator:
17441744
cdef bint is_array_typed(self) except -1:
17451745
return False
17461746

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

17601748
@cython.internal
17611749
cdef class BoolValidator(Validator):
@@ -1907,14 +1895,14 @@ cdef bint is_bytes_array(ndarray values, bint skipna=False):
19071895
@cython.internal
19081896
cdef class TemporalValidator(Validator):
19091897
cdef:
1910-
Py_ssize_t generic_null_count
1898+
bint all_generic_na
19111899

19121900
def __cinit__(self, Py_ssize_t n, dtype dtype=np.dtype(np.object_),
19131901
bint skipna=False):
19141902
self.n = n
19151903
self.dtype = dtype
19161904
self.skipna = skipna
1917-
self.generic_null_count = 0
1905+
self.all_generic_na = True
19181906

19191907
cdef inline bint is_valid(self, object value) except -1:
19201908
return self.is_value_typed(value) or self.is_valid_null(value)
@@ -1927,15 +1915,16 @@ cdef class TemporalValidator(Validator):
19271915
cdef:
19281916
bint is_typed_null = self.is_valid_null(value)
19291917
bint is_generic_null = value is None or util.is_nan(value)
1930-
self.generic_null_count += is_typed_null and is_generic_null
1918+
if not is_generic_null:
1919+
self.all_generic_na = False
19311920
return self.is_value_typed(value) or is_typed_null or is_generic_null
19321921

1933-
cdef inline bint finalize_validate_skipna(self):
1922+
cdef bint _validate_skipna(self, ndarray values) except -1:
19341923
"""
19351924
If we _only_ saw non-dtype-specific NA values, even if they are valid
19361925
for this dtype, we do not infer this dtype.
19371926
"""
1938-
return self.generic_null_count != self.n
1927+
return Validator._validate_skipna(self, values) and not self.all_generic_na
19391928

19401929

19411930
@cython.internal

0 commit comments

Comments
 (0)