diff --git a/h5pyd/_hl/dataset.py b/h5pyd/_hl/dataset.py index 3de3072..97439bb 100644 --- a/h5pyd/_hl/dataset.py +++ b/h5pyd/_hl/dataset.py @@ -1775,7 +1775,7 @@ def write_dset_tl(self, args): Thread-local method to write to a single dataset """ dset = args[0] - idx = args[1] + # idx = args[1] write_args = args[2] write_vals = args[3] try: @@ -1785,7 +1785,7 @@ def write_dset_tl(self, args): return def __getitem__(self, args): - """ + """ Read the same slice from each of the datasets managed by this MultiManager. """ @@ -1824,7 +1824,8 @@ def __getitem__(self, args): # TODO: Handle the case where some or all datasets share an HTTPConn object with ThreadPoolExecutor(max_workers=self.max_workers) as executor: - read_futures = [executor.submit(self.read_dset_tl, (self.datasets[i], i, args)) for i in range(len(self.datasets))] + read_futures = [executor.submit(self.read_dset_tl, + (self.datasets[i], i, args)) for i in range(len(self.datasets))] ret_data = [None] * len(self.datasets) for future in as_completed(read_futures): @@ -1878,7 +1879,8 @@ def __setitem__(self, args, vals): next_port = low_port with ThreadPoolExecutor(max_workers=self.max_workers) as executor: - write_futures = [executor.submit(self.write_dset_tl, (self.datasets[i], i, args, vals[i])) for i in range(len(self.datasets))] + write_futures = [executor.submit(self.write_dset_tl, + (self.datasets[i], i, args, vals[i])) for i in range(len(self.datasets))] for future in as_completed(write_futures): try: diff --git a/h5pyd/_hl/group.py b/h5pyd/_hl/group.py index 79dfe3a..831b377 100644 --- a/h5pyd/_hl/group.py +++ b/h5pyd/_hl/group.py @@ -651,7 +651,7 @@ def __getitem__(self, name): endpoint = self.id.http_conn.endpoint username = self.id.http_conn.username password = self.id.http_conn.password - f = File(external_domain, endpoint=endpoint, username=username, password=password, mode='r') + f = File(external_domain, endpoint=endpoint, username=username, password=password, mode='r') except IOError: # unable to find external link raise KeyError("Unable to open file: " + link_json['h5domain']) diff --git a/h5pyd/_hl/selections.py b/h5pyd/_hl/selections.py index e91f233..26cacd7 100644 --- a/h5pyd/_hl/selections.py +++ b/h5pyd/_hl/selections.py @@ -519,7 +519,7 @@ def __getitem__(self, args): # raise TypeError(f'Illegal coordinate index "{arg}" must be a list of integers') if x < 0 or x >= length: - raise IndexError(f"Index ({arg}) out of range (0-{length-1})") + raise IndexError(f"Index ({arg}) out of range (0-{length - 1})") if prev is not None and x <= prev: raise TypeError("Indexing elements must be in increasing order") prev = x @@ -528,7 +528,7 @@ def __getitem__(self, args): select_type = H5S_SELLECT_FANCY elif isinstance(arg, int): if arg < 0 or arg >= length: - raise IndexError(f"Index ({arg}) out of range (0-{length-1})") + raise IndexError(f"Index ({arg}) out of range (0-{length - 1})") slices.append(arg) elif isinstance(arg, type(Ellipsis)): slices.append(slice(0, length, 1)) @@ -659,7 +659,7 @@ def _translate_int(exp, length): exp = length + exp if not 0 <= exp < length: - raise IndexError(f"Index ({exp}) out of range (0-{length-1})") + raise IndexError(f"Index ({exp}) out of range (0-{length - 1})") return exp, 1, 1 diff --git a/h5pyd/version.py b/h5pyd/version.py index df91860..e9a9c88 100644 --- a/h5pyd/version.py +++ b/h5pyd/version.py @@ -12,7 +12,7 @@ from __future__ import absolute_import -from distutils.version import StrictVersion as _sv +from packaging.version import Version, parse import sys import numpy @@ -20,11 +20,11 @@ hdf5_version = "REST" -_exp = _sv(version) +_exp = parse(version) -version_tuple = _exp.version + ( - ("".join(str(x) for x in _exp.prerelease),) - if _exp.prerelease is not None +version_tuple = _exp._version + ( + ("".join(str(x) for x in _exp.pre),) + if _exp.is_prerelease else ("",) ) diff --git a/setup.py b/setup.py index 12bc5c5..9f0bd5b 100644 --- a/setup.py +++ b/setup.py @@ -36,6 +36,7 @@ "requests_unixsocket", "pytz", "pyjwt", + "packaging" # "cryptography", ], setup_requires=["pkgconfig"], diff --git a/test/hl/test_vlentype.py b/test/hl/test_vlentype.py index 63e79ba..a1c0da4 100644 --- a/test/hl/test_vlentype.py +++ b/test/hl/test_vlentype.py @@ -146,7 +146,7 @@ def test_create_vlen_dset(self): e1 = ret_val[1] self.assertTrue(isinstance(e1, np.ndarray)) self.assertEqual(e1.shape, (0,)) - + # create numpy object array e0 = np.array([1, 2, 3], dtype='uint16') e1 = np.array([1, 2, 3, 4], dtype='uint16')