Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of python-future compatibility code #390

Merged
merged 26 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3f9a92d
Remove all imports of print_function compatibility method
sbesson Jan 12, 2024
e5f7f0f
Remove all imports of division compatibility method
sbesson Jan 12, 2024
5150a8e
Remove all import of unicode_literals compatibility method
sbesson Jan 12, 2024
96be569
Remove all imports of absolute_import compatibility method
sbesson Jan 12, 2024
cfaa6f5
Remove import of with_statement compatibility method
sbesson Jan 12, 2024
a8713a0
Replace all instances of isbytes and bytes_to_native_str
sbesson Jan 12, 2024
99b60ea
Replace all instances of native_str
sbesson Jan 15, 2024
9e5e4fa
Replace all usages of old_div
sbesson Jan 15, 2024
5fd8f68
Replace usage of past.builtins.execfile by exec
sbesson Jan 16, 2024
db44b80
Remove all usages of future.utils.native
sbesson Jan 16, 2024
bf18960
Replace all usages of past.builtins.basestring
sbesson Jan 16, 2024
ee5f62c
Remove all usages of past.builtins.cmp
sbesson Jan 16, 2024
0d1d48e
Remove usage of past.builtins.long
sbesson Jan 16, 2024
f7407c9
Remove usage of future.standard_library.install_aliases
sbesson Jan 17, 2024
80adbba
Cleanup miscellaneous Python 2 codepaths
sbesson Jan 17, 2024
77dc7a5
Remove all unnecessary builtins imports
sbesson Jan 17, 2024
2c6f42c
Officially deprecate future dependency and remove from tox.ini
sbesson Jan 23, 2024
17ca96c
Clean up outdated Docker infrastructure
sbesson Jan 23, 2024
bc19fe5
Cleanup all legacy types imports
sbesson Jan 26, 2024
f054810
Cleanup a few other legacy Python 2 try/except imports
sbesson Jan 26, 2024
148f96f
Use raw string to avoid SyntaxWarning in Python 3.12
sbesson Feb 1, 2024
87db9df
Add Python 3.12 to the test matrix
sbesson Feb 2, 2024
66ca6d9
Add setuptools to dependencies for Python 3.12
sbesson Feb 2, 2024
cd3a1a6
Review SyntaxWarning thrown by Python 3.12 with escape sequences
sbesson Feb 5, 2024
c1f88b9
Remove legacy PIL/Pillow compatibility try/except blocks
sbesson Feb 7, 2024
7729d2c
omero.util.populate_metadata: use package name to import ThreadPool
sbesson Feb 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading