diff --git a/python/molequeue/__init__.py b/python/molequeue/__init__.py index d6228af..8dac3c0 100644 --- a/python/molequeue/__init__.py +++ b/python/molequeue/__init__.py @@ -1,2 +1,2 @@ -from client import Client, Job, JobState, JobException, \ +from .client import Client, Job, JobState, JobException, \ FilePath, FileContents, Queue, JobInformationException diff --git a/python/molequeue/client.py b/python/molequeue/client.py index 86957bf..d62a479 100644 --- a/python/molequeue/client.py +++ b/python/molequeue/client.py @@ -11,9 +11,9 @@ import tempfile import sys -from utils import underscore_to_camelcase -from utils import camelcase_to_underscore -from utils import JsonRpc +from .utils import underscore_to_camelcase +from .utils import camelcase_to_underscore +from .utils import JsonRpc import threading class JobState: @@ -270,7 +270,7 @@ def _wait_for_response(self, packet_id, timeout): while self._request_response_map[packet_id] == None: # need to set a wait time otherwise the wait can't be interrupted # See http://bugs.python.org/issue8844 - wait_time = sys.maxint + wait_time = sys.maxsize if timeout != None: wait_time = timeout - (time.time() - start) if wait_time <= 0: diff --git a/python/molequeue/utils.py b/python/molequeue/utils.py index c412114..3cf0be0 100644 --- a/python/molequeue/utils.py +++ b/python/molequeue/utils.py @@ -1,7 +1,6 @@ import json import re import itertools -import types import molequeue class JsonRpc: @@ -22,7 +21,7 @@ def generate_request(packet_id, method, parameters): def json_to_job(json): job = molequeue.Job() # convert response into Job object - for key, value in json['result'].iteritems(): + for key, value in json['result'].items(): field = camelcase_to_underscore(key) if key in JsonRpc.INTERNAL_FIELDS: field = '_' + field @@ -34,7 +33,7 @@ def json_to_job(json): def json_to_queues(json): queues = [] - for name, programs in json['result'].iteritems(): + for name, programs in json['result'].items(): queue = molequeue.Queue(); queue.name = name queue.programs = programs @@ -46,12 +45,9 @@ def json_to_queues(json): def object_to_json_params(job): params = {} - for key, value in job.__dict__.iteritems(): + for key, value in job.__dict__.items(): field = underscore_to_camelcase(key) - if type(value) == types.InstanceType: - value = JsonRpc.object_to_json_params(value) - params[field] = value return params @@ -64,7 +60,7 @@ def camelcase(): c = camelcase() - return ''.join(c.next()(x) for x in value.split('_')) + return ''.join(next(c)(x) for x in value.split('_')) def camelcase_to_underscore(value): operation = itertools.cycle((lambda x : x.lower(), lambda x : '_' + x.lower()))