From 338fce8b5d6742bd43ee7615de775f19655fe826 Mon Sep 17 00:00:00 2001 From: Vitesh Shah Date: Tue, 28 Nov 2023 12:52:57 +0100 Subject: [PATCH] nested methods and attributes need to added individually --- python/damask/_result.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index 28d2dfc8e..faa2c1fbd 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -28,12 +28,26 @@ from . import tensor from . import util from ._typehints import FloatSequence, IntSequence, DADF5Dataset +h5py_module_list = ['h5py','h5py._hl','h5py._hl.attrs'] +module_dict = {} + SPEC_H5PY = importlib.util.find_spec('h5py') h5py_modified = importlib.util.module_from_spec(SPEC_H5PY) SPEC_H5PY.loader.exec_module(h5py_modified) sys.modules['h5py_modified'] = h5py_modified -h5py_modified.__dict__['_hl'] = h5py.__dict__['_hl'] +SPEC_H5PY_HL = importlib.util.find_spec('h5py._hl') +h5py_hl_modified = importlib.util.module_from_spec(SPEC_H5PY_HL) +SPEC_H5PY_HL.loader.exec_module(h5py_hl_modified) +sys.modules['h5py_hl_modified'] = h5py_hl_modified + +SPEC_H5PY_HL_attrs = importlib.util.find_spec('h5py._hl.attrs') +h5py_hl_attrs_modified = importlib.util.module_from_spec(SPEC_H5PY_HL_attrs) +SPEC_H5PY_HL_attrs.loader.exec_module(h5py_hl_attrs_modified) +sys.modules['h5py_hl_attrs_modified'] = h5py_hl_attrs_modified + +h5py_hl_modified.__dict__['attrs'] = h5py_hl_attrs_modified +h5py_modified.__dict__['_hl'] = h5py_hl_modified h5py3 = h5py.__version__[0] == '3'