Skip to content
New issue

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

PR: Make value_to_display more robust #5028

Merged
merged 17 commits into from
Aug 31, 2017
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
40e27f5
Variable Explorer: Apply value_to_display only to collection types
ccordoba12 Aug 22, 2017
990f672
Variable Explorer: Add a default_display function
ccordoba12 Aug 22, 2017
9cba902
Variable Explorer: Prevent computation of object Numpy array repr's
ccordoba12 Aug 22, 2017
0b0a55b
Variable Explorer: Add a version of default_display without the module
ccordoba12 Aug 22, 2017
e3ffeb1
Variable Explorer: Add a function to display collections
ccordoba12 Aug 22, 2017
05ae065
Variable Explorer: Fix error in collections_display
ccordoba12 Aug 22, 2017
1fcdc48
Variable Explorer: Add default values to display when objects are ins…
ccordoba12 Aug 22, 2017
026dfdc
Variable Explorer: Remove instance of reprlib.Repr because it's not n…
ccordoba12 Aug 22, 2017
e65385a
Variable Explorer: Simple refactor
ccordoba12 Aug 22, 2017
824aee9
Variable Explorer: Add display for dictionaries again
ccordoba12 Aug 22, 2017
e3b58e6
Variable Explorer: Reduce number of characters shown in display
ccordoba12 Aug 22, 2017
3d24302
Variable Explorer: Improve default_display a little bit
ccordoba12 Aug 22, 2017
d93a6c5
Testing: Add tests for default_display
ccordoba12 Aug 22, 2017
7a50759
Testing: Add tests for display of lists
ccordoba12 Aug 22, 2017
a7f3b11
Variable Explorer: Add quotes to strings in value_to_display if level…
ccordoba12 Aug 22, 2017
e35b19a
Testing: Add tests for display of dicts
ccordoba12 Aug 26, 2017
fafbdc0
Variable Explorer: Fix error when displaying binary strings
ccordoba12 Aug 27, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions spyder/widgets/variableexplorer/utils.py
Original file line number Diff line number Diff line change
@@ -373,6 +373,8 @@ def value_to_display(value, minmax=False, level=0):
elif isinstance(value, NavigableString):
# Fixes Issue 2448
display = to_text_string(value)
if level > 0:
display = u"'" + display + u"'"
elif isinstance(value, DatetimeIndex):
if level == 0:
display = value.summary()
@@ -383,8 +385,13 @@ def value_to_display(value, minmax=False, level=0):
display = to_text_string(value, 'utf8')
except:
display = value
if level > 0:
display = (to_binary_string("'") + display +
to_binary_string('"'))
elif is_text_string(value):
display = value
if level > 0:
display = u"'" + display + u"'"
elif (isinstance(value, NUMERIC_TYPES) or isinstance(value, bool) or
isinstance(value, datetime.date) or
isinstance(value, numeric_numpy_types)):