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
Import speedup - Ticket #2181 #334
Changes from all commits
2e52dcc
d59b142
08dadee
1739d60
b53c462
ea6b365
461d5be
76b700c
ddaadac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,19 @@ | ||
""" | ||
Template for the Chebyshev and Polynomial classes. | ||
|
||
This is an internal module and should not be imported. | ||
|
||
This module houses a Python string module Template object (see, e.g., | ||
http://docs.python.org/library/string.html#template-strings) used by | ||
the `polynomial` and `chebyshev` modules to implement their respective | ||
`Polynomial` and `Chebyshev` classes. It provides a mechanism for easily | ||
creating additional specific polynomial classes (e.g., Legendre, Jacobi, | ||
etc.) in the future, such that all these classes will have a common API. | ||
http://docs.python.org/library/string.html#template-strings) used to | ||
generate the code for the `polynomial`, `chebyshev`, `hermite`, | ||
`hermite_e`, `laguerre`, and `lengendre` modules, to implement their | ||
respective `Polynomial`, `Chebyshev`, `Hermite`, `HermiteE`, | ||
`Laguerre`, and `Lengendre` classes. | ||
|
||
""" | ||
import string | ||
import sys | ||
|
||
if sys.version_info[0] >= 3: | ||
rel_import = "from . import" | ||
else: | ||
rel_import = "import" | ||
|
||
polytemplate = string.Template(''' | ||
from __future__ import division | ||
import numpy as np | ||
import warnings | ||
REL_IMPORT polyutils as pu | ||
|
||
class $name(pu.PolyBase) : | ||
"""A $name series class. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I bet it's the lack of this code that's causing the import problem on Py3. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was also my first thought, but I don't understand why and won't be
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tl;dr We're confusing 2to3. Py3 builds of this branch against Git result in failure. Py3 builds against a source dist work fine. Regenerate I've just had another look at this. This code removal is unrelated to the Py3 errors. The problem is related to the 2to3 tool. When a Py3 build is run directly from the repository, the 2to3 tool doesn't refactor the relative imports (e.g. When a Py3 build is run from a source distribution, the Travis CI farms out the build tasks and runs the build and test for each Py version against a fresh Git checkout - hence the reported Py3 failures. To fix, |
||
|
||
|
@@ -916,4 +907,4 @@ def cast(series, domain=$domain, window=$domain): | |
""" | ||
return series.convert(domain, $name, window) | ||
|
||
'''.replace('REL_IMPORT', rel_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.
A note explaining that code for the Chebyshev class will be adding during the install process would be helpful. Likewise for the other classes.
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.
Good idea.