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

WIP: Python3 compatibility #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.pyc
__pycache__/
build/
build/
*.egg-info
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
license='LGPL',
url='http://seis.bris.ac.uk/~enxjn/xppy',
platforms='All-platforms',
packages=['xppy','xppy.parser','xppy.utils']
packages=['xppy','xppy.parser','xppy.utils'],
install_requires=['numpy', 'matplotlib'],
)
4 changes: 2 additions & 2 deletions xppy/parser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from parse import *
from run import *
from .parse import *
from .run import *

#__all__ = ['ode', 'set', 'run']
6 changes: 4 additions & 2 deletions xppy/parser/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
from __future__ import print_function
from __future__ import absolute_import
import os
import numpy as np

Expand All @@ -38,7 +40,7 @@ def change_ode(ode_file=tmp_ode, new_pars=[]):
Function changes the parameters and initial conditions specified in
new_pars in given ode_file.
'''
print 'Warning! Function is obsolete, use changeOde instead!'
print('Warning! Function is obsolete, use changeOde instead!')
changeOde(new_pars, ode_file)

def changeOde(new_pars, ode_file=tmp_ode):
Expand Down Expand Up @@ -177,7 +179,7 @@ def change_set(set_file, new_pars):
Function changes the parameters and initial conditions specified in
new_pars in given ode_file.
'''
print 'Warning! Function is obsolete, use changeSet instead!'
print('Warning! Function is obsolete, use changeSet instead!')
changeSet(new_pars, set_file)

def changeSet(new_pars, set_file=tmp_set):
Expand Down
7 changes: 5 additions & 2 deletions xppy/parser/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
from __future__ import print_function
from __future__ import absolute_import

import os
import shutil
from xppy.parser import parse
Expand All @@ -39,7 +42,7 @@
def set_cmd(xpp_path):
global c_g
c_g = os.path.join(xpp_path, c_g)
print "XPP Path set: %s" % (c_g,)
print("XPP Path set: %s" % (c_g,))
return c_g

def run(ode_file=tmp_ode, set_file=tmp_set, verbose=False):
Expand Down Expand Up @@ -94,7 +97,7 @@ def createTmp(ode_file=None, set_file=None):
if set_file != None:
shutil.copy(set_file, tmp_set)
if ode_file == None and set_file == None:
print 'Warning! No files where created, both ode and set arguments are None.'
print('Warning! No files where created, both ode and set arguments are None.')

def deleteTmp(del_ode=True, del_set=True):
'''
Expand Down
10 changes: 5 additions & 5 deletions xppy/utils/allutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
from allinfo import *
from data import *
from diagram import *
from solution import *
from output import *
from .allinfo import *
from .data import *
from .diagram import *
from .solution import *
from .output import *
3 changes: 3 additions & 0 deletions xppy/utils/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
from __future__ import print_function
from __future__ import absolute_import

import numpy as np #@UnresolvedImport
from xppy.utils import allinfo
import matplotlib.pyplot as pl #@UnresolvedImport
Expand Down
2 changes: 1 addition & 1 deletion xppy/utils/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''

from __future__ import print_function
import numpy as np #@UnresolvedImport

####
Expand Down