rby1_sdk.set_printoptions#
- set_printoptions(array_mode: str | None = None, linewidth: int | None = None, precision: int | None = None, edgeitems: int | None = None, threshold: int | None = None, suppress_small: bool | None = None, multiline_repr: bool | None = None, float_style: str | None = None, sign: str | None = None, trim_trailing_zeros: bool | None = None, scope: str | None = 'thread') None#
Set global or thread-local rby1_sdk print options.
Controls how SDK objects and NumPy arrays are rendered by __repr__/__str__. array_mode=’numpy’ delegates array printing entirely to NumPy’s global printoptions. preview/full make the SDK pass its options explicitly.
multiline_repr toggles `__repr__` only; by convention __str__ is kept one line.
- Parameters:
array_mode ({'numpy', 'preview', 'full'}, optional) –
‘numpy’ : Fully delegate arrays to NumPy’s global printoptions.
’preview’: Use SDK preview policy (threshold/edgeitems/linewidth/precision/sign/…).
’full’ : Print full arrays (ignore threshold), other options still apply.
linewidth (int, optional) – Target maximum line width for arrays (passed to NumPy when not ‘numpy’).
precision (int, optional) – Decimal precision for scalars and arrays.
edgeitems (int, optional) – Number of leading/trailing items to show when summarizing arrays.
threshold (int, optional) – Total number of array elements that triggers summarization (ellipsis).
suppress_small (bool, optional) – If True, very small floats are printed as 0 in arrays (when not ‘numpy’).
multiline_repr (bool, optional) – If True, top-level __repr__ of complex SDK objects uses multi-line, field-per-line formatting. Nested objects should be rendered one-line where reasonable.
float_style ({'auto', 'default', 'fixed', 'scientific'}, optional) – Floating formatting style for scalars and (when not ‘numpy’) arrays.
sign ({'auto', 'minus', 'plus', 'space'}, optional) – Sign policy. ‘space’ shows a leading space for positive numbers.
trim_trailing_zeros (bool, optional) – If True, trailing zeros after the decimal point are trimmed (1.200 -> ‘1.2’).
scope ({'thread', 'global'}, optional) –
‘thread’ (default): apply to the current Python thread (thread-local stack top).
’global’ : update process-wide defaults.
Notes
Options are maintained on a thread-local stack. Repeated calls update the top-of-stack for the current thread; using scope=’global’ updates process-wide defaults.
For temporary changes, prefer the context manager printoptions(…) below.
Examples
>>> import rby1_sdk as rby >>> rby.set_printoptions(array_mode='numpy', precision=4) # arrays follow NumPy global config; scalars use precision=4 >>> with rby.printoptions(array_mode='preview', precision=2, multiline_repr=True): ... print(obj) # one-line **str** with precision=2 ... print(repr(obj)) # multi-line **repr** (since multiline_repr=True)