From dbb351196ca69985075e04f6edee09d6e404e679 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Mon, 25 Apr 2022 19:56:26 +0200
Subject: [PATCH] Bring old imports back for more compatibility

---
 bob/io/base/__init__.py                | 15 +++------------
 bob/io/base/test/test_hdf5.py          |  2 +-
 bob/io/base/test/test_image_support.py |  2 +-
 bob/io/base/test/test_io.py            |  2 +-
 bob/io/base/{test => }/test_utils.py   |  0
 bob/io/{base/utils.py => image.py}     |  0
 6 files changed, 6 insertions(+), 15 deletions(-)
 rename bob/io/base/{test => }/test_utils.py (100%)
 rename bob/io/{base/utils.py => image.py} (100%)

diff --git a/bob/io/base/__init__.py b/bob/io/base/__init__.py
index ea35d2c..be46d05 100644
--- a/bob/io/base/__init__.py
+++ b/bob/io/base/__init__.py
@@ -3,7 +3,7 @@ import numpy as np
 import h5py
 import imageio
 
-from .utils import to_bob, to_matplotlib, opencvbgr_to_bob, bob_to_opencvbgr, imshow
+from ..image import to_bob, to_matplotlib
 
 import logging
 
@@ -34,17 +34,8 @@ image_extensions = [
 
 
 def _is_string(s):
-    """Returns ``True`` if the given object is a string
-
-    This method can be used with Python-2.x or 3.x and returns a string
-    respecting each environment's constraints.
-    """
-
-    from sys import version_info
-
-    return (version_info[0] < 3 and isinstance(s, (str, unicode))) or isinstance(
-        s, (bytes, str)
-    )
+    """Returns ``True`` if the given object is a string or bytes."""
+    return isinstance(s, (bytes, str))
 
 
 @np.deprecate(new_name="os.makedirs(directory, exist_ok=True)")
diff --git a/bob/io/base/test/test_hdf5.py b/bob/io/base/test/test_hdf5.py
index 437709f..dde0a53 100644
--- a/bob/io/base/test/test_hdf5.py
+++ b/bob/io/base/test/test_hdf5.py
@@ -9,7 +9,7 @@
 
 import os
 from bob.io.base import load, save
-from .test_utils import temporary_filename
+from ..test_utils import temporary_filename
 
 
 import numpy as np
diff --git a/bob/io/base/test/test_image_support.py b/bob/io/base/test/test_image_support.py
index 6fe5fdd..0898956 100644
--- a/bob/io/base/test/test_image_support.py
+++ b/bob/io/base/test/test_image_support.py
@@ -12,7 +12,7 @@ import os
 import numpy
 
 from bob.io.base import load, write
-from .test_utils import datafile, temporary_filename
+from ..test_utils import datafile, temporary_filename
 
 # import bob.io.image
 import nose
diff --git a/bob/io/base/test/test_io.py b/bob/io/base/test/test_io.py
index 7a31cda..b4ec9f6 100644
--- a/bob/io/base/test/test_io.py
+++ b/bob/io/base/test/test_io.py
@@ -2,7 +2,7 @@ import nose
 import numpy as np
 import os
 from bob.io.base import vstack_features, save, load
-from .test_utils import temporary_filename
+from ..test_utils import temporary_filename
 
 
 def test_io_vstack():
diff --git a/bob/io/base/test/test_utils.py b/bob/io/base/test_utils.py
similarity index 100%
rename from bob/io/base/test/test_utils.py
rename to bob/io/base/test_utils.py
diff --git a/bob/io/base/utils.py b/bob/io/image.py
similarity index 100%
rename from bob/io/base/utils.py
rename to bob/io/image.py
-- 
GitLab