mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 17:30:59 +01:00
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:
commit
08b5ebf6fc
2 changed files with 16 additions and 0 deletions
13
news/aaron-sprint-(special-method-printing)-2018.rst
Normal file
13
news/aaron-sprint-(special-method-printing)-2018.rst
Normal 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
|
|
@ -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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue