We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Prettyprinting an IPython.core.magics.execution.TimeitResult crashes prettyprinter. That class is defined at https://github.com/ipython/ipython/blob/master/IPython/core/magics/execution.py.
In IPython 7.8.0 with prettyprinter enabled:
In [1]: x = %timeit -o pass 5.06 ns ± 0.0139 ns per loop (mean ± std. dev. of 7 runs, 100000000 loops each) In [2]: type(x) Out[2]: IPython.core.magics.execution.TimeitResult # class In [3]: x Out[3]: --------------------------------------------------------------------------- AssertionError Traceback (most recent call last) ~/.local/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj) 700 type_pprinters=self.type_printers, 701 deferred_pprinters=self.deferred_printers) --> 702 printer.pretty(obj) 703 printer.flush() 704 return stream.getvalue() ~/.local/lib/python3.7/site-packages/prettyprinter/extras/ipython.py in pretty(self, obj) 58 ), 59 width=columns, ---> 60 end=None 61 ) 62 ~/.local/lib/python3.7/site-packages/prettyprinter/__init__.py in cpprint(object, stream, indent, width, depth, compact, ribbon_width, max_seq_len, sort_dict_keys, style, end) 253 else stream 254 ) --> 255 colored_render_to_stream(stream, sdocs, style=style) 256 if end: 257 stream.write(end) ~/.local/lib/python3.7/site-packages/prettyprinter/color.py in colored_render_to_stream(stream, sdocs, style, newline, separator) 201 style = default_style 202 --> 203 evald = list(sdocs) 204 205 if not evald: ~/.local/lib/python3.7/site-packages/prettyprinter/layout.py in best_layout(doc, width, ribbon_frac, fitting_predicate, outcol, mode) 253 ribbon_width=ribbon_width, 254 ) --> 255 normalized = normalize_doc(evaluated_doc) 256 triplestack.append((indent, mode, normalized)) 257 elif isinstance(doc, Annotated): ~/.local/lib/python3.7/site-packages/prettyprinter/doctypes.py in normalize_doc(doc) 4 return NIL 5 return doc ----> 6 return doc.normalize() 7 8 ~/.local/lib/python3.7/site-packages/prettyprinter/doctypes.py in normalize(self) 55 propagate_broken = False 56 for doc in self.docs: ---> 57 doc = normalize_doc(doc) 58 if isinstance(doc, Concat): 59 normalized_docs.extend(doc.docs) ~/.local/lib/python3.7/site-packages/prettyprinter/doctypes.py in normalize_doc(doc) 4 return NIL 5 return doc ----> 6 return doc.normalize() 7 8 ~/.local/lib/python3.7/site-packages/prettyprinter/doctypes.py in normalize(self) 199 elif doc_normalized is NIL: 200 return NIL --> 201 return Group(doc_normalized) 202 203 def __repr__(self): ~/.local/lib/python3.7/site-packages/prettyprinter/doctypes.py in __init__(self, doc) 187 188 def __init__(self, doc): --> 189 assert isinstance(doc, Doc) 190 self.doc = doc 191
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
Prettyprinting an IPython.core.magics.execution.TimeitResult crashes prettyprinter. That class is defined at https://github.com/ipython/ipython/blob/master/IPython/core/magics/execution.py.
What I Did
In IPython 7.8.0 with prettyprinter enabled:
The text was updated successfully, but these errors were encountered: