Commit 4f6221ca authored by André Anjos's avatar André Anjos 💬

[python3] string class comparison using six

parent a38da01f
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
import os import os
import sys import sys
import six
import signal import signal
import subprocess import subprocess
from .tools import logger from .tools import logger
...@@ -88,7 +89,7 @@ def environ(context): ...@@ -88,7 +89,7 @@ def environ(context):
def sexec(context, command, error_on_nonzero=True): def sexec(context, command, error_on_nonzero=True):
"""Executes a command within a particular Idiap SETSHELL context""" """Executes a command within a particular Idiap SETSHELL context"""
if isinstance(context, (str, unicode)): E = environ(context) if isinstance(context, six.string_types): E = environ(context)
else: E = context else: E = context
try: try:
......
...@@ -139,7 +139,7 @@ def qsub(command, queue=None, cwd=True, name=None, deps=[], stdout='', ...@@ -139,7 +139,7 @@ def qsub(command, queue=None, cwd=True, name=None, deps=[], stdout='',
scmd = ['qsub'] scmd = ['qsub']
if isinstance(queue, str) and queue not in ('all.q', 'default'): if isinstance(queue, six.string_types) and queue not in ('all.q', 'default'):
scmd += ['-l', queue] scmd += ['-l', queue]
if mem: if mem:
...@@ -195,7 +195,7 @@ def qsub(command, queue=None, cwd=True, name=None, deps=[], stdout='', ...@@ -195,7 +195,7 @@ def qsub(command, queue=None, cwd=True, name=None, deps=[], stdout='',
except ValueError: except ValueError:
#must be complete... #must be complete...
scmd.append('%s' % array) scmd.append('%s' % array)
if isinstance(array, (int, long)): if isinstance(array, six.integer_types):
scmd.append('1-%d:1' % array) scmd.append('1-%d:1' % array)
if isinstance(array, (tuple, list)): if isinstance(array, (tuple, list)):
if len(array) < 1 or len(array) > 3: if len(array) < 1 or len(array) > 3:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment