@@ -1711,7 +1711,7 @@ cdef class Validator:
1711
1711
if not self .is_valid(values[i]):
1712
1712
return False
1713
1713
1714
- return self .finalize_validate()
1714
+ return True
1715
1715
1716
1716
@ cython.wraparound (False )
1717
1717
@ cython.boundscheck (False )
@@ -1724,7 +1724,7 @@ cdef class Validator:
1724
1724
if not self .is_valid_skipna(values[i]):
1725
1725
return False
1726
1726
1727
- return self .finalize_validate_skipna()
1727
+ return True
1728
1728
1729
1729
cdef bint is_valid(self , object value) except - 1 :
1730
1730
return self .is_value_typed(value)
@@ -1742,18 +1742,6 @@ cdef class Validator:
1742
1742
cdef bint is_array_typed(self ) except - 1 :
1743
1743
return False
1744
1744
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
-
1757
1745
1758
1746
@cython.internal
1759
1747
cdef class BoolValidator(Validator):
@@ -1905,14 +1893,14 @@ cdef bint is_bytes_array(ndarray values, bint skipna=False):
1905
1893
@cython.internal
1906
1894
cdef class TemporalValidator(Validator):
1907
1895
cdef:
1908
- Py_ssize_t generic_null_count
1896
+ bint all_generic_na
1909
1897
1910
1898
def __cinit__ (self , Py_ssize_t n , dtype dtype = np.dtype(np.object_),
1911
1899
bint skipna = False ):
1912
1900
self .n = n
1913
1901
self .dtype = dtype
1914
1902
self .skipna = skipna
1915
- self .generic_null_count = 0
1903
+ self .all_generic_na = True
1916
1904
1917
1905
cdef inline bint is_valid(self , object value) except - 1 :
1918
1906
return self .is_value_typed(value) or self .is_valid_null(value)
@@ -1925,15 +1913,16 @@ cdef class TemporalValidator(Validator):
1925
1913
cdef:
1926
1914
bint is_typed_null = self .is_valid_null(value)
1927
1915
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
1929
1918
return self .is_value_typed(value) or is_typed_null or is_generic_null
1930
1919
1931
- cdef inline bint finalize_validate_skipna (self ) :
1920
+ cdef bint _validate_skipna (self , ndarray values) except - 1 :
1932
1921
"""
1933
1922
If we _only_ saw non-dtype-specific NA values, even if they are valid
1934
1923
for this dtype, we do not infer this dtype.
1935
1924
"""
1936
- return self .generic_null_count ! = self .n
1925
+ return Validator._validate_skipna( self , values) and not self .all_generic_na
1937
1926
1938
1927
1939
1928
@cython.internal
0 commit comments