Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.9/dist-packages/pandas/core/ops/dispatch.py: 86%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

7 statements  

1""" 

2Functions for defining unary operations. 

3""" 

4from __future__ import annotations 

5 

6from typing import ( 

7 TYPE_CHECKING, 

8 Any, 

9) 

10 

11from pandas.core.dtypes.generic import ABCExtensionArray 

12 

13if TYPE_CHECKING: 

14 from pandas._typing import ArrayLike 

15 

16 

17def should_extension_dispatch(left: ArrayLike, right: Any) -> bool: 

18 """ 

19 Identify cases where Series operation should dispatch to ExtensionArray method. 

20 

21 Parameters 

22 ---------- 

23 left : np.ndarray or ExtensionArray 

24 right : object 

25 

26 Returns 

27 ------- 

28 bool 

29 """ 

30 return isinstance(left, ABCExtensionArray) or isinstance(right, ABCExtensionArray)