Merge pull request #2715 from AaronV77/aaron-sprint-(special-method-printing)-2018

WIP SciPy sprint, printing special methods to prompt.
This commit is contained in:
Anthony Scopatz 2018-07-16 11:24:16 -05:00 committed by GitHub
commit 08b5ebf6fc
Failed to generate hash of commit
2 changed files with 16 additions and 0 deletions

View file

@ -0,0 +1,13 @@
**Added:**
- Added a hook for printing a spcial display method on an object.
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -115,6 +115,9 @@ def pretty(obj, verbose=False, max_width=79, newline='\n', max_seq_length=MAX_SE
""" """
Pretty print the object's representation. Pretty print the object's representation.
""" """
if hasattr(obj, 'xonsh_display'):
return obj.xonsh_display()
stream = CUnicodeIO() stream = CUnicodeIO()
printer = RepresentationPrinter(stream, verbose, max_width, newline, max_seq_length=max_seq_length) printer = RepresentationPrinter(stream, verbose, max_width, newline, max_seq_length=max_seq_length)
printer.pretty(obj) printer.pretty(obj)