Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.9/dist-packages/pandas/_config/__init__.py: 88%

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

17 statements  

1""" 

2pandas._config is considered explicitly upstream of everything else in pandas, 

3should have no intra-pandas dependencies. 

4 

5importing `dates` and `display` ensures that keys needed by _libs 

6are initialized. 

7""" 

8__all__ = [ 

9 "config", 

10 "detect_console_encoding", 

11 "get_option", 

12 "set_option", 

13 "reset_option", 

14 "describe_option", 

15 "option_context", 

16 "options", 

17 "using_copy_on_write", 

18 "warn_copy_on_write", 

19] 

20from pandas._config import config 

21from pandas._config import dates # pyright: ignore[reportUnusedImport] # noqa: F401 

22from pandas._config.config import ( 

23 _global_config, 

24 describe_option, 

25 get_option, 

26 option_context, 

27 options, 

28 reset_option, 

29 set_option, 

30) 

31from pandas._config.display import detect_console_encoding 

32 

33 

34def using_copy_on_write() -> bool: 

35 _mode_options = _global_config["mode"] 

36 return ( 

37 _mode_options["copy_on_write"] is True 

38 and _mode_options["data_manager"] == "block" 

39 ) 

40 

41 

42def warn_copy_on_write() -> bool: 

43 _mode_options = _global_config["mode"] 

44 return ( 

45 _mode_options["copy_on_write"] == "warn" 

46 and _mode_options["data_manager"] == "block" 

47 ) 

48 

49 

50def using_nullable_dtypes() -> bool: 

51 _mode_options = _global_config["mode"] 

52 return _mode_options["nullable_dtypes"] 

53 

54 

55def using_pyarrow_string_dtype() -> bool: 

56 _mode_options = _global_config["future"] 

57 return _mode_options["infer_string"]