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: Added support to the principal numeric Numpy types in the Variable Explorer #3653

Merged
merged 4 commits into from
Nov 21, 2016

Conversation

dalthviz
Copy link
Member

@dalthviz dalthviz commented Nov 5, 2016

Fixes #3638

@dalthviz
Copy link
Member Author

dalthviz commented Nov 5, 2016

Added support in the variable explorer to the following numpy data types: int32, int64, float32, float64, complex64, complex_ (shorthand for complex128) and complex128

numpy

@dalthviz dalthviz changed the title Fixes issue 3638 Added support to the principal numeric Numpy types Nov 5, 2016
@dalthviz dalthviz changed the title Added support to the principal numeric Numpy types Added support to the principal numeric Numpy types in the Variable Explorer Nov 5, 2016
@wtheis
Copy link

wtheis commented Nov 5, 2016

If possible, please include this in 3.0.2.
(#3638 is currently 3.1.)

@dalthviz dalthviz changed the title Added support to the principal numeric Numpy types in the Variable Explorer PR: Added support to the principal numeric Numpy types in the Variable Explorer Nov 6, 2016
from numpy import ndarray, array, matrix, recarray
from numpy import ndarray, array, matrix, recarray, \
int64, int32, float64, float32, complex_, \
complex64, complex128
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please enclose imports in parenthesis

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also make these objects FakeObject's below

elif isinstance(value, complex_) or isinstance(value, complex128) :
display = repr(value)
elif isinstance(value, complex64):
display = repr(value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a list comprehension for this block

elif isinstance(value, complex_) or isinstance(value, complex128) :
display = repr(value)
elif isinstance(value, complex64):
elif True in [isinstance(value, x) for x in numeric_type_list]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd write this as any(isinstance(value, x) for x in numeric_type_list) or isinstance(value, numeric_type_tuple); in the latter case, I think it needs to be a tuple of types, not a list of types.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also like the second option. @dalthviz, please do the corresponding change :-)

@ccordoba12 ccordoba12 added this to the v3.1 milestone Nov 10, 2016
@ccordoba12
Copy link
Member

ccordoba12 commented Nov 10, 2016

If possible, please include this in 3.0.2.

@wtheis, unfortunately 3.0.2 is almost done, and we don't want to delay it longer.

@@ -244,6 +247,8 @@ def unsorted_unique(lista):
def value_to_display(value, minmax=False):
"""Convert value for display purpose"""
try:
numeric_type_tuple = (int64, int32, float64, float32, \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dalthviz, I think you don't need a continuation line (\) here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please rename this variable to numeric_numpy_types

@@ -290,6 +295,8 @@ def value_to_display(value, minmax=False):
elif isinstance(value, NUMERIC_TYPES) or isinstance(value, bool) or \
isinstance(value, datetime.date):
display = repr(value)
elif isinstance(value, numeric_type_tuple):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this to the elif isinstance(value, NUMERIC_TYPES) or ... block above because it returns the same result (i.e. display = repr(value)).

@@ -44,16 +44,19 @@ class FakeObject(object):


#==============================================================================
# Numpy arrays support
# Numpy arrays and numeric support
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to Numpy arrays and numeric types support

@ccordoba12 ccordoba12 merged commit 7f80cd3 into spyder-ide:3.x Nov 21, 2016
ccordoba12 added a commit that referenced this pull request Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants