From 1f31c4e54c745358c51faae5fb43453d6b7cdc69 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Wed, 23 Nov 2022 11:24:45 +0100 Subject: [PATCH] rename REGISTERED_FITLERS to registered_filters (it's not a constant) --- src/hdf5plugin/_utils.py | 18 +++++++++--------- src/hdf5plugin/test.py | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/hdf5plugin/_utils.py b/src/hdf5plugin/_utils.py index 0723f085..7f3d377c 100644 --- a/src/hdf5plugin/_utils.py +++ b/src/hdf5plugin/_utils.py @@ -60,7 +60,7 @@ def is_filter_available(name): return h5py.h5z.filter_avail(filter_id) > 0 -REGISTERED_FILTERS = {} +registered_filters = {} """Store hdf5plugin registered filters as a mapping: name: (filename, ctypes.CDLL)""" @@ -94,7 +94,7 @@ def register_filter(name): except RuntimeError: logger.debug("Filter %s (%d) not unregistered" % (name, filter_id)) logger.debug(traceback.format_exc()) - REGISTERED_FILTERS.pop(name, None) + registered_filters.pop(name, None) # Load DLL filename = glob.glob(os.path.join( @@ -127,7 +127,7 @@ def register_filter(name): return False logger.debug("Registered filter: %s (%s)", name, filename) - REGISTERED_FILTERS[name] = filename, lib + registered_filters[name] = filename, lib return True @@ -140,16 +140,16 @@ def register_filter(name): def get_config(): """Provides information about build configuration and filters registered by hdf5plugin. """ - registered_filters = {} + filters = {} for name in FILTERS: - info = REGISTERED_FILTERS.get(name) + info = registered_filters.get(name) if info is not None: # Registered by hdf5plugin if is_filter_available(name) in (True, None): - registered_filters[name] = info[0] + filters[name] = info[0] elif is_filter_available(name) is True: # Registered elsewhere - registered_filters[name] = "unknown" + filters[name] = "unknown" - return HDF5PluginConfig(build_config, registered_filters) + return HDF5PluginConfig(build_config, filters) def register(filters=tuple(FILTERS.keys()), force=True): @@ -166,7 +166,7 @@ def register(filters=tuple(FILTERS.keys()), force=True): :rtype: bool """ if isinstance(filters, str): - names = (filters,) + filters = (filters,) status = True for filter_name in filters: diff --git a/src/hdf5plugin/test.py b/src/hdf5plugin/test.py index 5ab34f17..e8b14826 100644 --- a/src/hdf5plugin/test.py +++ b/src/hdf5plugin/test.py @@ -283,19 +283,19 @@ def _simple_test(self, filter_name): @unittest.skipUnless(hdf5plugin.config.embedded_filters, "No embedded filters") def test_register_single_filter(self): """Re-register embedded filters one at a time""" - for name in hdf5plugin.config.embedded_filters: - with self.subTest(name=name): - status = hdf5plugin.register(name, force=True) + for filter_name in hdf5plugin.config.embedded_filters: + with self.subTest(name=filter_name): + status = hdf5plugin.register(filter_name, force=True) self.assertTrue(status) - self._simple_test(name) + self._simple_test(filter_name) @unittest.skipUnless(hdf5plugin.config.embedded_filters, "No embedded filters") def test_register_all_filters(self): """Re-register embedded filters all at once""" status = hdf5plugin.register() - for name in hdf5plugin.config.embedded_filters: - with self.subTest(name=name): - self._simple_test(name) + for filter_name in hdf5plugin.config.embedded_filters: + with self.subTest(name=filter_name): + self._simple_test(filter_name) def suite():