-
Notifications
You must be signed in to change notification settings - Fork 16
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
Python 3 port #50
Python 3 port #50
Conversation
scimath/interpolate/fitting.py
Outdated
indices, | ||
0, | ||
numpy.Inf).astype( | ||
numpy.int)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: stylistically, I'd break this up into two lines with a temporary to fit in the linewidth constraints.
indices = numpy.clip(indices, 0, numpy.Inf).astype(numpy.int)
indices = np.atleast_1d(indices)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.. Fixed now..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit hard to see the Python 3 changes from the PEP8-ing, but other than a few over-enthusiastic changes (presumably by automated tools), it looks fine.
I have not run the code yet.
scimath/units/function_signature.py
Outdated
|
||
if defaults is not None: | ||
# If there are keywords, then slice the variable list into | ||
# positional and keyword arguments. | ||
kw_count = len(defaults) | ||
args = args_ordered[:-kw_count] | ||
kw = dict(zip(args_ordered[-kw_count:], defaults)) | ||
kw = dict(list(zip(args_ordered[-kw_count:], defaults))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need list
here I believe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
class QuantityTraitHandler ( TraitHandler ): | ||
class QuantityTraitHandler (TraitHandler): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Autopep8 misses the extra space here. You may want to do a global search-replace for this sort of thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -1,13 +1,15 @@ | |||
""" A Scalar is a Quantity object that limits data to floats. | |||
""" | |||
|
|||
from __future__ import absolute_import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? Similarly in a few other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.python.org/dev/peps/pep-0328/#rationale-for-relative-imports
Apparently absolute imports are optional before 2.7
. Given that the code works with 2.7
it is prob. not absolutely :) necessary.. but prob. good to keep until we drop support for < 2.7
? not sure..
I am also partly to blame.. I thought this is a good opportunity to clean up some of the formatting and such.. |
@senganal How do you feel about the status of this PR? |
@jonathanrocher Thanks for the reminder.. IIRC I had paused on this as i had not tested the |
OK. Let me know if I can help... |
@jonathanrocher All the tests pass now on both py3 and py2 (on OSX). |
Since there is no CI on this project, I took the time to confirm that on Py2.7 and 3.6 both on OSX. I also passed the test suite on Win-Py2.7. I tried Win-Py3.6 but am running into compiler issues (EDM doesn't seem to give me a recent enough |
OK, I also tested py2.7 and py3.6 on Ubuntu 16.04 and tests are passing there too. HTH. |
@jonathanrocher Thanks for testing on linux.. I have tested on both OSX and Windows (py2 and py3). @corranwebster Comments have been addressed. I think this is good to go for now. |
Hi all, What is current state of the PR? I would like to get use this as a dev dependency in a project to increase Python 3 support. Let me know if there is anything that I can do to help. |
@JCorson I think its good to go.. Requires blessing from @corranwebster |
Thanks @senganal. FWIW I have tested on Windows Python 2.7 and 3.6. All tests passing. |
@corranwebster Want to give a final blessing on this? |
Go for it (this was totally off my radar). |
Already then... |
Current status: Tests pass on python 2 and python 3 (except those involving
pyside
imports)TODO
Unfortunately, there seems to be a lot of broken code that is not being caught in the tests.. Not sure how to handle them.. Its prob. best to fix them in a separate PR and keep this focused on just the py2->3 conversion..