From e3f78e429d463b19875ccf74351c413487498190 Mon Sep 17 00:00:00 2001 From: natalieda Date: Fri, 8 Apr 2022 15:07:00 +0200 Subject: [PATCH] python 3 support --- picas/clients.py | 2 +- picas/couchdblogger.py | 2 +- picas/iterators.py | 4 ++-- picas/srm.py | 6 +++--- picas/srmclient.py | 8 ++++---- scripts/example.py | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/picas/clients.py b/picas/clients.py index ebca004..a599489 100644 --- a/picas/clients.py +++ b/picas/clients.py @@ -6,7 +6,7 @@ @author: Jan Bot @author: Joris Borgdorff """ -from __future__ import print_function + from .documents import Document import random import sys diff --git a/picas/couchdblogger.py b/picas/couchdblogger.py index d2ecf6d..7084d31 100644 --- a/picas/couchdblogger.py +++ b/picas/couchdblogger.py @@ -4,7 +4,7 @@ @licence: The MIT License (MIT) @Copyright (c) 2016, Jan Bot """ -from __future__ import print_function + # Python imports import logging diff --git a/picas/iterators.py b/picas/iterators.py index 09564be..1b9f803 100644 --- a/picas/iterators.py +++ b/picas/iterators.py @@ -31,7 +31,7 @@ def stop(self): def is_stopped(self): return self._stop - def next(self): + def __next__(self): return self.__next__() def __next__(self): @@ -152,7 +152,7 @@ def is_cancelled(self): def __next__(self): while not self.is_cancelled(): try: - return self.iterator.next() + return next(self.iterator) except StopIteration: self.iterator.reset() time.sleep(self.sleep_sec) diff --git a/picas/srm.py b/picas/srm.py index 478da6a..06d1611 100644 --- a/picas/srm.py +++ b/picas/srm.py @@ -4,12 +4,12 @@ @licence: The MIT License (MIT) @Copyright (c) 2016, Jan Bot """ -from __future__ import print_function + # Python imports import threading import logging -import Queue +import queue from os import path from .executers import execute, execute_old @@ -34,7 +34,7 @@ def download_many(files, poolsize=10, logger=None): be established. Default: 10. @param logger: a Python logger object. Default: None. """ - q = Queue.Queue() + q = queue.Queue() for v in files: q.put(v) diff --git a/picas/srmclient.py b/picas/srmclient.py index 122a15d..37859e9 100644 --- a/picas/srmclient.py +++ b/picas/srmclient.py @@ -4,18 +4,18 @@ @licence: The MIT License (MIT) @Copyright (c) 2016, Jan Bot """ -from __future__ import print_function + import threading import logging -import Queue +import queue from picas import SRMClient def download(files, threads=10): - q = Queue.Queue() - for k, v in files.iteritems(): + q = queue.Queue() + for k, v in files.items(): q.put(v) thread_pool = [] diff --git a/scripts/example.py b/scripts/example.py index ae4dca6..1a2327e 100755 --- a/scripts/example.py +++ b/scripts/example.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import print_function + from picas.actors import RunActor from picas.clients import CouchDB