Skip to content
Permalink
Browse files

Merge pull request #28 from metabolize/python3-2

Python 3 support (#7)
  • Loading branch information...
mattloper committed Mar 14, 2019
2 parents ef0c192 + b3a5953 commit a3cfdb1be3c8265c369c507b22f6f3f89414c772
@@ -12,7 +12,10 @@ tidy:

test: clean qtest
qtest: all
python -m unittest discover -s chumpy
# For some reason the import changes for Python 3 caused the Python 2 test
# loader to give up without loading any tests. So we discover them ourselves.
# python -m unittest
find chumpy -name 'test_*.py' | sed -e 's/\.py$$//' -e 's/\//./' | xargs python -m unittest

coverage: clean qcov
qcov: all
@@ -1,12 +1,12 @@
from ch import *
from logic import *
from .ch import *
from .logic import *

from optimization import minimize
import extras
import testing
from version import version as __version__
from .optimization import minimize
from . import extras
from . import testing
from .version import version as __version__

from version import version as __version__
from .version import version as __version__

from numpy import bool, int, float, complex, object, unicode, str, nan, inf

@@ -107,12 +107,12 @@ def compute_dr_wrt(self, wrt):

def demo(which=None):
if which not in demos:
print 'Please indicate which demo you want, as follows:'
print('Please indicate which demo you want, as follows:')
for key in demos:
print "\tdemo('%s')" % (key,)
print("\tdemo('%s')" % (key,))
return

print '- - - - - - - - - - - <CODE> - - - - - - - - - - - -'
print demos[which]
print '- - - - - - - - - - - </CODE> - - - - - - - - - - - -\n'
print('- - - - - - - - - - - <CODE> - - - - - - - - - - - -')
print(demos[which])
print('- - - - - - - - - - - </CODE> - - - - - - - - - - - -\n')
exec('global np\n' + demos[which], globals(), locals())
@@ -5,13 +5,13 @@
"""


import ch
from . import ch
import numpy as np
from os.path import join, split
from StringIO import StringIO
from six import StringIO
import numpy
import chumpy
import cPickle as pickle
from six.moves import cPickle as pickle

src = ''
num_passed = 0
@@ -71,7 +71,7 @@ def r(fn_name, args_req, args_opt, nplib=numpy, chlib=chumpy):

try:
if isinstance(args_req, dict):
fn(**dict(args_req.items() + args_opt.items()))
fn(**dict(list(args_req.items()) + list(args_opt.items())))
else:
fn(*args_req, **args_opt)
if lib is chlib:
@@ -108,7 +108,7 @@ def append(a, b, c):
b_color = lookup[b] if b in lookup else 'white'
c_color = lookup[c] if c in lookup else 'white'

print '%s: %s, %s' % (a,b,c)
print('%s: %s, %s' % (a,b,c))
make_row(a, b, c, b_color, c_color)

def m(s):
@@ -524,11 +524,11 @@ def main():
src = '<html><body><table border=1>' + src + '</table></body></html>'
open(join(split(__file__)[0], 'api_compatibility.html'), 'w').write(src)

print 'passed %d, not passed %d' % (num_passed, num_not_passed)
print('passed %d, not passed %d' % (num_passed, num_not_passed))



if __name__ == '__main__':
global which_passed
main()
print ' '.join(which_passed)
print(' '.join(which_passed))
Oops, something went wrong.

0 comments on commit a3cfdb1

Please sign in to comment.
You can’t perform that action at this time.