Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/tqdm/_tqdm_pandas.py: 40%

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

10 statements  

1import sys 

2 

3__author__ = "github.com/casperdcl" 

4__all__ = ['tqdm_pandas'] 

5 

6 

7def tqdm_pandas(tclass, **tqdm_kwargs): 

8 """ 

9 Registers the given `tqdm` instance with 

10 `pandas.core.groupby.DataFrameGroupBy.progress_apply`. 

11 """ 

12 from tqdm import TqdmDeprecationWarning 

13 

14 if isinstance(tclass, type) or (getattr(tclass, '__name__', '').startswith( 

15 'tqdm_')): # delayed adapter case 

16 TqdmDeprecationWarning( 

17 "Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm, ...)`.", 

18 fp_write=getattr(tqdm_kwargs.get('file', None), 'write', sys.stderr.write)) 

19 tclass.pandas(**tqdm_kwargs) 

20 else: 

21 TqdmDeprecationWarning( 

22 "Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm(...))`.", 

23 fp_write=getattr(tclass.fp, 'write', sys.stderr.write)) 

24 type(tclass).pandas(deprecated_t=tclass)