Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
printoptions.py33 linesDownload Raw Back to _core
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)
33 
codekingpro/portable-devtools · Team Ai