diff --git a/.github/workflows/source_build.yml b/.github/workflows/source_build.yml index 9941f3743e1..ca698df75b4 100644 --- a/.github/workflows/source_build.yml +++ b/.github/workflows/source_build.yml @@ -12,15 +12,22 @@ jobs: build_bf: [false] build_zarr: [false] build_snapshot: [false] + python-version: + - '3.10' + - '3.11' + - '3.12' name: Build OMERO from source runs-on: ubuntu-22.04 env: ICE_HOME: /opt/ice-3.6.5 steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} - name: Install Ice and Ice python binding if: matrix.build_snapshot - uses: ome/action-ice@v3 + uses: jburel/action-ice@v3 - name: Set up Gradle 6.8.3 if: matrix.build_snapshot uses: gradle/gradle-build-action@v2 @@ -30,7 +37,7 @@ jobs: build-root-directory: components/tools/OmeroJava # required by the action to have a *.gradle file" - name: Install and run flake8 run: | - pip install flake8 + pip install flake8 'setuptools<69' flake8 . - name: install dependencies run: | diff --git a/build.py b/build.py index f76661e39a4..365387fffb1 100755 --- a/build.py +++ b/build.py @@ -8,7 +8,6 @@ # # General build scripts. -from builtins import str import os import sys import subprocess diff --git a/components/antlib/scripts/parse_version b/components/antlib/scripts/parse_version index 76f2cab9929..753fb25247f 100755 --- a/components/antlib/scripts/parse_version +++ b/components/antlib/scripts/parse_version @@ -22,10 +22,7 @@ """ Helper script to simpliy version.xml """ -from __future__ import print_function -from builtins import str -from builtins import range import os import re import sys diff --git a/components/antlib/scripts/source-archive.py b/components/antlib/scripts/source-archive.py index 4ac1fd815e6..f165a8c5830 100755 --- a/components/antlib/scripts/source-archive.py +++ b/components/antlib/scripts/source-archive.py @@ -1,7 +1,5 @@ #!/usr/bin/python -from __future__ import print_function - import os from subprocess import call, Popen, PIPE import sys diff --git a/components/tools/OmeroFS/setup.py b/components/tools/OmeroFS/setup.py index 395dfd3f218..4dbfd175511 100755 --- a/components/tools/OmeroFS/setup.py +++ b/components/tools/OmeroFS/setup.py @@ -6,7 +6,6 @@ """ -from builtins import map import glob import sys import os diff --git a/components/tools/OmeroFS/test/drivers.py b/components/tools/OmeroFS/test/drivers.py index 94fb8856d43..9c1d4fc3e86 100644 --- a/components/tools/OmeroFS/test/drivers.py +++ b/components/tools/OmeroFS/test/drivers.py @@ -9,12 +9,7 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import division -from builtins import str -from builtins import range -from builtins import object -from past.utils import old_div import logging import threading import time @@ -22,11 +17,7 @@ import omero.grid.monitors as monitors -try: - from omero_ext.path import path -except ImportError: - # Python 2 - from path import path +from omero_ext.path import path from omero.util import ServerContext from functools import wraps from omero.util.temp_files import create_path @@ -69,7 +60,7 @@ def run(self): By default, nothing. """ self.log.info("Sleeping %s" % self.waitMillis) - time.sleep(old_div(self.waitMillis, 1000)) + time.sleep(self.waitMillis / 1000) if not self.client: self.log.error("No client") self.doRun() @@ -160,7 +151,7 @@ def with_driver(func, errors=0): """ Decorator for running a test with a Driver """ def handler(*args, **kwargs): self = args[0] - self.dir = old_div(create_path(folder=True), "DropBox") + self.dir = create_path(folder=True) / "DropBox" self.simulator = Simulator(self.dir) self.client = MockMonitor(self.dir, pre=[self.simulator], post=[]) try: @@ -310,7 +301,7 @@ def fsEventHappened(self, monitorid, eventList, current=None): if not file.isdir(): raise Exception("%s is not a directory" % file) self.log.info("Creating file in dir %s", file) - new_file = old_div(file, str(uuid.uuid4())) + new_file = file / str(uuid.uuid4()) new_file.write_lines( ["Writing new file to modify this" "directory on event: %s" % event]) diff --git a/components/tools/OmeroFS/test/integration/test_dbclient.py b/components/tools/OmeroFS/test/integration/test_dbclient.py index 813615e3ac5..1a0e2032f30 100644 --- a/components/tools/OmeroFS/test/integration/test_dbclient.py +++ b/components/tools/OmeroFS/test/integration/test_dbclient.py @@ -7,7 +7,6 @@ """ -from builtins import object import os import sys diff --git a/components/tools/OmeroPy/test/conftest.py b/components/tools/OmeroPy/test/conftest.py index 6e30a1c04f0..6e8e1fee2fa 100644 --- a/components/tools/OmeroPy/test/conftest.py +++ b/components/tools/OmeroPy/test/conftest.py @@ -6,8 +6,6 @@ # -from builtins import range -from builtins import object import pytest import os diff --git a/components/tools/OmeroPy/test/integration/clitest/cli.py b/components/tools/OmeroPy/test/integration/clitest/cli.py index d51d0b351a9..46480bd9a9d 100644 --- a/components/tools/OmeroPy/test/integration/clitest/cli.py +++ b/components/tools/OmeroPy/test/integration/clitest/cli.py @@ -20,7 +20,6 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from builtins import object import pytest import warnings diff --git a/components/tools/OmeroPy/test/integration/clitest/test_admin.py b/components/tools/OmeroPy/test/integration/clitest/test_admin.py index 856f55642d7..b68f59f0d44 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_admin.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_admin.py @@ -20,9 +20,6 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from __future__ import division -from builtins import str -from past.utils import old_div import pytest import os @@ -30,11 +27,7 @@ from omero.testlib.cli import RootCLITest import omero.plugins.admin from omero.cli import NonZeroReturnCode -try: - from omero_ext.path import path -except ImportError: - # Python 2 - from path import path +from omero_ext.path import path from omero.util.upgrade_check import UpgradeCheck OMERODIR = os.getenv('OMERODIR', None) @@ -59,10 +52,8 @@ def setup_method(self, method): self.cli.register("admin", omero.plugins.admin.AdminControl, "TEST") # omero needs the etc/grid directory self.cli.dir = ( - old_div(old_div(old_div(old_div( - old_div(old_div( - old_div(path(__file__).dirname(), ".."), - ".."), ".."), ".."), ".."), ".."), "dist")) + path(__file__).dirname() / + ".." / ".." / ".." / ".." / ".." / ".." / "dist") self.args += ["admin"] def go(self): @@ -114,10 +105,8 @@ def setup_method(self, method): self.cli.register("admin", omero.plugins.admin.AdminControl, "TEST") # omero needs the etc/grid directory self.cli.dir = ( - old_div(old_div(old_div(old_div( - old_div(old_div( - old_div(path(__file__).dirname(), ".."), - ".."), ".."), ".."), ".."), ".."), "dist")) + path(__file__).dirname() / + ".." / ".." / ".." / ".." / ".." / ".." / "dist") self.args += ["admin"] def test_log(self): diff --git a/components/tools/OmeroPy/test/integration/clitest/test_chgrp.py b/components/tools/OmeroPy/test/integration/clitest/test_chgrp.py index 50b3de5a371..f685311759e 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_chgrp.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_chgrp.py @@ -19,8 +19,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from builtins import range -from future.utils import native_str import omero from omero.cli import NonZeroReturnCode from omero.plugins.chgrp import ChgrpControl @@ -64,7 +62,7 @@ def testChgrpMyData(self, object_type, target_group_perms, group_prefix): # check the object has been moved new_object = self.query.get(object_type, oid, {'omero.group': - native_str(target_group.id.val)}) + str(target_group.id.val)}) assert new_object.id.val == oid def testNonMember(self): diff --git a/components/tools/OmeroPy/test/integration/clitest/test_chown.py b/components/tools/OmeroPy/test/integration/clitest/test_chown.py index 73bf93dcc45..177b28d4f6a 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_chown.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_chown.py @@ -21,8 +21,6 @@ # from omero.cli import NonZeroReturnCode -from builtins import str -from builtins import range import omero from omero.plugins.chown import ChownControl from omero.testlib.cli import CLITest, RootCLITest diff --git a/components/tools/OmeroPy/test/integration/clitest/test_cleanse.py b/components/tools/OmeroPy/test/integration/clitest/test_cleanse.py index c7f98abab8f..8fb258faabb 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_cleanse.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_cleanse.py @@ -20,7 +20,6 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from future.utils import native_str from omero.testlib.cli import CLITest from omero.cli import NonZeroReturnCode from omero.cmd import Delete2 @@ -59,7 +58,7 @@ def setup_method(self, method): super(TestCleanseFullAdmin, self).setup_method(method) self.cli.register("admin", omero.plugins.admin.AdminControl, "TEST") self.args += ["admin", "cleanse"] - self.group_ctx = {'omero.group': native_str(self.group.id.val)} + self.group_ctx = {'omero.group': str(self.group.id.val)} config_service = self.root.sf.getConfigService() self.mrepo_dir = config_service.getConfigValue("omero.managed.dir") self.data_dir = config_service.getConfigValue("omero.managed.dir") diff --git a/components/tools/OmeroPy/test/integration/clitest/test_db.py b/components/tools/OmeroPy/test/integration/clitest/test_db.py index 2ef28804081..c08ea90b3be 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_db.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_db.py @@ -9,10 +9,6 @@ """ -from future import standard_library - -from builtins import str -from builtins import object import pytest import os from omero.plugins.db import DatabaseControl @@ -20,7 +16,6 @@ from omero.cli import NonZeroReturnCode from omero.cli import CLI import re -standard_library.install_aliases() # noqa OMERODIR = False diff --git a/components/tools/OmeroPy/test/integration/clitest/test_delete.py b/components/tools/OmeroPy/test/integration/clitest/test_delete.py index 8fca88525fc..0c8874d2f68 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_delete.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_delete.py @@ -19,8 +19,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from builtins import str -from builtins import range import omero from omero.plugins.delete import DeleteControl from omero.testlib.cli import CLITest diff --git a/components/tools/OmeroPy/test/integration/clitest/test_download.py b/components/tools/OmeroPy/test/integration/clitest/test_download.py index 91afa8163e8..abdd26c2c76 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_download.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_download.py @@ -19,8 +19,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from builtins import str -from builtins import object import os import pytest import omero @@ -33,12 +31,6 @@ from omero.model import NamedValue as NV from omero.util.temp_files import create_path -try: - int -except Exception: - # Python 3 - long = int - class TestDownload(CLITest): diff --git a/components/tools/OmeroPy/test/integration/clitest/test_group.py b/components/tools/OmeroPy/test/integration/clitest/test_group.py index aa6a7494f88..458fd1b606b 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_group.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_group.py @@ -18,7 +18,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from builtins import str from omero.plugins.group import GroupControl, defaultperms from omero.cli import NonZeroReturnCode from omero.testlib.cli import CLITest, RootCLITest diff --git a/components/tools/OmeroPy/test/integration/clitest/test_import.py b/components/tools/OmeroPy/test/integration/clitest/test_import.py index ccc13f3ed61..3fef3cf07cc 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_import.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_import.py @@ -18,12 +18,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from __future__ import division -from __future__ import print_function -from builtins import str -from builtins import range -from past.utils import old_div -from builtins import object from omero.testlib.cli import CLITest import pytest import stat @@ -32,13 +26,8 @@ import omero from omero.cli import NonZeroReturnCode from omero.rtypes import rstring -try: - plugin = __import__('omero.plugins.import', globals(), locals(), - ['ImportControl'], -1) -except ValueError: - # Python 3 - plugin = __import__('omero.plugins.import', globals(), locals(), - ['ImportControl'], 0) +plugin = __import__('omero.plugins.import', globals(), locals(), + ['ImportControl'], 0) ImportControl = plugin.ImportControl @@ -177,7 +166,7 @@ def do_import(self, capfd, strip_logs=True): return o, e def add_client_dir(self): - client_dir = old_div(old_div(self.omero_dist, "lib"), "client") + client_dir = self.omero_dist / "lib" / "client" self.args += ["--clientdir", client_dir] def check_other_output(self, out, import_type='default'): diff --git a/components/tools/OmeroPy/test/integration/clitest/test_import_bulk.py b/components/tools/OmeroPy/test/integration/clitest/test_import_bulk.py index fc12689edd2..53045247896 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_import_bulk.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_import_bulk.py @@ -18,10 +18,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from __future__ import division -from __future__ import print_function -from builtins import str -from past.utils import old_div from omero.cli import NonZeroReturnCode from omero.testlib.cli import CLITest from omero.plugins.sessions import SessionsControl @@ -29,13 +25,8 @@ import re import subprocess -try: - plugin = __import__('omero.plugins.import', globals(), locals(), - ['ImportControl'], -1) -except ValueError: - # Python 3 - plugin = __import__('omero.plugins.import', globals(), locals(), - ['ImportControl'], 0) +plugin = __import__('omero.plugins.import', globals(), locals(), + ['ImportControl'], 0) ImportControl = plugin.ImportControl @@ -127,8 +118,7 @@ def testBulk(self, tmpdir, capfd, monkeypatch): script = tmpdir.join("script1.sh") self.args += ["import", "-f", "--bulk", str(yml), - "--clientdir", old_div(old_div(self.omero_dist, "lib"), - "client")] + "--clientdir", self.omero_dist / "lib" / "client"] monkeypatch.setattr(sys, "argv", ["omero"]) out, err = self.do_import(capfd) diff --git a/components/tools/OmeroPy/test/integration/clitest/test_metadata.py b/components/tools/OmeroPy/test/integration/clitest/test_metadata.py index e128133826e..c4d860e3eb4 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_metadata.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_metadata.py @@ -29,7 +29,6 @@ from omero.rtypes import rdouble, unwrap from omero.testlib.cli import CLITest from omero.model.enums import UnitsLength -from past.builtins import long with warnings.catch_warnings(): warnings.simplefilter("ignore") @@ -47,7 +46,7 @@ def setup_method(self, method): conn = BlitzGateway(client_obj=self.client) self.imageid = unwrap(self.image.getId()) - assert type(self.imageid) is long + assert type(self.imageid) is int wrapper = conn.getObject("Image", self.imageid) self.md = Metadata(wrapper) diff --git a/components/tools/OmeroPy/test/integration/clitest/test_pyramids.py b/components/tools/OmeroPy/test/integration/clitest/test_pyramids.py index d7220ee7da4..77e506da65e 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_pyramids.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_pyramids.py @@ -20,8 +20,6 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from __future__ import print_function -from builtins import str from omero.testlib.cli import CLITest from omero.cli import NonZeroReturnCode from omero.model import PixelsI diff --git a/components/tools/OmeroPy/test/integration/clitest/test_script.py b/components/tools/OmeroPy/test/integration/clitest/test_script.py index d19c6cb9eab..50703d7a32d 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_script.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_script.py @@ -9,7 +9,6 @@ """ -from builtins import str from omero.testlib.cli import CLITest from omero.plugins.script import ScriptControl from omero.util.temp_files import create_path diff --git a/components/tools/OmeroPy/test/integration/clitest/test_search.py b/components/tools/OmeroPy/test/integration/clitest/test_search.py index 924000a780a..1324bfa408c 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_search.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_search.py @@ -20,7 +20,6 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from builtins import str import pytest from datetime import date diff --git a/components/tools/OmeroPy/test/integration/clitest/test_sessions.py b/components/tools/OmeroPy/test/integration/clitest/test_sessions.py index b5fc2c14372..3d8fc63ac58 100755 --- a/components/tools/OmeroPy/test/integration/clitest/test_sessions.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_sessions.py @@ -19,7 +19,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from builtins import str from omero.testlib.cli import CLITest from omero.cli import NonZeroReturnCode from omero.model import Experimenter diff --git a/components/tools/OmeroPy/test/integration/clitest/test_tag.py b/components/tools/OmeroPy/test/integration/clitest/test_tag.py index b423b323592..32617f3e15f 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_tag.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_tag.py @@ -19,9 +19,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from __future__ import print_function -from builtins import str -from builtins import range import re import pytest import omero diff --git a/components/tools/OmeroPy/test/integration/clitest/test_upload.py b/components/tools/OmeroPy/test/integration/clitest/test_upload.py index 68154fe6d3e..802b8ba2bb9 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_upload.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_upload.py @@ -19,7 +19,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from builtins import str import pytest import warnings diff --git a/components/tools/OmeroPy/test/integration/clitest/test_user.py b/components/tools/OmeroPy/test/integration/clitest/test_user.py index 1da53afb98a..20ea37aa1f9 100644 --- a/components/tools/OmeroPy/test/integration/clitest/test_user.py +++ b/components/tools/OmeroPy/test/integration/clitest/test_user.py @@ -19,7 +19,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from builtins import str from omero.cli import NonZeroReturnCode from omero.rtypes import rstring from omero.plugins.user import UserControl diff --git a/components/tools/OmeroPy/test/integration/fstest/test_rename.py b/components/tools/OmeroPy/test/integration/fstest/test_rename.py index 7eb502bb494..8d710caaa17 100644 --- a/components/tools/OmeroPy/test/integration/fstest/test_rename.py +++ b/components/tools/OmeroPy/test/integration/fstest/test_rename.py @@ -20,7 +20,6 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from future.utils import native_str import pytest from omero.testlib import AbstractRepoTest @@ -112,7 +111,7 @@ def test_rename_permissions(self, data): mrepo = client.getManagedRepository() ctx = client.getContext(group=gid) if renamer == "root": - ctx["omero.user"] = native_str(uid) + ctx["omero.user"] = str(uid) new_dir = prep_directory(client, mrepo) try: diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_annotation.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_annotation.py index 19dec0418aa..65d1817c45f 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_annotation.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_annotation.py @@ -12,11 +12,7 @@ - author_testimg_generated """ -from __future__ import print_function -from future import standard_library -from builtins import str -from builtins import range import time import datetime import os @@ -25,12 +21,6 @@ import omero.gateway from omero.rtypes import rstring from omero.gateway import FileAnnotationWrapper -try: - int -except Exception: - # Python 3 - long = int -standard_library.install_aliases() def _testAnnotation(obj, annclass, ns, value, sameOwner=False, diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_chgrp.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_chgrp.py index ff6c8d3daed..5cee7cad2eb 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_chgrp.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_chgrp.py @@ -12,7 +12,6 @@ """ -from builtins import range import omero from omero.rtypes import rstring from omero.cmd import State, ERR, OK diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_chmod.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_chmod.py index ab903f59d0f..a40bd5a3067 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_chmod.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_chmod.py @@ -13,8 +13,6 @@ """ -from builtins import object -from future.utils import native_str import omero import traceback from omero.rtypes import rstring @@ -454,7 +452,7 @@ def testWithoutWrappers(self, gatewaywrapper, author_testimg_generated): imgObj = image._obj gid = image.getDetails().group.id.val before = imgObj.getDetails().getPermissions().canEdit() - ctx = {'omero.group': native_str(gid)} + ctx = {'omero.group': str(gid)} imgObj = gatewaywrapper.gateway.getContainerService().getImages( "Image", (imgObj.id.val,), None, ctx)[0] after = imgObj.getDetails().getPermissions().canEdit() diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_connection.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_connection.py index 3ad5d679777..9ae4dfebcf3 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_connection.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_connection.py @@ -11,9 +11,6 @@ """ -from builtins import map -from builtins import object -from future.utils import native_str import omero import Ice from omero.gateway.scripts import dbhelpers @@ -204,7 +201,7 @@ def testCloseSession(self, gatewaywrapper): gatewaywrapper.gateway.setIdentity( gatewaywrapper.USER.name, gatewaywrapper.USER.passwd) setprop = gatewaywrapper.gateway.c.ic.getProperties().setProperty - list(map(lambda x: setprop(x[0], native_str(x[1])), + list(map(lambda x: setprop(x[0], str(x[1])), list(gatewaywrapper.gateway._ic_props.items()))) gatewaywrapper.gateway.c.ic.getImplicitContext().put( omero.constants.GROUP, gatewaywrapper.gateway.group) diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_delete.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_delete.py index 230994cac45..03c65a952f4 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_delete.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_delete.py @@ -12,8 +12,6 @@ """ -from builtins import str -from builtins import object import omero from omero.rtypes import wrap, unwrap import time diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_fs.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_fs.py index a0ff7e0e662..9f6e71d9a96 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_fs.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_fs.py @@ -27,9 +27,6 @@ """ -from builtins import str -from builtins import range -from builtins import object import pytest from omero.model import ImageI, PixelsI, FilesetI, FilesetEntryI, \ @@ -37,11 +34,6 @@ LongAnnotationI from omero.rtypes import rstring, rlong, rint, rtime from uuid import uuid4 -try: - int -except Exception: - # Python 3 - long = int def uuid(): diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_get_objects.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_get_objects.py index 98d521a993b..bfd09aa382a 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_get_objects.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_get_objects.py @@ -14,9 +14,6 @@ """ -from builtins import str -from builtins import range -from builtins import object import omero import uuid import pytest @@ -32,11 +29,6 @@ ScreenI, \ WellI, \ WellSampleI -try: - int -except Exception: - # Python 3 - long = int class TestDeleteObject (object): diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_helpers.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_helpers.py index ef54df5d95c..916b3c4f6ec 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_helpers.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_helpers.py @@ -7,14 +7,8 @@ """ -from builtins import object import omero import omero.gateway -try: - long # noqa -except Exception: - # Python 3 - long = int class TestHelperObjects(object): @@ -38,15 +32,11 @@ def testColorHolder(self): assert c1.getCss() == 'rgba(50,100,200,1.000)' def testOmeroType(self): - import sys omero_type = omero.gateway.omero_type assert isinstance(omero_type('rstring'), omero.RString) assert isinstance(omero_type(u'rstring'), omero.RString) assert isinstance(omero_type(1), omero.RInt) - if sys.version_info[0] < 3: - assert isinstance(omero_type(long(1)), omero.RLong) - else: - assert isinstance(omero_type(long(1)), omero.RInt) + assert isinstance(omero_type(int(1)), omero.RInt) assert isinstance(omero_type(int(1)), omero.RInt) assert isinstance(omero_type(False), omero.RBool) assert isinstance(omero_type(True), omero.RBool) diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_image.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_image.py index a98c15de471..cd13ec6b7c1 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_image.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_image.py @@ -13,12 +13,7 @@ - author_testimg_big """ -from __future__ import print_function -from builtins import zip -from builtins import str -from builtins import range -from builtins import object import pytest from io import BytesIO import omero diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_image_wrapper.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_image_wrapper.py index c146c8151f9..691b9b78b13 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_image_wrapper.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_image_wrapper.py @@ -13,19 +13,12 @@ """ -from builtins import range -from builtins import object import pytest from omero.testlib import ITest from omero.model import ImageI, ChannelI, LogicalChannelI, LengthI from omero.rtypes import rstring, rtime from datetime import datetime -try: - int -except Exception: - # Python 3 - long = int @pytest.fixture(scope='module') diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_missing_pyramid.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_missing_pyramid.py index bfd2daf78bb..d047a433060 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_missing_pyramid.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_missing_pyramid.py @@ -9,11 +9,7 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import division -from __future__ import print_function -from builtins import object -from past.utils import old_div import omero import pytest @@ -33,7 +29,7 @@ def testThrowException(self): assert False, "_prepareRE should have thrown an exception" except omero.ConcurrencyException as ce: print("Handling MissingPyramidException with backoff: %s secs" - % (old_div(ce.backOff, 1000))) + % (ce.backOff / 1000)) def testPrepareRenderingEngine(self): """ @@ -48,7 +44,7 @@ def testPrepareRenderingEngine(self): "_prepareRenderingEngine() should have thrown an exception" except omero.ConcurrencyException as ce: print("Handling MissingPyramidException with backoff: %s secs" - % (old_div(ce.backOff, 1000))) + % (ce.backOff / 1000)) def testGetChannels(self): """ Missing Pyramid shouldn't stop us from getting Channel Info """ diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_multi_group.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_multi_group.py index 26aec916d99..645f15dc573 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_multi_group.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_multi_group.py @@ -12,8 +12,6 @@ """ -from builtins import str -from builtins import object import omero import omero.scripts from omero.rtypes import rstring, rtime, rlong @@ -21,12 +19,6 @@ import time import pytest -try: - int -except Exception: - # Python 3 - long = int - PRIVATE = 'rw----' READONLY = 'rwr---' READANN = 'rwra--' diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_performance.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_performance.py index 821048bcaa3..82a384e8d34 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_performance.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_performance.py @@ -15,10 +15,7 @@ - gatewaywrapper """ -from __future__ import print_function -from builtins import range -from builtins import object import pytest import omero import time diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_pixels.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_pixels.py index ea0b83873ab..728363f8c0b 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_pixels.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_pixels.py @@ -14,9 +14,6 @@ """ -from builtins import str -from builtins import range -from builtins import object import omero import pytest diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_plate_wrapper.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_plate_wrapper.py index 0c271023a02..e2c4d5809fe 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_plate_wrapper.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_plate_wrapper.py @@ -13,19 +13,11 @@ """ -from builtins import str -from builtins import range -from builtins import object import pytest from omero.model import PlateI, WellI, WellSampleI, ImageI from omero.rtypes import rstring, rint, rtime from uuid import uuid4 -try: - int -except Exception: - # Python 3 - long = int def uuid(): diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_rdefs.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_rdefs.py index 75af95a0b41..bc98f283c76 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_rdefs.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_rdefs.py @@ -14,15 +14,11 @@ """ -from future import standard_library -from builtins import str -from builtins import object import pytest from io import BytesIO from PIL import Image, ImageChops import omero -standard_library.install_aliases() class TestRDefs (object): diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_search_objects.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_search_objects.py index 76b845ee2c3..044f3485f04 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_search_objects.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_search_objects.py @@ -29,9 +29,6 @@ """ -from builtins import object - - class TestGetObject (object): def testSearchObjects(self, gatewaywrapper): diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_services.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_services.py index 9432a5bad4b..0e12bb36ea7 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_services.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_services.py @@ -13,8 +13,6 @@ """ -from builtins import str -from builtins import object import omero from omero.grid import StringColumn diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_ticket10618.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_ticket10618.py index 1669f6b6733..f8cb92f6af6 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_ticket10618.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_ticket10618.py @@ -25,7 +25,6 @@ """ -from builtins import str from omero.testlib import ITest diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_user.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_user.py index 134a0ff9b67..43dc48abe39 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_user.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_user.py @@ -12,8 +12,6 @@ """ -from builtins import str -from builtins import object import omero import pytest diff --git a/components/tools/OmeroPy/test/integration/gatewaytest/test_wrapper.py b/components/tools/OmeroPy/test/integration/gatewaytest/test_wrapper.py index c9d492ef1a7..ec18cdc8c47 100644 --- a/components/tools/OmeroPy/test/integration/gatewaytest/test_wrapper.py +++ b/components/tools/OmeroPy/test/integration/gatewaytest/test_wrapper.py @@ -13,8 +13,6 @@ """ -from builtins import str -from builtins import object import Ice import omero import os diff --git a/components/tools/OmeroPy/test/integration/helpers.py b/components/tools/OmeroPy/test/integration/helpers.py index 33519e6b69c..e15f64c8272 100644 --- a/components/tools/OmeroPy/test/integration/helpers.py +++ b/components/tools/OmeroPy/test/integration/helpers.py @@ -24,7 +24,6 @@ """ -from builtins import range import omero.util.script_utils as scriptUtil from numpy import arange, uint8 diff --git a/components/tools/OmeroPy/test/integration/metadata/test_metadata_mapannotations.py b/components/tools/OmeroPy/test/integration/metadata/test_metadata_mapannotations.py index 3dd01e0fade..296764cf7b6 100644 --- a/components/tools/OmeroPy/test/integration/metadata/test_metadata_mapannotations.py +++ b/components/tools/OmeroPy/test/integration/metadata/test_metadata_mapannotations.py @@ -22,20 +22,13 @@ """ Integration test of metadata_mapannotation """ -from __future__ import print_function - -from builtins import zip from omero.testlib import ITest from omero.model import MapAnnotationI, NamedValue from omero.rtypes import unwrap, wrap from omero.util.metadata_mapannotations import ( CanonicalMapAnnotation, MapAnnotationManager) import pytest -import sys - -pythonminver = pytest.mark.skipif(sys.version_info < (2, 7), - reason="requires python2.7") def assert_equal_map_value(mva, mvb): @@ -47,7 +40,6 @@ def assert_equal_map_value(mva, mvb): assert a.value == b.value -@pythonminver class TestMapAnnotationManager(ITest): def create_mas(self): diff --git a/components/tools/OmeroPy/test/integration/metadata/test_populate.py b/components/tools/OmeroPy/test/integration/metadata/test_populate.py index 3b9bb61692a..6a2b9ec07bd 100644 --- a/components/tools/OmeroPy/test/integration/metadata/test_populate.py +++ b/components/tools/OmeroPy/test/integration/metadata/test_populate.py @@ -24,10 +24,6 @@ and populate_roi.py scripts. """ -from builtins import str -from builtins import zip -from builtins import range -from builtins import object from omero.testlib import ITest import string import csv @@ -35,7 +31,6 @@ import os.path import re import shutil -import sys from omero.api import RoiOptions from omero.grid import ImageColumn @@ -70,9 +65,6 @@ MAPR_NS_GENE = 'openmicroscopy.org/mapr/gene' -pythonminver = mark.skipif(sys.version_info < (2, 7), - reason="requires python2.7") - def coord2offset(coord): """ @@ -867,7 +859,6 @@ def assert_child_annotations(self, oas): raise Exception("Unknown dataset: %s" % ds) -@pythonminver class TestPopulateMetadataConfigLoad(ITest): def get_cfg_filepath(self): @@ -892,7 +883,6 @@ def test_get_config_remote(self): self._assert_configs(default_cfg, column_cfgs, advanced_cfgs) -@pythonminver class TestPopulateMetadataHelper(ITest): def _test_parsing_context(self, fixture, batch_size): @@ -985,7 +975,6 @@ def _test_delete_map_annotation_context(self, fixture, batch_size): assert len(fixture.get_all_map_annotations()) == 0 -@pythonminver class TestPopulateMetadataHelperPerMethod(TestPopulateMetadataHelper): # Some tests in this file check the counts of annotations in a fixed @@ -1004,7 +993,6 @@ def teardown_method(self, method): super(TestPopulateMetadataHelperPerMethod, self).teardown_class() -@pythonminver class TestPopulateMetadata(TestPopulateMetadataHelper): METADATA_FIXTURES = ( @@ -1082,7 +1070,6 @@ def testPopulateMetadataNsAnnsFail(self): self._test_bulk_to_map_annotation_context(fixture_fail, 2) -@pythonminver class TestPopulateMetadataDedup(TestPopulateMetadataHelperPerMethod): # Hard-code the number of expected map-annotations in these tests @@ -1236,7 +1223,6 @@ def testPopulateMetadataNsAnnsDedupDelete(self, ns): fixture1, fixture2, ns) -@pythonminver class TestPopulateMetadataConfigFiles(TestPopulateMetadataHelperPerMethod): def _init_fixture_attach_cfg(self): @@ -1425,7 +1411,6 @@ def get_target(self): return self.plate -@pythonminver class TestPopulateRois(ITest): def testPopulateRoisPlate(self): diff --git a/components/tools/OmeroPy/test/integration/metadata/test_pydict_text.py b/components/tools/OmeroPy/test/integration/metadata/test_pydict_text.py index f8c9a9928a4..7ef851c73c0 100644 --- a/components/tools/OmeroPy/test/integration/metadata/test_pydict_text.py +++ b/components/tools/OmeroPy/test/integration/metadata/test_pydict_text.py @@ -22,21 +22,14 @@ """ Test of the yaml/json parameters file handling """ -from __future__ import print_function -from builtins import str from omero.testlib import ITest from omero.rtypes import unwrap from omero.util import pydict_text_io import pytest -import sys -pythonminver = pytest.mark.skipif(sys.version_info < (2, 7), - reason="requires python2.7") - -@pythonminver class TestPydictTextIo(ITest): def getTestJson(self): diff --git a/components/tools/OmeroPy/test/integration/scriptstest/test_cli.py b/components/tools/OmeroPy/test/integration/scriptstest/test_cli.py index d5d713f3a85..d8ea0b56b38 100644 --- a/components/tools/OmeroPy/test/integration/scriptstest/test_cli.py +++ b/components/tools/OmeroPy/test/integration/scriptstest/test_cli.py @@ -22,7 +22,6 @@ """ -from builtins import str from omero.testlib import ITest import os diff --git a/components/tools/OmeroPy/test/integration/scriptstest/test_inputs.py b/components/tools/OmeroPy/test/integration/scriptstest/test_inputs.py index c740f5f7f80..3e386640ef0 100644 --- a/components/tools/OmeroPy/test/integration/scriptstest/test_inputs.py +++ b/components/tools/OmeroPy/test/integration/scriptstest/test_inputs.py @@ -23,7 +23,6 @@ Specifically test the parseInputs functionality which all scripts might want to use. """ -from __future__ import print_function from omero.testlib import ITest import omero @@ -37,7 +36,6 @@ # Setup to run as an integration test import os import sys -from past.builtins import long import omero.scripts as s import omero.util.script_utils as su @@ -62,7 +60,7 @@ raise Exception("Failed!") a = inputs["a"] - if not isinstance(a, (int, long)): + if not isinstance(a, int): raise Exception("Failed!") b = inputs.get("b") diff --git a/components/tools/OmeroPy/test/integration/scriptstest/test_ping.py b/components/tools/OmeroPy/test/integration/scriptstest/test_ping.py index 0090048eeda..5ee2a3a999d 100644 --- a/components/tools/OmeroPy/test/integration/scriptstest/test_ping.py +++ b/components/tools/OmeroPy/test/integration/scriptstest/test_ping.py @@ -25,7 +25,6 @@ """ -from builtins import str from omero.testlib import ITest import pytest import os diff --git a/components/tools/OmeroPy/test/integration/scriptstest/test_rand.py b/components/tools/OmeroPy/test/integration/scriptstest/test_rand.py index e8fc107c65b..a4dfea27fba 100644 --- a/components/tools/OmeroPy/test/integration/scriptstest/test_rand.py +++ b/components/tools/OmeroPy/test/integration/scriptstest/test_rand.py @@ -24,7 +24,6 @@ ServiceFactoryI.acquireProcessor(). """ -from __future__ import print_function from omero.testlib import ITest import omero diff --git a/components/tools/OmeroPy/test/integration/scriptstest/test_script_utils.py b/components/tools/OmeroPy/test/integration/scriptstest/test_script_utils.py index 0cd8334ea2a..d444553bc54 100644 --- a/components/tools/OmeroPy/test/integration/scriptstest/test_script_utils.py +++ b/components/tools/OmeroPy/test/integration/scriptstest/test_script_utils.py @@ -21,11 +21,7 @@ Integration test which checks the various methods from script_utils """ -from __future__ import division -from builtins import str -from builtins import range -from past.utils import old_div import pytest from omero.testlib import ITest import omero.util.script_utils as scriptUtil @@ -74,7 +70,7 @@ def test_numpy_to_image(self): min_c = c.getWindowMin() max_c = c.getWindowMax() channel_min_max.append((min_c, max_c)) - z = old_div(image.getSizeZ(), 2) + z = image.getSizeZ() // 2 t = 0 c = 0 try: @@ -104,7 +100,7 @@ def test_convert_numpy_array(self): min_c = c.getWindowMin() max_c = c.getWindowMax() channel_min_max.append((min_c, max_c)) - z = old_div(image.getSizeZ(), 2) + z = image.getSizeZ() // 2 t = 0 c = 0 try: @@ -130,7 +126,7 @@ def test_numpy_save_as_image(self, format, is_file): min_c = c.getWindowMin() max_c = c.getWindowMax() channel_min_max.append((min_c, max_c)) - z = old_div(image.getSizeZ(), 2) + z = image.getSizeZ() // 2 t = 0 c = 0 @@ -246,7 +242,7 @@ def f1(x, y): return y def f2(x, y): - return old_div((x + y), 2) + return (x + y) // 2 def f3(x, y): return x diff --git a/components/tools/OmeroPy/test/integration/tablestest/test_populate_metadata.py b/components/tools/OmeroPy/test/integration/tablestest/test_populate_metadata.py index 64fe8f828cd..fcb7ea165b8 100644 --- a/components/tools/OmeroPy/test/integration/tablestest/test_populate_metadata.py +++ b/components/tools/OmeroPy/test/integration/tablestest/test_populate_metadata.py @@ -24,7 +24,6 @@ """ -from builtins import range from omero.testlib import ITest import os diff --git a/components/tools/OmeroPy/test/integration/tablestest/test_service.py b/components/tools/OmeroPy/test/integration/tablestest/test_service.py index e1efba1da7b..865d716714a 100755 --- a/components/tools/OmeroPy/test/integration/tablestest/test_service.py +++ b/components/tools/OmeroPy/test/integration/tablestest/test_service.py @@ -23,15 +23,7 @@ Test of the Tables service """ -from __future__ import print_function -from future.utils import native_str -from builtins import str -from builtins import range -try: - from omero_ext.path import path -except ImportError: - # Python 2 - from path import path +from omero_ext.path import path import omero import omero.tables from omero.testlib import ITest @@ -313,7 +305,7 @@ def testCallContext(self): # Create a user in one group and a table. group1 = self.new_group() - gid1 = native_str(group1.id.val) + gid1 = str(group1.id.val) client = self.new_client(group1) admin = client.sf.getAdminService() sr = client.sf.sharedResources() diff --git a/components/tools/OmeroPy/test/integration/test_chgrp.py b/components/tools/OmeroPy/test/integration/test_chgrp.py index 3239f318016..a627f511fd2 100644 --- a/components/tools/OmeroPy/test/integration/test_chgrp.py +++ b/components/tools/OmeroPy/test/integration/test_chgrp.py @@ -24,8 +24,6 @@ """ -from builtins import range -from future.utils import native_str import omero import omero.gateway from omero.testlib import ITest @@ -308,7 +306,7 @@ def testChgrpOneDatasetFilesetErr(self): "Dataset should not be in group: %s" % target_gid # query in the target group - ctx = {'omero.group': native_str(target_gid)} + ctx = {'omero.group': str(target_gid)} # Check first Dataset moved dataset = query_service.get('Dataset', datasets[0].id.val, ctx) @@ -340,7 +338,7 @@ def testChgrpAllDatasetsFilesetOK(self): # Check both Datasets and Images moved query_service = client.sf.getQueryService() # query in the target group - ctx = {'omero.group': native_str(target_gid)} + ctx = {'omero.group': str(target_gid)} for i in range(2): dataset = query_service.get('Dataset', datasets[i].id.val, ctx) image = query_service.get('Image', images[i].id.val, ctx) @@ -373,7 +371,7 @@ def testChgrpOneDatasetFilesetOK(self): # Check Dataset and both Images moved query_service = client.sf.getQueryService() - ctx = {'omero.group': native_str('-1')} # query across groups + ctx = {'omero.group': '-1'} # query across groups dataset = query_service.get('Dataset', ds.id.val, ctx) assert target_gid == dataset.details.group.id.val, \ "Dataset should be in group: %s" % target_gid @@ -434,7 +432,7 @@ def testChgrpDatasetTwoFilesetsErr(self): "Image should not be in group: %s" % target_gid # query in the target group - ctx = {'omero.group': native_str(target_gid)} + ctx = {'omero.group': str(target_gid)} # Check Dataset moved dataset = query_service.get('Dataset', ds.id.val, ctx) @@ -465,7 +463,7 @@ def testChgrpDatasetCheckFsGroup(self): self.do_submit(chgrp, client) # Check the group of the fileset is in sync with image. - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} qs = client.sf.getQueryService() image1 = qs.get("Image", images[0].id.val, ctx) fs_id = image1.fileset.id.val @@ -495,7 +493,7 @@ def testChgrpFilesetOK(self): # Check Fileset and both Images moved and # thus the Fileset is in sync with Images. - ctx = {'omero.group': native_str('-1')} # query across groups + ctx = {'omero.group': '-1'} # query across groups fileset = query.get('Fileset', fs_id, ctx) assert target_gid == fileset.details.group.id.val, \ "Fileset should be in group: %s" % target_gid @@ -561,7 +559,7 @@ def testChgrp11109(self): query = client.sf.getQueryService() with pytest.raises(omero.ValidationException): query.get("ScreenPlateLink", link.id.val, - {"omero.group": native_str("-1")}) + {"omero.group": "-1"}) def testChgrpDatasetWithImage(self): """ @@ -583,7 +581,7 @@ def testChgrpDatasetWithImage(self): self.link(d, i, client=client) self.change_group([d], target_gid, client) - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} assert target_gid == query.get("Image", i.id.val, ctx).details.group.id.val assert target_gid == query.get("Dataset", @@ -611,7 +609,7 @@ def testChgrpPDIReverseLinkOrder(self): self.link(d, i, client=client) self.change_group([p], target_gid, client=client) - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} assert target_gid == query.get("Project", p.id.val, ctx).details.group.id.val assert target_gid == query.get("Dataset", @@ -642,7 +640,7 @@ def testChgrpTwoDatasetsLinkedToSingleImageDefault(self): self.link(d2, i, client=client) self.change_group([d1], target_gid, client=client) - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} assert target_gid == query.get("Dataset", d1.id.val, ctx).details.group.id.val assert target_gid != query.get("Dataset", @@ -678,7 +676,7 @@ def testChgrpTwoDatasetsLinkedToSingleImageHard(self): groupId=target_gid) self.do_submit(chgrp, client) - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} assert target_gid == query.get("Dataset", d1.id.val, ctx).details.group.id.val assert target_gid != query.get("Dataset", @@ -711,7 +709,7 @@ def testChgrpProjectWithDatasetLinkedToImageWithOtherDatasetDefault(self): self.link(p, d1, client=client) self.change_group([p], target_gid, client) - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} assert target_gid == query.get("Project", p.id.val, ctx).details.group.id.val assert target_gid == query.get("Dataset", @@ -749,7 +747,7 @@ def testChgrpProjectWithDatasetLinkedToImageWithOtherDatasetHard(self): groupId=target_gid) self.do_submit(chgrp, client) - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} assert target_gid == query.get("Project", p.id.val, ctx).details.group.id.val assert target_gid == query.get("Dataset", @@ -784,7 +782,7 @@ def testChgrpDatasetWithImageLinkedToTwoProjects(self): self.link(d, i, client=client) self.change_group([d], target_gid, client) - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} assert not target_gid == query.get("Project", p1.id.val, ctx).details.group.id.val @@ -820,7 +818,7 @@ def testChgrpProjectLinkedToDatasetAndImageDefault(self): self.link(d, i, client=client) self.change_group([p1], target_gid, client) - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} assert target_gid == query.get("Project", p1.id.val, ctx).details.group.id.val assert target_gid != query.get("Dataset", @@ -858,7 +856,7 @@ def testChgrpProjectLinkedToDatasetAndImageHard(self): groupId=target_gid) self.do_submit(chgrp, client) - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} assert target_gid == query.get("Project", p1.id.val, ctx).details.group.id.val assert target_gid != query.get("Project", @@ -891,7 +889,7 @@ def testChgrpProjectLinkedToDatasetDefault(self): self.link(p2, d, client=client) self.change_group([p1], target_gid, client) - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} assert target_gid == query.get("Project", p1.id.val, ctx).details.group.id.val assert target_gid != query.get("Dataset", @@ -925,7 +923,7 @@ def testChgrpProjectLinkedToDatasetHard(self): groupId=target_gid) self.do_submit(chgrp, client) - ctx = {'omero.group': native_str('-1')} + ctx = {'omero.group': '-1'} assert target_gid == query.get("Project", p1.id.val, ctx).details.group.id.val assert target_gid != query.get("Project", @@ -1043,7 +1041,7 @@ def createDSInGroup(self, gid, name=None, client=None): name = self.uuid() if client is None: client = self.client - ctx = {'omero.group': native_str(gid)} + ctx = {'omero.group': str(gid)} update = client.sf.getUpdateService() ds = self.new_dataset(name) return update.saveAndReturnObject(ds, ctx) @@ -1159,7 +1157,7 @@ def testChgrpDatasetToTargetProject(self, credentials): update = client.sf.getUpdateService() ds = self.make_dataset(client=client) # ...and Project in target group - ctx = {'omero.group': native_str(target_gid)} + ctx = {'omero.group': str(target_gid)} pr = self.new_project() pr = update.saveAndReturnObject(pr, ctx) diff --git a/components/tools/OmeroPy/test/integration/test_chmod.py b/components/tools/OmeroPy/test/integration/test_chmod.py index 89d2c2429af..7c6efce9963 100644 --- a/components/tools/OmeroPy/test/integration/test_chmod.py +++ b/components/tools/OmeroPy/test/integration/test_chmod.py @@ -24,8 +24,6 @@ """ -from builtins import str -from past.builtins import basestring import time from omero.testlib import ITest import omero @@ -47,8 +45,8 @@ def refresh(self, client): client.sf.getAdminService().getEventContext() # Refresh def assertEqPerms(self, a, b): - assert isinstance(a, (omero.model.PermissionsI, basestring)) - assert isinstance(b, (omero.model.PermissionsI, basestring)) + assert isinstance(a, (omero.model.PermissionsI, str)) + assert isinstance(b, (omero.model.PermissionsI, str)) assert str(a) == str(b) def addData(self): diff --git a/components/tools/OmeroPy/test/integration/test_client_ctors.py b/components/tools/OmeroPy/test/integration/test_client_ctors.py index 4b83b8ff9fa..ac196cce176 100644 --- a/components/tools/OmeroPy/test/integration/test_client_ctors.py +++ b/components/tools/OmeroPy/test/integration/test_client_ctors.py @@ -23,9 +23,7 @@ Tests of the omero.client constructors """ -from __future__ import print_function -from future.utils import native_str import os from omero.testlib import ITest import omero @@ -60,7 +58,7 @@ def testEmptyInitializationDataConstructor(self): # With no argument id.properties is empty id.properties = Ice.createProperties() id.properties.setProperty("omero.host", self.host) - id.properties.setProperty("omero.port", native_str(self.port)) + id.properties.setProperty("omero.port", str(self.port)) id.properties.setProperty("omero.user", "root") id.properties.setProperty("omero.pass", self.rootpasswd) c = omero.client(id=id) diff --git a/components/tools/OmeroPy/test/integration/test_cmdcallback.py b/components/tools/OmeroPy/test/integration/test_cmdcallback.py index 576970c754d..c28af482cc1 100644 --- a/components/tools/OmeroPy/test/integration/test_cmdcallback.py +++ b/components/tools/OmeroPy/test/integration/test_cmdcallback.py @@ -23,7 +23,6 @@ Test of the CmdCallbackI object """ -from builtins import range import threading from omero.testlib import ITest diff --git a/components/tools/OmeroPy/test/integration/test_delete.py b/components/tools/OmeroPy/test/integration/test_delete.py index 60eaf342fb9..6146070f570 100644 --- a/components/tools/OmeroPy/test/integration/test_delete.py +++ b/components/tools/OmeroPy/test/integration/test_delete.py @@ -23,11 +23,7 @@ Integration test for delete testing """ -from __future__ import print_function -from builtins import str -from builtins import range -from future.utils import native_str import traceback from omero.testlib import ITest import pytest @@ -134,7 +130,7 @@ def testCheckIfDeleted(self): cmd = Delete2(targetObjects={"Image": [iid]}) handle = self.client.sf.submit(cmd) callback = self.wait_on_cmd(self.client, handle) - cbString = native_str(handle) + cbString = str(handle) callback.close(True) # Don't close handle @@ -313,11 +309,11 @@ def test3639(self): keep = ChildOption(excludeType=["Image"]) dc = Delete2( targetObjects={'Dataset': [dataset.id.val]}, childOptions=[keep]) - handlers.append(native_str(client_o.sf.submit(dc))) + handlers.append(str(client_o.sf.submit(dc))) imageToDelete = images[2].id.val dc2 = Delete2(targetObjects={'Image': [imageToDelete]}) - handlers.append(native_str(client_o.sf.submit(dc2))) + handlers.append(str(client_o.sf.submit(dc2))) def _formatReport(delete_handle): """ diff --git a/components/tools/OmeroPy/test/integration/test_files.py b/components/tools/OmeroPy/test/integration/test_files.py index 2d8ff59109b..b772bb6573e 100644 --- a/components/tools/OmeroPy/test/integration/test_files.py +++ b/components/tools/OmeroPy/test/integration/test_files.py @@ -25,7 +25,6 @@ """ -from builtins import str import pytest from omero.testlib import ITest diff --git a/components/tools/OmeroPy/test/integration/test_icontainer.py b/components/tools/OmeroPy/test/integration/test_icontainer.py index 25d63884ea8..35dc8306318 100644 --- a/components/tools/OmeroPy/test/integration/test_icontainer.py +++ b/components/tools/OmeroPy/test/integration/test_icontainer.py @@ -24,8 +24,6 @@ """ -from builtins import str -from builtins import range from omero.testlib import ITest import omero from omero_model_CommentAnnotationI import CommentAnnotationI diff --git a/components/tools/OmeroPy/test/integration/test_iquery.py b/components/tools/OmeroPy/test/integration/test_iquery.py index 53b6497e9e5..9c961b2bcf8 100644 --- a/components/tools/OmeroPy/test/integration/test_iquery.py +++ b/components/tools/OmeroPy/test/integration/test_iquery.py @@ -23,11 +23,7 @@ Integration test focused on the omero.api.IQuery interface. """ -from __future__ import print_function -from __future__ import absolute_import -from builtins import range -from future.utils import native_str from omero.testlib import ITest from omero.rtypes import rstring from omero.rtypes import unwrap, wrap @@ -54,7 +50,7 @@ def testGetPixelsCount(self): * p.sizeZ * p.sizeT * p.sizeC) from Pixels p group by p.pixelsType.value """, - None, {"omero.group": native_str(group.id.val)}) + None, {"omero.group": str(group.id.val)}) rv = unwrap(rtypeseqseq) as_map = dict() for obj_array in rv: @@ -116,7 +112,7 @@ def testQueryTaggedUnique(self): link.child = TagAnnotationI(lnk.child.id, False) rootLinks.append(link) rootUpdate.saveAndReturnArray(rootLinks, {'omero.group': - native_str(groupId)}) + str(groupId)}) q = """select distinct new map(obj.id as id, obj.name as name, @@ -144,7 +140,7 @@ def testQueryTaggedUnique(self): where alink.child.id=:tid and alink.parent.id=obj.id)""" query = q % uniqueClause result1 = queryService.projection(query, params, - {'omero.group': native_str(groupId)}) + {'omero.group': str(groupId)}) assert len(result1) == tagCount # Without the select statement, we get the same image returned @@ -152,7 +148,7 @@ def testQueryTaggedUnique(self): clause = "alink.child.id=:tid" query = q % clause result2 = queryService.projection(query, params, - {'omero.group': native_str(groupId)}) + {'omero.group': str(groupId)}) assert len(result2) == tagCount for idx in range(len(result1)-1): # Omit final since == isn't defined for Ice objects. diff --git a/components/tools/OmeroPy/test/integration/test_isession.py b/components/tools/OmeroPy/test/integration/test_isession.py index 8e68db9e3f6..3761b33565d 100644 --- a/components/tools/OmeroPy/test/integration/test_isession.py +++ b/components/tools/OmeroPy/test/integration/test_isession.py @@ -23,7 +23,6 @@ Integration test focused on the omero.api.ISession interface. """ -from __future__ import print_function import os from omero.testlib import ITest diff --git a/components/tools/OmeroPy/test/integration/test_ishare.py b/components/tools/OmeroPy/test/integration/test_ishare.py index 99bfe63580f..8b2d044f409 100644 --- a/components/tools/OmeroPy/test/integration/test_ishare.py +++ b/components/tools/OmeroPy/test/integration/test_ishare.py @@ -9,7 +9,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from future.utils import native_str import time from omero.testlib import ITest import pytest @@ -19,12 +18,6 @@ from omero.rtypes import rtime, rlong, rlist, rint from omero.gateway import BlitzGateway -try: - int -except Exception: - # Python 3 - long = int - class TestIShare(ITest): @@ -260,7 +253,7 @@ def testCanAnnotate(self): p = omero.sys.Parameters() p.map = {"ids": rlist([rlong(img.id.val)])} sql = "select im from Image im where im.id in (:ids) order by im.name" - res = query2.findAllByQuery(sql, p, {'omero.share': native_str(sid)}) + res = query2.findAllByQuery(sql, p, {'omero.share': str(sid)}) assert 1 == len(res) # User should not be able to annotate private image. @@ -920,9 +913,9 @@ def test8513(self): assert False, "Error: Member shouldn't access image in share!" rv = member_query.find("Image", image.id.val, - {'omero.share': native_str(sid), + {'omero.share': str(sid), 'omero.group': - native_str(image.details.group.id.val)}) + str(image.details.group.id.val)}) assert image.id.val == rv.id.val # join share @@ -934,7 +927,7 @@ def test8513(self): user_query = user_client.sf.getQueryService() rv = user_query.find("Image", image2.id.val, {'omero.group': - native_str(image2.details.group.id.val)}) + str(image2.details.group.id.val)}) assert image2.id.val == rv.id.val finally: user_client.__del__() @@ -975,7 +968,7 @@ def test8704(self): sql = "select im from Image im join fetch im.details.owner " \ "join fetch im.details.group where im.id=:id order by im.name" image = owner.sf.getQueryService().findAllByQuery( - sql, p, {'omero.group': native_str(owner_groupId)})[0] + sql, p, {'omero.group': str(owner_groupId)})[0] rdefs = owner.sf.getQueryService().findAll("RenderingDef", None) @@ -1005,7 +998,7 @@ def test8704(self): assert False, "Error: Member shouldn't access image in share!" rv = member_query.find("Image", image.id.val, - {'omero.share': native_str(sid)}) + {'omero.share': str(sid)}) # Not sure which group to set # 'omero.group':str(image.details.group.id.val) # or 'omero.group':str(member_groupId) @@ -1015,7 +1008,7 @@ def test8704(self): member_tb = member.sf.createThumbnailStore() try: member_tb.setPixelsId(rdefs[0].pixels.id.val, - {'omero.share': native_str(sid)}) + {'omero.share': str(sid)}) finally: member_tb.close() # join share @@ -1027,7 +1020,7 @@ def test8704(self): user_query = user_client.sf.getQueryService() rv = user_query.find("Image", image2.id.val, {'omero.group': - native_str(image2.details.group.id.val)}) + str(image2.details.group.id.val)}) assert image2.id.val == rv.id.val finally: user_client.__del__() diff --git a/components/tools/OmeroPy/test/integration/test_itimeline.py b/components/tools/OmeroPy/test/integration/test_itimeline.py index d54091d0cad..b4729f73954 100644 --- a/components/tools/OmeroPy/test/integration/test_itimeline.py +++ b/components/tools/OmeroPy/test/integration/test_itimeline.py @@ -9,7 +9,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import range import time import pytest from omero.testlib import ITest @@ -17,12 +16,6 @@ from omero.rtypes import rint, rlong, rstring, rtime -try: - int -except Exception: - # Python 3 - long = int - class TestITimeline(ITest): diff --git a/components/tools/OmeroPy/test/integration/test_itypes.py b/components/tools/OmeroPy/test/integration/test_itypes.py index acfa5da8248..7fbbd338417 100644 --- a/components/tools/OmeroPy/test/integration/test_itypes.py +++ b/components/tools/OmeroPy/test/integration/test_itypes.py @@ -9,7 +9,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import str from omero.testlib import ITest from omero.rtypes import rstring diff --git a/components/tools/OmeroPy/test/integration/test_iupdate.py b/components/tools/OmeroPy/test/integration/test_iupdate.py index e22993484ad..5dc53714a3d 100644 --- a/components/tools/OmeroPy/test/integration/test_iupdate.py +++ b/components/tools/OmeroPy/test/integration/test_iupdate.py @@ -10,7 +10,6 @@ Integration test focused on the omero.api.IUpdate interface. """ -from builtins import range from omero.testlib import ITest import omero import pytest diff --git a/components/tools/OmeroPy/test/integration/test_mail.py b/components/tools/OmeroPy/test/integration/test_mail.py index 0c0acee9f49..ea7c647b60e 100644 --- a/components/tools/OmeroPy/test/integration/test_mail.py +++ b/components/tools/OmeroPy/test/integration/test_mail.py @@ -25,7 +25,6 @@ etc/blitz/mail-server.example """ -from builtins import str from omero.testlib import ITest import omero diff --git a/components/tools/OmeroPy/test/integration/test_mapannotation.py b/components/tools/OmeroPy/test/integration/test_mapannotation.py index ff1e20d37a8..248e5c66a5e 100644 --- a/components/tools/OmeroPy/test/integration/test_mapannotation.py +++ b/components/tools/OmeroPy/test/integration/test_mapannotation.py @@ -24,7 +24,6 @@ introduced in 5.1. """ -from builtins import range from omero.testlib import ITest import pytest import omero diff --git a/components/tools/OmeroPy/test/integration/test_model51.py b/components/tools/OmeroPy/test/integration/test_model51.py index 51416caf21e..fc17aefbd15 100644 --- a/components/tools/OmeroPy/test/integration/test_model51.py +++ b/components/tools/OmeroPy/test/integration/test_model51.py @@ -23,7 +23,6 @@ Basic tests for additions/changes to the 5.1 model. """ -from builtins import str from omero.testlib import ITest import pytest import omero diff --git a/components/tools/OmeroPy/test/integration/test_permissions.py b/components/tools/OmeroPy/test/integration/test_permissions.py index 52a491164e5..2d050d407b1 100644 --- a/components/tools/OmeroPy/test/integration/test_permissions.py +++ b/components/tools/OmeroPy/test/integration/test_permissions.py @@ -24,9 +24,6 @@ """ -from builtins import str -from builtins import object -from future.utils import native_str import pytest from omero.testlib import ITest, PFS import omero @@ -38,13 +35,6 @@ from omero.rtypes import rbool, rstring, unwrap -try: - int -except Exception: - # Python 3 - long = int - - class CallContextFixture(object): """ @@ -131,7 +121,7 @@ def testLoginToPublicGroupTicket1940(self): ec = self.client.sf.getAdminService().getEventContext() public_client = omero.client(rv) public_client.getImplicitContext().put("omero.group", - native_str(uuid)) + str(uuid)) sf = public_client.createSession(ec.userName, ec.userName) ec = sf.getAdminService().getEventContext() assert uuid == ec.groupName @@ -419,11 +409,11 @@ def setOwnersOfGroup(self, available, owners): rm_exps = list() for om in old_owners: for a in available: - if om.id == long(str(a)): + if om.id == int(str(a)): rm_exps.append(om._obj) for oa in old_available: for o in owners: - if oa.id == long(str(o)): + if oa.id == int(str(o)): add_exps.append(oa._obj) #final save @@ -681,7 +671,7 @@ def testPrivateGroupCallContext(self): # Setup groups as per Carlos' instructions (Feb 23) groupX = self.new_group(perms="rwrw--") clientA, userA = self.new_client_and_user(group=groupX) - gid = native_str(groupX.id.val) + gid = str(groupX.id.val) groupY = self.new_group(perms="rw----") clientB, userB = self.new_client_and_user(group=groupY) @@ -747,8 +737,8 @@ def testOmeroUserAsNonAdmin(self): self.assertAsUser(client, image, user, group) def assertAsUser(self, client, image, user, group): - callcontext = {"omero.user": native_str(user.id.val), - "omero.group": native_str(group.id.val)} + callcontext = {"omero.user": str(user.id.val), + "omero.group": str(group.id.val)} query = client.sf.getQueryService() query.get("Image", image.id.val, callcontext) @@ -834,7 +824,7 @@ def testUseOfRawFileBeanScriptReadGroupMinusOne(self): def testUseOfRawFileBeanScriptReadCorrectGroup(self): self.assertValidScript(lambda v: {'omero.group': - native_str(v.details.group.id.val)}) + str(v.details.group.id.val)}) @pytest.mark.broken(ticket="11539") def testUseOfRawFileBeanScriptReadCorrectGroupAndUser(self): @@ -936,7 +926,7 @@ def testProjectionPermissions(self, fixture): proj = unwrap(reader.projection( "select p from Project p where p.id = :id", ParametersI().addId(project.id.val), - {"omero:group": native_str(group)}))[0][0] + {"omero:group": str(group)}))[0][0] assert fixture.canRead perms = proj.details.permissions value = { diff --git a/components/tools/OmeroPy/test/integration/test_pixelsService.py b/components/tools/OmeroPy/test/integration/test_pixelsService.py index 3e38c45b955..6333f738a9d 100644 --- a/components/tools/OmeroPy/test/integration/test_pixelsService.py +++ b/components/tools/OmeroPy/test/integration/test_pixelsService.py @@ -23,7 +23,6 @@ Tests for the Pixels service. """ -from __future__ import absolute_import import omero import omero.gateway diff --git a/components/tools/OmeroPy/test/integration/test_rawpixelsstore.py b/components/tools/OmeroPy/test/integration/test_rawpixelsstore.py index f032f76debb..de9542a9489 100644 --- a/components/tools/OmeroPy/test/integration/test_rawpixelsstore.py +++ b/components/tools/OmeroPy/test/integration/test_rawpixelsstore.py @@ -8,23 +8,13 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import division -from builtins import hex -from builtins import range -from past.utils import old_div import omero import threading from omero.testlib import ITest -import pytest from omero.util.tiles import TileLoopIteration from omero.util.tiles import RPSTileLoop -try: - int -except Exception: - # Python 3 - long = int __import__("sys") @@ -38,12 +28,7 @@ def check_pix(self, pix): try: rps.setPixelsId(pix.id.val, True) md = rps.calculateMessageDigest() - try: - # python 3 - sha1 = format(int.from_bytes(md, 'big'), 'x') - except Exception: - # python 2 - sha1 = hex(int(md.encode('hex'), 16))[2:] + sha1 = format(int.from_bytes(md, 'big'), 'x') sha1 = sha1.rjust(40, "0") assert sha1 == pix.sha1.val finally: @@ -124,7 +109,7 @@ def testRomioToPyramid(self, tmpdir): success = True except omero.MissingPyramidException as mpm: assert int(pix) == mpm.pixelsID - backOff = old_div(mpm.backOff, 1000) + backOff = mpm.backOff / 1000 event = concurrency.get_event("testRomio") event.wait(backOff) # seconds i -= 1 @@ -159,7 +144,7 @@ def test2RomioToPyramidWithNegOne(self, tmpdir): success = True except omero.MissingPyramidException as mpm: assert int(pix) == mpm.pixelsID - backOff = old_div(mpm.backOff, 1000) + backOff = mpm.backOff / 1000 event = concurrency.get_event("testRomio") event.wait(backOff) # seconds i -= 1 @@ -193,7 +178,7 @@ def testPyramidConcurrentAccess(self, tmpdir): success = True except omero.MissingPyramidException as mpm: assert int(pix) == mpm.pixelsID - backOff = old_div(mpm.backOff, 1000) + backOff = mpm.backOff / 1000 event = concurrency.get_event("testRomio") event.wait(backOff) # seconds i -= 1 @@ -239,8 +224,6 @@ def run(self): class TestTiles(ITest): - @pytest.mark.skipif("sys.version_info < (2,7)", - reason="This fails with Python < 2.7 and Ice >= 3.5") def testTiles(self): from omero.model import PixelsI from omero.sys import ParametersI @@ -278,7 +261,7 @@ def f(x, y): """ create some fake pixel data tile (2D numpy array) """ - return old_div((x * y), (1 + x + y)) + return (x * y) // (1 + x + y) def mktile(w, h): tile = fromfunction(f, (w, h)) diff --git a/components/tools/OmeroPy/test/integration/test_reimport.py b/components/tools/OmeroPy/test/integration/test_reimport.py index 8e506220589..a48216ce4ae 100644 --- a/components/tools/OmeroPy/test/integration/test_reimport.py +++ b/components/tools/OmeroPy/test/integration/test_reimport.py @@ -20,8 +20,6 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -from builtins import str -from builtins import range from omero.testlib import ITest from omero.callbacks import CmdCallbackI diff --git a/components/tools/OmeroPy/test/integration/test_render.py b/components/tools/OmeroPy/test/integration/test_render.py index 70a3da92b66..061268dc57a 100644 --- a/components/tools/OmeroPy/test/integration/test_render.py +++ b/components/tools/OmeroPy/test/integration/test_render.py @@ -24,7 +24,6 @@ rendering a 'region' of big images. """ -from builtins import range import omero import logging from omero.testlib import ITest @@ -38,12 +37,6 @@ except Exception: logging.error('No Pillow installed') -try: - int -except Exception: - # Python 3 - long = int - from numpy import asarray, array_equal diff --git a/components/tools/OmeroPy/test/integration/test_reporawfilestore.py b/components/tools/OmeroPy/test/integration/test_reporawfilestore.py index d14563d994a..6ce94e83bd7 100644 --- a/components/tools/OmeroPy/test/integration/test_reporawfilestore.py +++ b/components/tools/OmeroPy/test/integration/test_reporawfilestore.py @@ -14,18 +14,12 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import division -from past.utils import old_div import pytest import omero import omero.gateway -try: - from omero_ext.path import path -except ImportError: - # Python 2 - from path import path +from omero_ext.path import path from omero.testlib import AbstractRepoTest @@ -35,7 +29,7 @@ def setup_method(self, method): super(TestRepoRawFileStore, self).setup_method(method) tmp_dir = path(self.unique_dir) self.repoPrx = self.get_managed_repo() - self.repo_filename = old_div(tmp_dir, self.uuid()) + ".txt" + self.repo_filename = tmp_dir / self.uuid() + ".txt" def testCreate(self): rfs = self.repoPrx.file(self.repo_filename, "rw") diff --git a/components/tools/OmeroPy/test/integration/test_repository.py b/components/tools/OmeroPy/test/integration/test_repository.py index 6af4bbd3b86..07e4ed3730d 100644 --- a/components/tools/OmeroPy/test/integration/test_repository.py +++ b/components/tools/OmeroPy/test/integration/test_repository.py @@ -8,14 +8,7 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import division -from __future__ import print_function - -from builtins import zip -from builtins import str -from builtins import range -from past.utils import old_div -from builtins import object + import pytest import omero @@ -597,7 +590,7 @@ def testImport(self): folder = create_path(folder=True) for x in range(200): name = "%s.unknown" % x - (old_div(folder, name)).touch() + (folder / name).touch() paths = folder.files() proc = mrepo.importPaths(paths) hashes = self.upload_folder(proc, folder) diff --git a/components/tools/OmeroPy/test/integration/test_rois.py b/components/tools/OmeroPy/test/integration/test_rois.py index aa24a954b43..1a1c5070e3f 100644 --- a/components/tools/OmeroPy/test/integration/test_rois.py +++ b/components/tools/OmeroPy/test/integration/test_rois.py @@ -8,8 +8,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import print_function -from builtins import object from omero.testlib import ITest import omero from omero.rtypes import rdouble, rstring, rint diff --git a/components/tools/OmeroPy/test/integration/test_scripts.py b/components/tools/OmeroPy/test/integration/test_scripts.py index 58931c8760e..943cbd14fe8 100644 --- a/components/tools/OmeroPy/test/integration/test_scripts.py +++ b/components/tools/OmeroPy/test/integration/test_scripts.py @@ -8,12 +8,7 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import division -from __future__ import print_function -from builtins import str -from builtins import range -from past.utils import old_div import os import time import pytest @@ -28,11 +23,6 @@ from omero.rtypes import rstring, wrap, unwrap from omero.util.temp_files import create_path -try: - int -except Exception: - # Python 3 - long = int PUBLIC = omero.model.PermissionsI("rwrwrw") @@ -419,7 +409,7 @@ def testParamLoadingPerformanceTicket2285(self): impl = omero.processor.usermode_processor(root_client) try: params_time, params = self.timeit(svc.getParams, scriptID) - assert params_time < (old_div(upload_time, 10)), \ + assert params_time < (upload_time / 10), \ "upload_time(%s) <= 10 * params_time(%s)!" % \ (upload_time, params_time) assert params_time < 0.1, "params_time(%s) >= 0.01 !" % params_time diff --git a/components/tools/OmeroPy/test/integration/test_simple.py b/components/tools/OmeroPy/test/integration/test_simple.py index fa874062dbe..858967af4d3 100644 --- a/components/tools/OmeroPy/test/integration/test_simple.py +++ b/components/tools/OmeroPy/test/integration/test_simple.py @@ -10,7 +10,6 @@ """ -from builtins import str from omero.testlib import ITest diff --git a/components/tools/OmeroPy/test/integration/test_thumbnailPerms.py b/components/tools/OmeroPy/test/integration/test_thumbnailPerms.py index 6a13b0064ee..db84538e931 100644 --- a/components/tools/OmeroPy/test/integration/test_thumbnailPerms.py +++ b/components/tools/OmeroPy/test/integration/test_thumbnailPerms.py @@ -25,7 +25,6 @@ """ -from future.utils import native_str import Ice import pytest from omero.testlib import ITest @@ -96,7 +95,7 @@ def testThumbs(self): owner_client = self.new_client( user=newOwner, password=newOwner.omeName.val) - group_ctx = {"omero.group": native_str(privateGroup)} + group_ctx = {"omero.group": str(privateGroup)} self.getThumbnail(owner_client.sf, privateImageId, *group_ctx) # check that we can't get thumbnails for images in other groups assert self.getThumbnail(owner_client.sf, readOnlyImageId) is None @@ -223,28 +222,28 @@ def assert10618(self, group, tester, preview, *ctx): def testPrivate10618RootWithGrpCtx(self): group = self.new_group(perms="rw----") - grp_ctx = {"omero.group": native_str(group.id.val)} + grp_ctx = {"omero.group": str(group.id.val)} self.assert10618(group, self.root, True, grp_ctx) def testPrivate10618RootWithGrpCtxButNoLoad(self): group = self.new_group(perms="rw----") - grp_ctx = {"omero.group": native_str(group.id.val)} + grp_ctx = {"omero.group": str(group.id.val)} self.assert10618(group, self.root, False, grp_ctx) def testReadOnly10618RootWithGrpCtx(self): group = self.new_group(perms="rwr---") - grp_ctx = {"omero.group": native_str(group.id.val)} + grp_ctx = {"omero.group": str(group.id.val)} self.assert10618(group, self.root, True, grp_ctx) def testReadOnly10618RootWithGrpCtxButNoLoad(self): group = self.new_group(perms="rwr---") - grp_ctx = {"omero.group": native_str(group.id.val)} + grp_ctx = {"omero.group": str(group.id.val)} self.assert10618(group, self.root, False, grp_ctx) def testReadOnly10618MemberWithGrpCtxButNoLoad(self): group = self.new_group(perms="rwr---") member = self.new_client(group=group) - grp_ctx = {"omero.group": native_str(group.id.val)} + grp_ctx = {"omero.group": str(group.id.val)} self.assert10618(group, member, False, grp_ctx) @pytest.mark.broken(reason="requires thumbnail work") diff --git a/components/tools/OmeroPy/test/integration/test_thumbs.py b/components/tools/OmeroPy/test/integration/test_thumbs.py index f15b29efbe2..0d7d4688a3c 100644 --- a/components/tools/OmeroPy/test/integration/test_thumbs.py +++ b/components/tools/OmeroPy/test/integration/test_thumbs.py @@ -9,7 +9,6 @@ """ -from builtins import range from omero.testlib import ITest import pytest @@ -18,12 +17,6 @@ from omero.util.concurrency import get_event from omero.rtypes import rint, unwrap -try: - int -except Exception: - # Python 3 - long = int - class TestThumbs(ITest): diff --git a/components/tools/OmeroPy/test/integration/test_tickets1000.py b/components/tools/OmeroPy/test/integration/test_tickets1000.py index afa326b2c59..f8029e7293c 100644 --- a/components/tools/OmeroPy/test/integration/test_tickets1000.py +++ b/components/tools/OmeroPy/test/integration/test_tickets1000.py @@ -8,7 +8,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import print_function from omero.testlib import ITest import pytest diff --git a/components/tools/OmeroPy/test/integration/test_tickets2000.py b/components/tools/OmeroPy/test/integration/test_tickets2000.py index 255123113cb..5292ab0844c 100644 --- a/components/tools/OmeroPy/test/integration/test_tickets2000.py +++ b/components/tools/OmeroPy/test/integration/test_tickets2000.py @@ -9,8 +9,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import str -from builtins import range import time from omero.testlib import ITest import pytest @@ -21,12 +19,6 @@ from omero_model_ExperimenterI import ExperimenterI from omero_model_ExperimenterGroupI import ExperimenterGroupI -try: - int -except Exception: - # Python 3 - long = int - class TestTickets2000(ITest): diff --git a/components/tools/OmeroPy/test/integration/test_tickets3000.py b/components/tools/OmeroPy/test/integration/test_tickets3000.py index 79433613733..d0e09ffd869 100644 --- a/components/tools/OmeroPy/test/integration/test_tickets3000.py +++ b/components/tools/OmeroPy/test/integration/test_tickets3000.py @@ -8,8 +8,6 @@ Use is subject to license terms supplied in LICENSE.txt """ -from builtins import str -from builtins import range import omero from omero.testlib import ITest import pytest diff --git a/components/tools/OmeroPy/test/integration/test_tickets6000.py b/components/tools/OmeroPy/test/integration/test_tickets6000.py index b5e6eda01e3..4ea937f4fef 100644 --- a/components/tools/OmeroPy/test/integration/test_tickets6000.py +++ b/components/tools/OmeroPy/test/integration/test_tickets6000.py @@ -9,7 +9,6 @@ """ Integration tests for tickets between 5000 and 5999 """ -from __future__ import print_function import pytest from omero.testlib import ITest diff --git a/components/tools/OmeroPy/test/integration/test_util.py b/components/tools/OmeroPy/test/integration/test_util.py index 9a24dcfc77a..08fb36a3357 100644 --- a/components/tools/OmeroPy/test/integration/test_util.py +++ b/components/tools/OmeroPy/test/integration/test_util.py @@ -24,7 +24,6 @@ Test of various things under omero.util """ -from builtins import object from omero.util.upgrade_check import UpgradeCheck diff --git a/components/tools/OmeroWeb/test/integration/test_annotate.py b/components/tools/OmeroWeb/test/integration/test_annotate.py index 71cdf36816f..21e8078c169 100644 --- a/components/tools/OmeroWeb/test/integration/test_annotate.py +++ b/components/tools/OmeroWeb/test/integration/test_annotate.py @@ -21,7 +21,6 @@ Tests adding & removing annotations """ -from builtins import str import pytest import omero import omero.clients diff --git a/components/tools/OmeroWeb/test/integration/test_api_containers.py b/components/tools/OmeroWeb/test/integration/test_api_containers.py index fcc976273d9..aa0a8f716b5 100644 --- a/components/tools/OmeroWeb/test/integration/test_api_containers.py +++ b/components/tools/OmeroWeb/test/integration/test_api_containers.py @@ -18,11 +18,7 @@ # along with this program. If not, see . """Tests querying & editing Containers with webgateway json api.""" -from __future__ import print_function -from builtins import zip -from builtins import str -from builtins import range import copy from omeroweb.testlib import IWebTest, get_json, \ post_json, put_json, delete_json diff --git a/components/tools/OmeroWeb/test/integration/test_api_errors.py b/components/tools/OmeroWeb/test/integration/test_api_errors.py index e93417576c7..44561a32f22 100644 --- a/components/tools/OmeroWeb/test/integration/test_api_errors.py +++ b/components/tools/OmeroWeb/test/integration/test_api_errors.py @@ -19,7 +19,6 @@ """Tests querying & editing Projects with webgateway json api.""" -from future.utils import native_str from omeroweb.testlib import IWebTest, post_json, put_json, get_json from django.urls import reverse from omeroweb.api import api_settings @@ -125,13 +124,13 @@ def test_security_violation(self, group_B, user_A): # Create project in group_A (default group) payload = {'Name': 'test_security_violation', '@type': OME_SCHEMA_URL + '#Project'} - save_url_grp_A = save_url + '?group=' + native_str(group_A_id) + save_url_grp_A = save_url + '?group=' + str(group_A_id) rsp = post_json(django_client, save_url_grp_A, payload, status_code=201) pr_json = rsp['data'] projectId = pr_json['@id'] # Try to save again into group B - save_url_grp_B = save_url + '?group=' + native_str(group_B_id) + save_url_grp_B = save_url + '?group=' + str(group_B_id) rsp = put_json(django_client, save_url_grp_B, pr_json, status_code=403) assert 'message' in rsp msg = "Cannot read ome.model.containers.Project:Id_%s" % projectId @@ -147,7 +146,7 @@ def test_validation_exception(self, user_A): django_client = self.new_django_client(userName, userName) version = api_settings.API_VERSIONS[-1] save_url = reverse('api_save', kwargs={'api_version': version}) - save_url += '?group=' + native_str(group) + save_url += '?group=' + str(group) # Create Tag tag = TagAnnotationI() diff --git a/components/tools/OmeroWeb/test/integration/test_api_images.py b/components/tools/OmeroWeb/test/integration/test_api_images.py index 6a75ba5ccdd..436f33e18d5 100644 --- a/components/tools/OmeroWeb/test/integration/test_api_images.py +++ b/components/tools/OmeroWeb/test/integration/test_api_images.py @@ -19,8 +19,6 @@ """Tests querying Images with web json api.""" -from builtins import zip -from builtins import range from omeroweb.testlib import IWebTest, get_json from django.urls import reverse from omeroweb.api import api_settings diff --git a/components/tools/OmeroWeb/test/integration/test_api_projects.py b/components/tools/OmeroWeb/test/integration/test_api_projects.py index b89e5c0c4ef..2bf999f3d80 100644 --- a/components/tools/OmeroWeb/test/integration/test_api_projects.py +++ b/components/tools/OmeroWeb/test/integration/test_api_projects.py @@ -21,11 +21,6 @@ Tests querying & editing Projects with webgateway json api """ - -from future.utils import native_str - -from builtins import zip -from builtins import range from omeroweb.testlib import IWebTest, get_json, \ post_json, put_json, delete_json from django.urls import reverse @@ -570,7 +565,7 @@ def test_project_update(self, user1): assert project_json['Description'] == 'Test update' # No change # 2) Put from scratch (will delete empty fields, E.g. Description) - save_url += '?group=' + native_str(group) + save_url += '?group=' + str(group) payload = {'Name': 'updated name', '@id': project.id.val} # Test error message if we don't pass @type: diff --git a/components/tools/OmeroWeb/test/integration/test_api_wells.py b/components/tools/OmeroWeb/test/integration/test_api_wells.py index 906d9bcc184..6c588592e1d 100644 --- a/components/tools/OmeroWeb/test/integration/test_api_wells.py +++ b/components/tools/OmeroWeb/test/integration/test_api_wells.py @@ -19,8 +19,6 @@ """Tests querying Wells with web json api.""" -from builtins import zip -from builtins import range from omeroweb.testlib import IWebTest, get_json from django.urls import reverse from omeroweb.api import api_settings diff --git a/components/tools/OmeroWeb/test/integration/test_chgrp.py b/components/tools/OmeroWeb/test/integration/test_chgrp.py index c01f7f80aaf..c1be87d2bcd 100644 --- a/components/tools/OmeroWeb/test/integration/test_chgrp.py +++ b/components/tools/OmeroWeb/test/integration/test_chgrp.py @@ -20,9 +20,7 @@ """ Tests chgrp functionality of views.py """ -from __future__ import print_function -from future.utils import native_str from omero.model import ProjectI, DatasetI, TagAnnotationI from omero.rtypes import rstring from omero.gateway import BlitzGateway @@ -269,7 +267,7 @@ def test_chgrp_old_container(self, dataset, credentials): project = ProjectI() projectName = "chgrp-target-%s" % self.client.getSessionId() project.name = rstring(projectName) - ctx = {"omero.group": native_str(self.group2.id.val)} + ctx = {"omero.group": str(self.group2.id.val)} project = self.sf.getUpdateService().saveAndReturnObject(project, ctx) request_url = reverse('chgrp') diff --git a/components/tools/OmeroWeb/test/integration/test_containers.py b/components/tools/OmeroWeb/test/integration/test_containers.py index 792dfc632ce..2cc6212afa3 100644 --- a/components/tools/OmeroWeb/test/integration/test_containers.py +++ b/components/tools/OmeroWeb/test/integration/test_containers.py @@ -20,10 +20,7 @@ """ Tests creation, linking, editing & deletion of containers """ -from __future__ import print_function -from builtins import str -from builtins import range import omero import omero.clients from omero.rtypes import rtime diff --git a/components/tools/OmeroWeb/test/integration/test_csrf.py b/components/tools/OmeroWeb/test/integration/test_csrf.py index 7eaaec61180..451596662d9 100644 --- a/components/tools/OmeroWeb/test/integration/test_csrf.py +++ b/components/tools/OmeroWeb/test/integration/test_csrf.py @@ -22,7 +22,6 @@ working correctly. """ -from builtins import range import omero import omero.clients from omero.rtypes import rstring diff --git a/components/tools/OmeroWeb/test/integration/test_history.py b/components/tools/OmeroWeb/test/integration/test_history.py index 5452829988f..40b8ae70de6 100644 --- a/components/tools/OmeroWeb/test/integration/test_history.py +++ b/components/tools/OmeroWeb/test/integration/test_history.py @@ -18,7 +18,6 @@ # along with this program. If not, see . """Tests display of data in History page.""" -from __future__ import print_function from omeroweb.testlib import IWebTest from omeroweb.testlib import get, post diff --git a/components/tools/OmeroWeb/test/integration/test_links.py b/components/tools/OmeroWeb/test/integration/test_links.py index daaf5315035..31b2a95bbf4 100644 --- a/components/tools/OmeroWeb/test/integration/test_links.py +++ b/components/tools/OmeroWeb/test/integration/test_links.py @@ -21,8 +21,6 @@ Tests creation and deletion of links between e.g. Projects & Datasets etc. """ -from builtins import str -from builtins import range import omero from omero.rtypes import rstring diff --git a/components/tools/OmeroWeb/test/integration/test_login.py b/components/tools/OmeroWeb/test/integration/test_login.py index f998ba852af..516cb341bd0 100644 --- a/components/tools/OmeroWeb/test/integration/test_login.py +++ b/components/tools/OmeroWeb/test/integration/test_login.py @@ -20,7 +20,6 @@ """ Tests webclient login """ -from builtins import str from django.conf import settings from django.urls import re_path from importlib import import_module diff --git a/components/tools/OmeroWeb/test/integration/test_plategrid.py b/components/tools/OmeroWeb/test/integration/test_plategrid.py index 4aafb7d4492..474cf32dce5 100644 --- a/components/tools/OmeroWeb/test/integration/test_plategrid.py +++ b/components/tools/OmeroWeb/test/integration/test_plategrid.py @@ -8,14 +8,7 @@ """ Integration tests for the "plategrid" module. """ -from __future__ import division -from __future__ import print_function - -from builtins import map -from builtins import str -from builtins import range -from builtins import object -from past.utils import old_div + import pytest from omeroweb.testlib import IWebTest @@ -174,7 +167,7 @@ def plate_wells_with_acq_date(itest, well_grid_factory, update_service): plate.addWell(well) plate = update_service.saveAndReturnObject(plate) return {'plate': plate, - 'acq_date': int(old_div(acq_date, 1000))} + 'acq_date': int(acq_date / 1000)} @pytest.fixture() @@ -194,7 +187,7 @@ def plate_wells_with_no_acq_date(itest, well_grid_factory, update_service, image = plate.copyWells()[0].copyWellSamples()[0].image creation_date = image.details.creationEvent.time return {'plate': plate, - 'creation_date': old_div(creation_date.val, 1000)} + 'creation_date': creation_date.val // 1000} @pytest.fixture() diff --git a/components/tools/OmeroWeb/test/integration/test_rendering.py b/components/tools/OmeroWeb/test/integration/test_rendering.py index 004e4115042..db4c1b1983c 100644 --- a/components/tools/OmeroWeb/test/integration/test_rendering.py +++ b/components/tools/OmeroWeb/test/integration/test_rendering.py @@ -21,9 +21,6 @@ Tests copying and pasting of rendering settings in webclient """ -from future import standard_library - -from builtins import str import json import omero import omero.clients @@ -38,7 +35,6 @@ from PIL import Image except ImportError: import Image -standard_library.install_aliases() class TestRendering(IWebTest): diff --git a/components/tools/OmeroWeb/test/integration/test_scripts.py b/components/tools/OmeroWeb/test/integration/test_scripts.py index 2caab2ca295..31ec0aba01e 100644 --- a/components/tools/OmeroWeb/test/integration/test_scripts.py +++ b/components/tools/OmeroWeb/test/integration/test_scripts.py @@ -19,7 +19,6 @@ """Test OMERO.scripts usage in the webclient.""" -from builtins import str from omeroweb.testlib import IWebTest from omeroweb.testlib import get, post, get_json import time diff --git a/components/tools/OmeroWeb/test/integration/test_show.py b/components/tools/OmeroWeb/test/integration/test_show.py index d8d5b162f5a..8ecdd58c0b5 100644 --- a/components/tools/OmeroWeb/test/integration/test_show.py +++ b/components/tools/OmeroWeb/test/integration/test_show.py @@ -8,12 +8,7 @@ Use is subject to license terms supplied in LICENSE.txt """ -from __future__ import division -from __future__ import print_function -from builtins import str -from builtins import range -from past.utils import old_div import omero import omero.clients import pytest @@ -1376,7 +1371,7 @@ def test_project_dataset_images_pagination(self, project_dataset_images): {'type': 'project', 'id': project.id.val}, {'type': 'dataset', 'childIndex': imgIndex, 'id': dataset.id.val, - 'childPage': (old_div(imgIndex, page_size)) + 1, + 'childPage': (imgIndex // page_size) + 1, 'childCount': len(iids)}, {'type': 'image', 'id': iid}]] assert paths == expected @@ -1397,7 +1392,7 @@ def test_orphaned_pagination(self, images): [{'type': 'experimenter', 'id': ownerId}, {'type': 'orphaned', 'id': ownerId, 'childIndex': imgIndex, - 'childPage': (old_div(imgIndex, page_size)) + 1, + 'childPage': (imgIndex // page_size) + 1, 'childCount': len(iids)}, {'type': 'image', 'id': iid}]] assert paths == expected diff --git a/components/tools/OmeroWeb/test/integration/test_tags.py b/components/tools/OmeroWeb/test/integration/test_tags.py index 4e286b8e9ea..9994790b6ed 100644 --- a/components/tools/OmeroWeb/test/integration/test_tags.py +++ b/components/tools/OmeroWeb/test/integration/test_tags.py @@ -21,8 +21,6 @@ Tests creation, linking, editing and deletion of Tags """ -from builtins import str -from builtins import range import omero import omero.clients from omero.rtypes import rstring diff --git a/components/tools/OmeroWeb/test/integration/test_thumbnails.py b/components/tools/OmeroWeb/test/integration/test_thumbnails.py index 120413cb62f..9fc9e4a593d 100644 --- a/components/tools/OmeroWeb/test/integration/test_thumbnails.py +++ b/components/tools/OmeroWeb/test/integration/test_thumbnails.py @@ -19,8 +19,6 @@ """Tests rendering of thumbnails.""" -from future import standard_library -from builtins import range import base64 import json from omero.model import EllipseI, LengthI, LineI, \ @@ -37,7 +35,6 @@ from PIL import Image except Exception: import Image -standard_library.install_aliases() def rgba_to_int(red, green, blue, alpha=255): diff --git a/components/tools/OmeroWeb/test/integration/test_tree.py b/components/tools/OmeroWeb/test/integration/test_tree.py index 4de9df72fb8..77375aab6fe 100644 --- a/components/tools/OmeroWeb/test/integration/test_tree.py +++ b/components/tools/OmeroWeb/test/integration/test_tree.py @@ -20,9 +20,7 @@ """ Simple integration tests for the "tree" module. """ -from __future__ import division -from builtins import str import pytest from omero.testlib import ITest diff --git a/components/tools/OmeroWeb/test/integration/test_tree_annotations.py b/components/tools/OmeroWeb/test/integration/test_tree_annotations.py index d40d5369ddc..c91f263112d 100644 --- a/components/tools/OmeroWeb/test/integration/test_tree_annotations.py +++ b/components/tools/OmeroWeb/test/integration/test_tree_annotations.py @@ -20,12 +20,7 @@ """ Integration tests for annotations methods in the "tree" module. """ -from __future__ import division -from __future__ import print_function -from builtins import zip -from future.utils import native_str -from past.utils import old_div import pytest import pytz from omero.testlib import ITest @@ -78,7 +73,7 @@ def project_userA(request, userA, groupA): """ Returns new OMERO Project """ - ctx = {'omero.group': native_str(groupA.id.val)} + ctx = {'omero.group': str(groupA.id.val)} project = ProjectI() project.name = rstring("test_tree_annnotations") project = get_update_service(userA).saveAndReturnObject(project, ctx) @@ -91,7 +86,7 @@ def projects_userA(request, userA, groupA): Returns new OMERO Project """ to_save = [] - ctx = {'omero.group': native_str(groupA.id.val)} + ctx = {'omero.group': str(groupA.id.val)} for name in "test_ann1", "test_ann2": project = ProjectI() project.name = rstring(name) @@ -107,7 +102,7 @@ def tags_userA_userB(request, userA, userB, groupA): Returns new OMERO Tags with descriptions """ tags = [] - ctx = {'omero.group': native_str(groupA.id.val)} + ctx = {'omero.group': str(groupA.id.val)} for name, user in zip(["userAtag", "userBtag"], [userA, userB]): tag = TagAnnotationI() tag.textValue = rstring(name) @@ -126,7 +121,7 @@ def comments_userA(request, userA, groupA): Returns new OMERO Comments """ comments = [] - ctx = {'omero.group': native_str(groupA.id.val)} + ctx = {'omero.group': str(groupA.id.val)} for text in ["Test Comment", "Another comment userA"]: comment = CommentAnnotationI() comment.textValue = rstring(text) @@ -142,7 +137,7 @@ def rating_userA(request, userA, groupA): Returns new OMERO Rating """ rating = LongAnnotationI() - ctx = {'omero.group': native_str(groupA.id.val)} + ctx = {'omero.group': str(groupA.id.val)} rating.longValue = rlong(4) rating.ns = rstring(omero.constants.metadata.NSINSIGHTRATING) rating = get_update_service(userA).saveAndReturnObject(rating, ctx) @@ -154,7 +149,7 @@ def annotate_project(ann, project, user): Returns userA's Tag linked to userB's Project by userA and userB """ - ctx = {'omero.group': native_str(project.details.group.id.val)} + ctx = {'omero.group': str(project.details.group.id.val)} print("annotate_project", ctx) link = ProjectAnnotationLinkI() link.parent = ProjectI(project.id.val, False) @@ -165,7 +160,7 @@ def annotate_project(ann, project, user): def expected_date(time): - d = datetime.fromtimestamp(old_div(time, 1000)) + d = datetime.fromtimestamp(time // 1000) # Add time-zone awareness. Use default TIME_ZONE setting tz = pytz.timezone("Europe/London") d = tz.localize(d) diff --git a/components/tools/OmeroWeb/test/integration/test_webadmin.py b/components/tools/OmeroWeb/test/integration/test_webadmin.py index 0983cbcd873..eb095f2c23d 100644 --- a/components/tools/OmeroWeb/test/integration/test_webadmin.py +++ b/components/tools/OmeroWeb/test/integration/test_webadmin.py @@ -20,7 +20,6 @@ along with this program. If not, see . """ -from builtins import zip import pytest from omeroweb.testlib import IWebTest from omeroweb.testlib import post, get diff --git a/examples/Training/markup.py b/examples/Training/markup.py index 51e3bbb5c92..b906b27a070 100755 --- a/examples/Training/markup.py +++ b/examples/Training/markup.py @@ -15,7 +15,6 @@ """ -from __future__ import print_function import sys import re import os diff --git a/examples/Training/python/Advanced/Raw_Data_advanced.py b/examples/Training/python/Advanced/Raw_Data_advanced.py index ee922b3b639..8d9b4c4c8b1 100644 --- a/examples/Training/python/Advanced/Raw_Data_advanced.py +++ b/examples/Training/python/Advanced/Raw_Data_advanced.py @@ -11,8 +11,6 @@ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function - import omero.util.script_utils as scriptUtil from numpy import int32 from omero.gateway import BlitzGateway diff --git a/examples/Training/python/Advanced/Read_Data_advanced.py b/examples/Training/python/Advanced/Read_Data_advanced.py index ef735629d3e..5005f389c84 100644 --- a/examples/Training/python/Advanced/Read_Data_advanced.py +++ b/examples/Training/python/Advanced/Read_Data_advanced.py @@ -11,8 +11,6 @@ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function - import omero from omero.rtypes import rstring from omero.gateway import BlitzGateway diff --git a/examples/Training/python/Advanced/Write_data_advanced.py b/examples/Training/python/Advanced/Write_data_advanced.py index 23e596181b7..61c86e449fa 100644 --- a/examples/Training/python/Advanced/Write_data_advanced.py +++ b/examples/Training/python/Advanced/Write_data_advanced.py @@ -11,8 +11,6 @@ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function - import omero from omero.rtypes import rstring from omero.gateway import BlitzGateway diff --git a/examples/Training/python/Bulk_Shapes.py b/examples/Training/python/Bulk_Shapes.py index 0ca7916dae8..d57f76a7bab 100755 --- a/examples/Training/python/Bulk_Shapes.py +++ b/examples/Training/python/Bulk_Shapes.py @@ -10,9 +10,7 @@ """ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function -from builtins import range import omero from omero.gateway import BlitzGateway from omero.rtypes import rdouble diff --git a/examples/Training/python/Connect_To_OMERO.py b/examples/Training/python/Connect_To_OMERO.py index a36046fbb08..4b06e6e55b6 100644 --- a/examples/Training/python/Connect_To_OMERO.py +++ b/examples/Training/python/Connect_To_OMERO.py @@ -10,7 +10,6 @@ """ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function from Parse_OMERO_Properties import USERNAME, PASSWORD, HOST, PORT diff --git a/examples/Training/python/Create_Image.py b/examples/Training/python/Create_Image.py index 5bab7fb58f3..dc9921f00e1 100755 --- a/examples/Training/python/Create_Image.py +++ b/examples/Training/python/Create_Image.py @@ -10,11 +10,7 @@ """ FOR TRAINING PURPOSES ONLY! """ -from __future__ import division -from __future__ import print_function -from builtins import range -from past.utils import old_div from omero.gateway import BlitzGateway from Parse_OMERO_Properties import USERNAME, PASSWORD, HOST, PORT from Parse_OMERO_Properties import imageId @@ -105,7 +101,7 @@ def plane_gen(): # Here we can manipulate the data in many different ways. As # an example we are doing "average" # average of 2 channels - new_plane = old_div((channel0 + channel1), 2) + new_plane = (channel0 + channel1) // 2 print("newPlane for z,t:", z, t, new_plane.dtype, new_plane.min(), new_plane.max()) yield new_plane diff --git a/examples/Training/python/Delete.py b/examples/Training/python/Delete.py index 575b6efaecb..4cf2acd548a 100755 --- a/examples/Training/python/Delete.py +++ b/examples/Training/python/Delete.py @@ -11,7 +11,6 @@ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function import omero import omero.callbacks from omero.gateway import BlitzGateway diff --git a/examples/Training/python/Filesets.py b/examples/Training/python/Filesets.py index 3250f4d9a1a..d5eaacb3b8e 100755 --- a/examples/Training/python/Filesets.py +++ b/examples/Training/python/Filesets.py @@ -11,7 +11,6 @@ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function from omero.gateway import BlitzGateway from Parse_OMERO_Properties import USERNAME, PASSWORD, HOST, PORT from Parse_OMERO_Properties import imageId diff --git a/examples/Training/python/Groups_Permissions.py b/examples/Training/python/Groups_Permissions.py index 32f8f717192..be320ac23a6 100755 --- a/examples/Training/python/Groups_Permissions.py +++ b/examples/Training/python/Groups_Permissions.py @@ -10,9 +10,7 @@ """ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function -from builtins import str from omero.gateway import BlitzGateway from Parse_OMERO_Properties import USERNAME, PASSWORD, HOST, PORT from Parse_OMERO_Properties import imageId diff --git a/examples/Training/python/Json_Api/Login.py b/examples/Training/python/Json_Api/Login.py index f1d473afc67..16abd379014 100644 --- a/examples/Training/python/Json_Api/Login.py +++ b/examples/Training/python/Json_Api/Login.py @@ -7,7 +7,6 @@ # Use is subject to license terms supplied in LICENSE.txt # -from __future__ import print_function import requests diff --git a/examples/Training/python/Metadata.py b/examples/Training/python/Metadata.py index 3e291ccf83a..171bd98edb0 100755 --- a/examples/Training/python/Metadata.py +++ b/examples/Training/python/Metadata.py @@ -10,7 +10,6 @@ """ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function from omero.gateway import BlitzGateway from Parse_OMERO_Properties import USERNAME, PASSWORD, HOST, PORT diff --git a/examples/Training/python/ROIs.py b/examples/Training/python/ROIs.py index 67d6211ae89..faca90cea4f 100755 --- a/examples/Training/python/ROIs.py +++ b/examples/Training/python/ROIs.py @@ -10,13 +10,7 @@ """ FOR TRAINING PURPOSES ONLY! """ -from __future__ import division -from __future__ import print_function -from future.utils import native_str -from builtins import str -from builtins import range -from past.utils import old_div import numpy import struct import math @@ -52,7 +46,7 @@ width = 100 height = 50 image = conn.getObject("Image", imageId) -z = old_div(image.getSizeZ(), 2) +z = image.getSizeZ() // 2 t = 0 @@ -129,12 +123,12 @@ def create_mask(mask_bytes, bytes_per_pixel=1): else: message = "Format %s not supported" raise ValueError(message) - steps = math.ceil(old_div(len(mask_bytes), divider)) + steps = math.ceil(len(mask_bytes) / divider) mask = [] for i in range(int(steps)): binary = mask_bytes[ i * int(divider):i * int(divider) + int(divider)] - format = native_str(int(byte_factor * len(binary))) + format_string + format = str(int(byte_factor * len(binary))) + format_string binary = struct.unpack(format, binary) s = "" for bit in binary: diff --git a/examples/Training/python/Raw_Data_Access.py b/examples/Training/python/Raw_Data_Access.py index 13d8c8274c5..8073f23eadd 100755 --- a/examples/Training/python/Raw_Data_Access.py +++ b/examples/Training/python/Raw_Data_Access.py @@ -11,10 +11,6 @@ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function -from __future__ import division -from builtins import range -from past.utils import old_div from omero.gateway import BlitzGateway from Parse_OMERO_Properties import USERNAME, PASSWORD, HOST, PORT from Parse_OMERO_Properties import imageId @@ -74,7 +70,7 @@ # ========================== zct_list = [] # get the top half of the Z-stack -for z in range(old_div(size_z, 2), size_z): +for z in range(size_z // 2, size_z): for c in range(size_c): # all channels for t in range(size_t): # all time-points zct_list.append((z, c, t)) diff --git a/examples/Training/python/Read_Data.py b/examples/Training/python/Read_Data.py index 8ddae1ae87c..aad42868681 100755 --- a/examples/Training/python/Read_Data.py +++ b/examples/Training/python/Read_Data.py @@ -10,10 +10,7 @@ """ FOR TRAINING PURPOSES ONLY! """ -from __future__ import division -from __future__ import print_function -from builtins import range import omero from omero.gateway import BlitzGateway from Parse_OMERO_Properties import USERNAME, PASSWORD, HOST, PORT diff --git a/examples/Training/python/Render_Images.py b/examples/Training/python/Render_Images.py index 3b1f4048305..1644fa471c4 100644 --- a/examples/Training/python/Render_Images.py +++ b/examples/Training/python/Render_Images.py @@ -10,12 +10,7 @@ """ FOR TRAINING PURPOSES ONLY! """ -from __future__ import division -from __future__ import print_function -from future import standard_library -from builtins import range -from past.utils import old_div from omero.gateway import BlitzGateway from io import BytesIO try: @@ -24,7 +19,6 @@ import Image from Parse_OMERO_Properties import USERNAME, PASSWORD, HOST, PORT, imageId -standard_library.install_aliases() """ start-code """ @@ -73,7 +67,7 @@ # ================================================= image.setGreyscaleRenderingModel() size_c = image.getSizeC() -z = old_div(image.getSizeZ(), 2) +z = image.getSizeZ() // 2 t = 0 for c in range(1, size_c + 1): # Channel index starts at 1 channels = [c] # Turn on a single channel at a time diff --git a/examples/Training/python/Scripting_Service_Example.py b/examples/Training/python/Scripting_Service_Example.py index 5f3ec0b71cd..97c79d08ef1 100644 --- a/examples/Training/python/Scripting_Service_Example.py +++ b/examples/Training/python/Scripting_Service_Example.py @@ -10,7 +10,6 @@ """ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function # This is a 'bare-bones' template to allow easy conversion from a simple # client-side Python script to a script run by the server, on the OMERO diff --git a/examples/Training/python/Tables.py b/examples/Training/python/Tables.py index 12b2bf500e0..913c964e06a 100755 --- a/examples/Training/python/Tables.py +++ b/examples/Training/python/Tables.py @@ -10,10 +10,7 @@ """ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function -from builtins import str -from builtins import range import omero import os import omero.grid diff --git a/examples/Training/python/Task_Scripts/ROIs_To_Table.py b/examples/Training/python/Task_Scripts/ROIs_To_Table.py index ef5b8e8f8ca..35b1ea7ef1b 100644 --- a/examples/Training/python/Task_Scripts/ROIs_To_Table.py +++ b/examples/Training/python/Task_Scripts/ROIs_To_Table.py @@ -6,7 +6,6 @@ # All Rights Reserved. # Use is subject to license terms supplied in LICENSE.txt # -from __future__ import print_function import omero.scripts as scripts from random import random diff --git a/examples/Training/python/Task_Scripts/Raw_Data2.py b/examples/Training/python/Task_Scripts/Raw_Data2.py index fcfdf89090e..d032fa01c7d 100644 --- a/examples/Training/python/Task_Scripts/Raw_Data2.py +++ b/examples/Training/python/Task_Scripts/Raw_Data2.py @@ -20,8 +20,6 @@ # folder # This script takes an Image ID as a parameter from the scripting service. -from __future__ import print_function - import omero.util.script_utils as scriptUtil from omero.gateway import BlitzGateway from numpy import hstack, int32 diff --git a/examples/Training/python/Task_Scripts/Raw_Data_Task.py b/examples/Training/python/Task_Scripts/Raw_Data_Task.py index af2a8630de2..0b7a47ba270 100644 --- a/examples/Training/python/Task_Scripts/Raw_Data_Task.py +++ b/examples/Training/python/Task_Scripts/Raw_Data_Task.py @@ -19,7 +19,6 @@ # A more complete template, for 'real-world' scripts, is also included in this # folder # This script takes an Image ID as a parameter from the scripting service. -from __future__ import print_function import omero.util.script_utils as scriptUtil from omero.gateway import BlitzGateway diff --git a/examples/Training/python/Task_Scripts/Write_Data_3.py b/examples/Training/python/Task_Scripts/Write_Data_3.py index e02779d681b..e9a83ec40b4 100644 --- a/examples/Training/python/Task_Scripts/Write_Data_3.py +++ b/examples/Training/python/Task_Scripts/Write_Data_3.py @@ -19,7 +19,6 @@ # A more complete template, for 'real-world' scripts, is also included in this # folder # This script takes an Image ID as a parameter from the scripting service. -from __future__ import print_function from omero.gateway import BlitzGateway import omero diff --git a/examples/Training/python/Task_Scripts/Write_Data_4.py b/examples/Training/python/Task_Scripts/Write_Data_4.py index 365f975da1a..1a8df1d5ac7 100644 --- a/examples/Training/python/Task_Scripts/Write_Data_4.py +++ b/examples/Training/python/Task_Scripts/Write_Data_4.py @@ -19,7 +19,6 @@ # A more complete template, for 'real-world' scripts, is also included in this # folder # This script takes an Image ID as a parameter from the scripting service. -from __future__ import print_function from omero.gateway import BlitzGateway import omero diff --git a/examples/Training/python/Write_Data.py b/examples/Training/python/Write_Data.py index ab69f0919ea..8f032eb79ed 100755 --- a/examples/Training/python/Write_Data.py +++ b/examples/Training/python/Write_Data.py @@ -10,9 +10,7 @@ """ FOR TRAINING PURPOSES ONLY! """ -from __future__ import print_function -from builtins import str import os import omero from omero.rtypes import rstring diff --git a/examples/Training/python/__main__.py b/examples/Training/python/__main__.py index 8dcd2685f16..058a6c95cee 100755 --- a/examples/Training/python/__main__.py +++ b/examples/Training/python/__main__.py @@ -7,33 +7,38 @@ # Use is subject to license terms supplied in LICENSE.txt # -from __future__ import print_function -from past.builtins import execfile import os training_dir = os.path.dirname(os.path.abspath(__file__)) if __name__ == "__main__": print("Running training suite") - execfile(os.path.join(training_dir, 'Bulk_Shapes.py')) - execfile(os.path.join(training_dir, 'Connect_To_OMERO.py')) - execfile(os.path.join(training_dir, 'Create_Image.py')) - execfile(os.path.join(training_dir, 'Delete.py')) - execfile(os.path.join(training_dir, 'Filesets.py')) - execfile(os.path.join(training_dir, 'Groups_Permissions.py')) - execfile(os.path.join(training_dir, 'Metadata.py')) - execfile(os.path.join(training_dir, 'Raw_Data_Access.py')) - execfile(os.path.join(training_dir, 'Read_Data.py')) - execfile(os.path.join(training_dir, 'Render_Images.py')) - execfile(os.path.join(training_dir, 'ROIs.py')) - execfile(os.path.join(training_dir, 'Tables.py')) - execfile(os.path.join(training_dir, 'Write_Data.py')) - execfile(os.path.join(training_dir, - 'Advanced/Create_Image_advanced.py')) - execfile(os.path.join(training_dir, 'Advanced/Raw_Data_advanced.py')) - execfile(os.path.join(training_dir, 'Advanced/Read_Data_advanced.py')) - execfile(os.path.join(training_dir, 'Advanced/Write_data_advanced.py')) - execfile(os.path.join(training_dir, 'Task_Scripts/Raw_Data2.py')) - execfile(os.path.join(training_dir, 'Task_Scripts/Raw_Data_Task.py')) - execfile(os.path.join(training_dir, 'Task_Scripts/Write_Data_4.py')) - execfile(os.path.join(training_dir, 'Task_Scripts/Write_Data_3.py')) - execfile(os.path.join(training_dir, 'Json_Api/Login.py')) + exec(open(os.path.join(training_dir, 'Bulk_Shapes.py')).read()) + exec(open(os.path.join(training_dir, 'Connect_To_OMERO.py')).read()) + exec(open(os.path.join(training_dir, 'Create_Image.py')).read()) + exec(open(os.path.join(training_dir, 'Delete.py')).read()) + exec(open(os.path.join(training_dir, 'Filesets.py')).read()) + exec(open(os.path.join(training_dir, 'Groups_Permissions.py')).read()) + exec(open(os.path.join(training_dir, 'Metadata.py')).read()) + exec(open(os.path.join(training_dir, 'Raw_Data_Access.py')).read()) + exec(open(os.path.join(training_dir, 'Read_Data.py')).read()) + exec(open(os.path.join(training_dir, 'Render_Images.py')).read()) + exec(open(os.path.join(training_dir, 'ROIs.py')).read()) + exec(open(os.path.join(training_dir, 'Tables.py')).read()) + exec(open(os.path.join(training_dir, 'Write_Data.py')).read()) + exec(open(os.path.join(training_dir, + 'Advanced/Create_Image_advanced.py')).read()) + exec(open(os.path.join(training_dir, + 'Advanced/Raw_Data_advanced.py')).read()) + exec(open(os.path.join(training_dir, + 'Advanced/Read_Data_advanced.py')).read()) + exec(open(os.path.join(training_dir, + 'Advanced/Write_data_advanced.py')).read()) + exec(open(os.path.join(training_dir, + 'Task_Scripts/Raw_Data2.py')).read()) + exec(open(os.path.join(training_dir, + 'Task_Scripts/Raw_Data_Task.py')).read()) + exec(open(os.path.join(training_dir, + 'Task_Scripts/Write_Data_4.py')).read()) + exec(open(os.path.join(training_dir, + 'Task_Scripts/Write_Data_3.py')).read()) + exec(open(os.path.join(training_dir, 'Json_Api/Login.py')).read())