diff options
author | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2019-05-28 08:16:16 +0200 |
---|---|---|
committer | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2019-05-28 08:16:16 +0200 |
commit | a763e5d1b3921b3194f3d4e94ab9de3fbe08bbdd (patch) | |
tree | 45d462ed36a5522e9f3b9fde6c4ec4918c2ae8e3 /silx/utils | |
parent | cebdc9244c019224846cb8d2668080fe386a6adc (diff) |
New upstream version 0.10.1+dfsg
Diffstat (limited to 'silx/utils')
-rw-r--r-- | silx/utils/array_like.py | 6 | ||||
-rw-r--r-- | silx/utils/debug.py | 3 | ||||
-rw-r--r-- | silx/utils/files.py | 52 | ||||
-rw-r--r-- | silx/utils/proxy.py | 4 | ||||
-rw-r--r-- | silx/utils/test/test_array_like.py | 10 |
5 files changed, 61 insertions, 14 deletions
diff --git a/silx/utils/array_like.py b/silx/utils/array_like.py index 11f531d..8ef1ace 100644 --- a/silx/utils/array_like.py +++ b/silx/utils/array_like.py @@ -48,9 +48,11 @@ Functions: """ from __future__ import absolute_import, print_function, division -import numpy + import sys -from silx.third_party import six + +import numpy +import six __authors__ = ["P. Knobel"] __license__ = "MIT" diff --git a/silx/utils/debug.py b/silx/utils/debug.py index d6ca328..5459448 100644 --- a/silx/utils/debug.py +++ b/silx/utils/debug.py @@ -27,7 +27,8 @@ import inspect import types import logging -from silx.third_party import six + +import six debug_logger = logging.getLogger("silx.DEBUG") diff --git a/silx/utils/files.py b/silx/utils/files.py new file mode 100644 index 0000000..326d308 --- /dev/null +++ b/silx/utils/files.py @@ -0,0 +1,52 @@ +# coding: utf-8 +# /*########################################################################## +# +# Copyright (c) 2019 European Synchrotron Radiation Facility +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# ###########################################################################*/ +"""Utils function relative to files +""" + +__authors__ = ["V. Valls"] +__license__ = "MIT" +__date__ = "19/09/2016" + +import os.path +import glob + +def expand_filenames(filenames): + """ + Takes a list of paths and expand it into a list of files. + + :param List[str] filenames: list of filenames or path with wildcards + :rtype: List[str] + :return: list of existing filenames or non-existing files + (which was provided as input) + """ + result = [] + for filename in filenames: + if os.path.exists(filename): + result.append(filename) + elif glob.has_magic(filename): + result += glob.glob(filename) + else: + result.append(filename) + return result diff --git a/silx/utils/proxy.py b/silx/utils/proxy.py index 2633703..7d7d662 100644 --- a/silx/utils/proxy.py +++ b/silx/utils/proxy.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2016-2017 European Synchrotron Radiation Facility +# Copyright (c) 2016-2018 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -30,7 +30,7 @@ __authors__ = ["V. Valls"] __license__ = "MIT" __date__ = "02/10/2017" -from silx.third_party import six +import six class Proxy(object): diff --git a/silx/utils/test/test_array_like.py b/silx/utils/test/test_array_like.py index 7cd004c..fe92db5 100644 --- a/silx/utils/test/test_array_like.py +++ b/silx/utils/test/test_array_like.py @@ -28,11 +28,7 @@ __authors__ = ["P. Knobel"] __license__ = "MIT" __date__ = "09/01/2017" -try: - import h5py -except ImportError: - h5py = None - +import h5py import numpy import os import tempfile @@ -43,8 +39,6 @@ from ..array_like import get_dtype, get_concatenated_dtype, get_shape,\ is_array, is_nested_sequence, is_list_of_arrays -@unittest.skipIf(h5py is None, - "h5py is needed to test DatasetView") class TestTransposedDatasetView(unittest.TestCase): def setUp(self): @@ -417,8 +411,6 @@ class TestFunctions(unittest.TestCase): self.assertTrue(is_array(a)) self.assertFalse(is_list_of_arrays(a)) - @unittest.skipIf(h5py is None, - "h5py is needed for this test") def testH5pyDataset(self): a = numpy.array([[0, 1], [2, 3]]) |