8000 MAINT: back printoptions with a true context variable by ngoldbaum · Pull Request #26846 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: back printoptions with a true context variable #26846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
MAINT: respond to marten's comments
  • Loading branch information
ngoldbaum committed Jul 22, 2024
commit fe9add9f91c268a6ff259224d0b73bce1ab58cf6
11 changes: 5 additions & 6 deletions numpy/_core/arrayprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,13 @@ def set_printoptions(precision=None, threshold=None, edgeitems=None,

"""
new_opt = _make_options_dict(precision, threshold, edgeitems, linewidth,
suppress, nanstr, infstr, sign, formatter,
floatmode, legacy)
# formatter is always reset
suppress, nanstr, infstr, sign, formatter,
floatmode, legacy)
# formatter and override_repr are always reset
new_opt['formatter'] = formatter
new_opt['override_repr'] = override_repr

updated_opt = format_options.get().copy()
updated_opt = format_options.get() | new_opt
updated_opt.update(new_opt)

if updated_opt['legacy'] == 113:
Expand Down Expand Up @@ -1450,8 +1450,7 @@ def _void_scalar_to_string(x, is_repr=True):
options = format_options.get().copy()

if options["legacy"] <= 125:
return StructuredVoidFormat.from_data(
array(x), **options)(x)
return StructuredVoidFormat.from_data(array(x), **options)(x)

if options.get('formatter') is None:
options['formatter'] = {}
Expand Down
Loading
0