From a763e5d1b3921b3194f3d4e94ab9de3fbe08bbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Picca=20Fr=C3=A9d=C3=A9ric-Emmanuel?= Date: Tue, 28 May 2019 08:16:16 +0200 Subject: New upstream version 0.10.1+dfsg --- silx/io/dictdump.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'silx/io/dictdump.py') diff --git a/silx/io/dictdump.py b/silx/io/dictdump.py index 0087753..e8cabcf 100644 --- a/silx/io/dictdump.py +++ b/silx/io/dictdump.py @@ -31,14 +31,7 @@ import logging import numpy import os.path import sys - -try: - import h5py -except ImportError as e: - h5py_missing = True - h5py_import_error = e -else: - h5py_missing = False +import h5py from .configdict import ConfigDict from .utils import is_group @@ -209,8 +202,6 @@ def dicttoh5(treedict, h5file, h5path='/', dicttoh5(city_area, "cities.h5", h5path="/area", create_dataset_args=create_ds_args) """ - if h5py_missing: - raise h5py_import_error if not h5path.endswith("/"): h5path += "/" @@ -310,9 +301,6 @@ def h5todict(h5file, path="/", exclude_names=None): a string in this list will be ignored. Default is None (ignore nothing) :return: Nested dictionary """ - if h5py_missing: - raise h5py_import_error - with _SafeH5FileRead(h5file) as h5f: ddict = {} for key in h5f[path]: @@ -395,9 +383,6 @@ def dump(ddict, ffile, mode="w", fmat=None): if fmat == "json": dicttojson(ddict, ffile, indent=2, mode=mode) elif fmat in ["hdf5", "h5"]: - if h5py_missing: - logger.error("Cannot dump to HDF5 format, missing h5py library") - raise h5py_import_error dicttoh5(ddict, ffile, mode=mode) elif fmat in ["ini", "cfg"]: dicttoini(ddict, ffile, mode=mode) @@ -436,9 +421,6 @@ def load(ffile, fmat=None): if fmat == "json": return json.load(f, object_pairs_hook=OrderedDict) if fmat in ["hdf5", "h5"]: - if h5py_missing: - logger.error("Cannot load from HDF5 format, missing h5py library") - raise h5py_import_error return h5todict(fname) elif fmat in ["ini", "cfg"]: return ConfigDict(filelist=[fname]) -- cgit v1.2.3