@@ -1719,11 +1719,11 @@ def is_complex_dtype(arr_or_dtype):
1719
1719
1720
1720
def _is_dtype (arr_or_dtype , condition ):
1721
1721
"""
1722
- Return a boolean if the the condition is satisfied for the arr_or_dtype.
1722
+ Return a boolean if the condition is satisfied for the arr_or_dtype.
1723
1723
1724
1724
Parameters
1725
1725
----------
1726
- arr_or_dtype : array-like
1726
+ arr_or_dtype : array-like, str, np.dtype, or ExtensionArrayType
1727
1727
The array-like or dtype object whose dtype we want to extract.
1728
1728
condition : callable[Union[np.dtype, ExtensionDtype]]
1729
1729
@@ -1780,7 +1780,7 @@ def _get_dtype(arr_or_dtype):
1780
1780
1781
1781
def _is_dtype_type (arr_or_dtype , condition ):
1782
1782
"""
1783
- Return a boolean if the the condition is satisfied for the arr_or_dtype.
1783
+ Return a boolean if the condition is satisfied for the arr_or_dtype.
1784
1784
1785
1785
Parameters
1786
1786
----------
@@ -1790,15 +1790,16 @@ def _is_dtype_type(arr_or_dtype, condition):
1790
1790
1791
1791
Returns
1792
1792
-------
1793
- bool
1793
+ bool : if the condition is satisifed for the arr_or_dtype
1794
1794
1795
1795
"""
1796
1796
1797
1797
if arr_or_dtype is None :
1798
1798
return condition (type (None ))
1799
1799
1800
1800
# fastpath
1801
- if isinstance (arr_or_dtype , np .dtype ):
1801
+ if isinstance (arr_or_dtype , (
1802
+ np .dtype , PandasExtensionDtype , ExtensionDtype )):
1802
1803
return condition (arr_or_dtype .type )
1803
1804
elif isinstance (arr_or_dtype , type ):
1804
1805
return condition (np .dtype (arr_or_dtype ).type )
@@ -1815,7 +1816,7 @@ def _is_dtype_type(arr_or_dtype, condition):
1815
1816
1816
1817
try :
1817
1818
tipo = pandas_dtype (arr_or_dtype ).type
1818
- except (TypeError , ValueError , SyntaxError , UnicodeEncodeError ):
1819
+ except (TypeError , ValueError , UnicodeEncodeError ):
1819
1820
if is_scalar (arr_or_dtype ):
1820
1821
return condition (type (None ))
1821
1822
0 commit comments