Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.10/site-packages/numpy/_core/printoptions.py: 100%

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

5 statements  

1""" 

2Stores and defines the low-level format_options context variable. 

3 

4This is defined in its own file outside of the arrayprint module 

5so we can import it from C while initializing the multiarray 

6C module during import without introducing circular dependencies. 

7""" 

8 

9import sys 

10from contextvars import ContextVar 

11 

12__all__ = ["format_options"] 

13 

14default_format_options_dict = { 

15 "edgeitems": 3, # repr N leading and trailing items of each dimension 

16 "threshold": 1000, # total items > triggers array summarization 

17 "floatmode": "maxprec", 

18 "precision": 8, # precision of floating point representations 

19 "suppress": False, # suppress printing small floating values in exp format 

20 "linewidth": 75, 

21 "nanstr": "nan", 

22 "infstr": "inf", 

23 "sign": "-", 

24 "formatter": None, 

25 # Internally stored as an int to simplify comparisons; converted from/to 

26 # str/False on the way in/out. 

27 'legacy': sys.maxsize, 

28 'override_repr': None, 

29} 

30 

31format_options = ContextVar( 

32 "format_options", default=default_format_options_dict.copy())