Skip to content

Commit 5af18ba

Browse files
committed
Added more support for Python3
1 parent e658ee9 commit 5af18ba

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

smartdispatch/argument_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def unfold(self, match):
3535
start = int(groups[0])
3636
end = int(groups[1])
3737
step = 1 if groups[2] is None else int(groups[2])
38-
return map(str, range(start, end, step))
38+
return list(map(str, range(start, end, step)))
3939

4040

4141
argument_templates = build_argument_templates_dictionnary()

smartdispatch/smartdispatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def unfold_command(command):
9696
pos = match.end()
9797

9898
arguments.append([text[pos:]]) # Add remaining unfolded arguments
99-
arguments = [map(utils.decode_escaped_characters, argvalues) for argvalues in arguments]
99+
arguments = [list(map(utils.decode_escaped_characters, argvalues)) for argvalues in arguments]
100100
return ["".join(argvalues) for argvalues in itertools.product(*arguments)]
101101

102102

smartdispatch/tests/test_job_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def setUp(self):
2222
self.mem_per_node = 32
2323
self.modules = ["cuda", "python"]
2424

25-
self.queue = Queue(self.name, self.cluster_name, self.walltime, self.cores, 0, self.modules)
25+
self.queue = Queue(self.name, self.cluster_name, self.walltime, self.cores, 0, self.mem_per_node, self.modules)
2626
self.queue_gpu = Queue(self.name, self.cluster_name, self.walltime, self.cores, self.gpus, self.mem_per_node, self.modules)
2727

2828
def tearDown(self):

smartdispatch/tests/test_smartdispatch.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
import shutil
44
import time as t
55
from os.path import join as pjoin
6-
from StringIO import StringIO
6+
7+
try:
8+
from io import StringIO # Python 3
9+
except ImportError:
10+
from StringIO import StringIO # Python 2
711

812
import tempfile
913
from nose.tools import assert_true, assert_equal

smartdispatch/tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_open_with_lock():
7474
time.sleep(1)
7575

7676
stdout, stderr = process.communicate()
77-
assert_equal(stdout, "")
77+
assert_equal(stdout, b"")
7878
assert_true("write-lock" in stderr, msg="Forcing a race condition, try increasing sleeping time above.")
7979
assert_true("Traceback" not in stderr, msg="Unexpected error: " + stderr) # Check that there are no errors.
8080

0 commit comments

Comments
 (0)