ecolab.auto_display#
- etils.ecolab.auto_display(activate: bool = True) None [source]#
Activate auto display statements ending with ; (activated by default).
Add a trailing ; to any statement (assignment, expression, return statement) to display the current line. This call IPython.display.display() for pretty display.
This change the default IPython behavior where ; added to the last statement of the cell still silence the output.
x = my_fn(); # Display `my_fn()` my_fn(); # Display `my_fn()`
; behavior can be disabled with ecolab.auto_display(False)
Format:
my_obj;: Alias for IPython.display.display(x)
my_obj;s: (spec) Alias for IPython.display.display(etree.spec_like(x))
my_obj;i: (inspect) Alias for ecolab.inspect(x)
my_obj;a: (array) Alias for media.show_images(x) / media.show_videos(x) (
ecolab.auto_plot_array
behavior)my_obj;p: (pretty_display) Alias for print(epy.pretty_repr(x)). Can be combined with s. Used for pretty print dataclasses or print strings containing new lines (rather than displaying n).
my_obj;h: (syntax_highlight) Add Python code syntax highlighting ( using
ecolab.highlight_html
)my_obj;q: (quiet) Don’t display the line (e.g. last line)
my_obj;l: (line) Also display the line (can be combined with previous statements). Has to be at the end (;sl is valid but not ;ls).
p, s, h, l can be combined.
A functional API exists:
ecolab.disp(obj, mode='sp') # Equivalent to `obj;sp`
- Parameters:
activate – Allow to disable
auto_display