Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pandas/core/ops/dispatch.py: 75%

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

8 statements  

1""" 

2Functions for defining unary operations. 

3""" 

4 

5from __future__ import annotations 

6 

7from typing import ( 

8 TYPE_CHECKING, 

9 Any, 

10) 

11 

12from pandas.core.dtypes.generic import ABCExtensionArray 

13 

14if TYPE_CHECKING: 

15 from pandas._typing import ArrayLike 

16 

17 

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

19 """ 

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

21 

22 Parameters 

23 ---------- 

24 left : np.ndarray or ExtensionArray 

25 right : object 

26 

27 Returns 

28 ------- 

29 bool 

30 """ 

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