Skip to content

Commit

Permalink
Merge pull request #390 from sbesson/future_removal
Browse files Browse the repository at this point in the history
Removal of python-future compatibility code
  • Loading branch information
pwalczysko authored Feb 22, 2024
2 parents d676cac + 7729d2c commit 8e53478
Show file tree
Hide file tree
Showing 140 changed files with 472 additions and 1,275 deletions.
1 change: 1 addition & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
os:
- ubuntu-22.04
include:
Expand Down
34 changes: 0 additions & 34 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Dependencies
Direct dependencies of OMERO.py are:

- `ZeroC IcePy 3.6`_
- future
- future (deprecated)
- numpy
- Pillow >= 10.0.0

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
source_suffix = ".rst"

# Build docs without external dependencies
autodoc_mock_imports = ["omero", "omero_ext", "past", "future",
autodoc_mock_imports = ["omero", "omero_ext",
"Ice", "IceImport", "Glacier2", "pytest",
"appdirs", "IcePy", "omero_version",
"IceGrid", "mx", "matplotlib",
Expand Down
3 changes: 1 addition & 2 deletions examples/projection_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
# @param method the method of projecting (maximum, average)
# @return new pixels object containing the projection.
#
from builtins import range
from builtins import object

import sys
import omero
import omero.cli
Expand Down
3 changes: 0 additions & 3 deletions manualtests/populate_roi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
...
"""
from __future__ import print_function

#
# Copyright (C) 2009 University of Dundee. All rights reserved.
Expand All @@ -24,8 +23,6 @@
#


from builtins import range
from builtins import object
import unittest
import os

Expand Down
22 changes: 4 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
Use is subject to license terms supplied in LICENSE.txt
"""
from __future__ import print_function

import glob
import sys
Expand All @@ -18,31 +17,18 @@
find_packages,
)

try:
from StringIO import StringIO
from StringIO import StringIO as BytesIO
except ImportError:
# Python 3
from io import StringIO
from io import BytesIO
from io import StringIO
from io import BytesIO

from shutil import (
copy,
rmtree,
)

try:
from urllib.request import urlopen
except ImportError:
# Python 2
from urllib import urlopen
from urllib.request import urlopen
from zipfile import ZipFile

try:
import configparser
except ImportError:
# Python 2
import ConfigParser as configparser
import configparser


def get_blitz_location():
Expand Down
11 changes: 0 additions & 11 deletions src/omero/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,3 @@ def proxy_to_instance(proxy_string, default=None):
raise ClientError(("Invalid proxy string: %s. "
"Correct format is Class:ID") % proxy_string)
return kls(proxy_string)

#
# Workaround for warning messages produced in
# code-generated Ice files.
#
if _sys.version_info[:2] == (2, 6):
import warnings
warnings.filterwarnings(
action='ignore',
message='BaseException.message has been deprecated as of Python 2.6',
category=DeprecationWarning)
15 changes: 5 additions & 10 deletions src/omero/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
module for backwards compatibility.
"""

from __future__ import division

from builtins import str
from future.utils import native_str
from past.utils import old_div
import Ice
import logging
import threading
Expand Down Expand Up @@ -71,7 +66,7 @@ def __init__(self, adapter_or_client, process, poll=True, category=None):
self.adapter, self.category = \
adapter_and_category(adapter_or_client, category)

self.id = Ice.Identity(native_str(uuid.uuid4()), self.category)
self.id = Ice.Identity(str(uuid.uuid4()), self.category)
self.prx = self.adapter.add(self, self.id) # OK ADAPTER USAGE
self.prx = omero.grid.ProcessCallbackPrx.uncheckedCast(self.prx)
process.registerCallback(self.prx)
Expand All @@ -90,7 +85,7 @@ def block(self, ms):
except Exception as e:
PROC_LOG.warn("Error calling poll: %s" % e)

self.event.wait(old_div(float(ms), 1000))
self.event.wait(ms / 1000)
if self.event.isSet():
return self.result
return None
Expand Down Expand Up @@ -146,7 +141,7 @@ def __init__(self, adapter_or_client, handle, category=None,
self.adapter, self.category = \
adapter_and_category(adapter_or_client, category)

self.id = Ice.Identity(native_str(uuid.uuid4()), self.category)
self.id = Ice.Identity(str(uuid.uuid4()), self.category)
self.prx = self.adapter.add(self, self.id) # OK ADAPTER USAGE
self.prx = omero.cmd.CmdCallbackPrx.uncheckedCast(self.prx)
handle.addCallback(self.prx)
Expand Down Expand Up @@ -259,7 +254,7 @@ def loop(self, loops, ms):
if found:
return self.getResponse()
else:
waited = (old_div(ms, 1000.0)) * loops
waited = (ms / 1000.0) * loops
raise omero.LockTimeout(
None, None, "Command unfinished after %s seconds" % waited,
5000, int(waited))
Expand All @@ -271,7 +266,7 @@ def block(self, ms):
which case it returns immediately with true. If false
is returned, then the timeout was reached.
"""
self.event.wait(old_div(float(ms), 1000))
self.event.wait(ms / 1000)
return self.event.isSet()

#
Expand Down
Loading

0 comments on commit 8e53478

Please sign in to comment.