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