mirror of
https://github.com/cool-RR/PySnooper.git
synced 2026-01-23 10:15:11 +00:00
Use reprlib
This commit is contained in:
parent
fbc3f98aa1
commit
7de345f5cc
1 changed files with 5 additions and 1 deletions
|
|
@ -6,6 +6,10 @@ import re
|
|||
import collections
|
||||
import datetime as datetime_module
|
||||
import itertools
|
||||
try:
|
||||
import repr as reprlib
|
||||
except ImportError:
|
||||
import reprlib
|
||||
|
||||
from .third_party import six
|
||||
|
||||
|
|
@ -15,7 +19,7 @@ ipython_filename_pattern = re.compile('^<ipython-input-([0-9]+)-.*>$')
|
|||
|
||||
def get_shortish_repr(item):
|
||||
try:
|
||||
r = repr(item)
|
||||
r = reprlib.repr(item)
|
||||
except Exception:
|
||||
r = 'REPR FAILED'
|
||||
r = r.replace('\r', '').replace('\n', '')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue