summaryrefslogtreecommitdiff
path: root/silx/utils
diff options
context:
space:
mode:
Diffstat (limited to 'silx/utils')
-rw-r--r--silx/utils/ExternalResources.py21
-rw-r--r--silx/utils/array_like.py3
-rw-r--r--silx/utils/deprecation.py6
3 files changed, 17 insertions, 13 deletions
diff --git a/silx/utils/ExternalResources.py b/silx/utils/ExternalResources.py
index 7d9008b..e21381c 100644
--- a/silx/utils/ExternalResources.py
+++ b/silx/utils/ExternalResources.py
@@ -167,12 +167,11 @@ class ExternalResources(object):
if not os.path.isfile(fullfilename):
raise RuntimeError(
- "Could not automatically \
- download test images %s!\n \ If you are behind a firewall, \
- please set both environment variable http_proxy and https_proxy.\
- This even works under windows ! \n \
- Otherwise please try to download the images manually from \n%s/%s"
- % (filename, self.url_base, filename))
+ """Could not automatically download test images %s!
+ If you are behind a firewall, please set both environment variable http_proxy and https_proxy.
+ This even works under windows !
+ Otherwise please try to download the images manually from
+ %s/%s""" % (filename, self.url_base, filename))
if filename not in self.all_data:
self.all_data.add(filename)
@@ -263,11 +262,11 @@ class ExternalResources(object):
if not os.path.isfile(fullimagename_bz2):
self.getfile(bzip2name)
if not os.path.isfile(fullimagename_bz2):
- raise RuntimeError("Could not automatically \
- download test images %s!\n \ If you are behind a firewall, \
- please set the environment variable http_proxy.\n \
- Otherwise please try to download the images manually from \n \
- %s" % (self.url_base, filename))
+ raise RuntimeError(
+ """Could not automatically download test images %s!
+ If you are behind a firewall, please set the environment variable http_proxy.
+ Otherwise please try to download the images manually from
+ %s""" % (self.url_base, filename))
try:
import bz2
diff --git a/silx/utils/array_like.py b/silx/utils/array_like.py
index 8ef1ace..1a2e72e 100644
--- a/silx/utils/array_like.py
+++ b/silx/utils/array_like.py
@@ -53,6 +53,7 @@ import sys
import numpy
import six
+import numbers
__authors__ = ["P. Knobel"]
__license__ = "MIT"
@@ -363,7 +364,7 @@ class ListOfImages(object):
frozen_dimensions = []
for i, idx in enumerate(item):
# slices and sequences
- if not isinstance(idx, int):
+ if not isinstance(idx, numbers.Integral):
output_dimensions.append(self.transposition[i])
# regular integer index
else:
diff --git a/silx/utils/deprecation.py b/silx/utils/deprecation.py
index f9ba017..7b19ee5 100644
--- a/silx/utils/deprecation.py
+++ b/silx/utils/deprecation.py
@@ -39,6 +39,10 @@ depreclog = logging.getLogger("silx.DEPRECATION")
deprecache = set([])
+FORCE = False
+"""If true, deprecation using only_once are also generated.
+It is needed for reproducible tests.
+"""
def deprecated(func=None, reason=None, replacement=None, since_version=None, only_once=True, skip_backtrace_count=1):
"""
@@ -110,7 +114,7 @@ def deprecated_warning(type_, name, reason=None, replacement=None,
limit = 2 + skip_backtrace_count
backtrace = "".join(traceback.format_stack(limit=limit)[0])
backtrace = backtrace.rstrip()
- if only_once:
+ if not FORCE and only_once:
data = (msg, type_, name, backtrace)
if data in deprecache:
return