h5rdmtoolbox 2.2.1__tar.gz → 2.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/PKG-INFO +5 -5
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/hdf/datasets.py +7 -3
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/rdf.py +10 -4
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/utils.py +9 -4
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/repository/interface.py +1 -19
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/repository/zenodo/core.py +1 -50
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/repository/zenodo/tokens.py +1 -1
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox.egg-info/PKG-INFO +5 -5
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox.egg-info/SOURCES.txt +1 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox.egg-info/requires.txt +4 -4
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/setup.cfg +5 -5
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/ld/test_ld.py +39 -1
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/ld/test_rdf.py +3 -2
- h5rdmtoolbox-2.3.1/tests/ld/test_utils.py +13 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/repository/test_zenodo.py +42 -49
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/test_version.py +3 -3
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/LICENSE +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/README.md +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/_cfg.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/_repr.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/_version.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/cli.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/consts.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/cfg.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/consts.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/core.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/errors.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/generate.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/ontology/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/ontology/h5ontocls.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/ontology/hdf_datatypes.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/references.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/standard_attributes.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/toolbox_validators.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/convention/utils.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/def_icon.png +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/fluid-v1.yml +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/h5tbx.yaml +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/id_icon.png +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/iri_icon.png +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/ld_icon.png +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/piv-v1.yml +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/style.css +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/tutorial_convention.yaml +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/tutorial_standard_name_table.yaml +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/type_icon.png +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/database/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/database/hdfdb/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/database/hdfdb/filedb.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/database/hdfdb/objdb.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/database/hdfdb/query.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/database/hdfdb/utils.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/database/interface.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/database/lazy.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/database/mongo.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/errors.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/extensions/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/extensions/magnitude.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/extensions/normalize.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/extensions/onto.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/extensions/units.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/extensions/vector.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/gui/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/gui/fairify.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/gui/src/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/gui/src/main.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/identifiers.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/layout/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/layout/core.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/globals.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/hdf/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/hdf/attributes.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/hdf/file.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/hdf/groups.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/user/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/user/attributes.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/user/datasets.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/user/file.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/ld/user/groups.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/plotting.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/protected_attributes.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/protocols.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/repository/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/repository/utils.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/repository/zenodo/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/repository/zenodo/metadata.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/repository/zenodo/utils.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/tutorial.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/user.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/utils.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/accessor.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/accessors/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/accessors/provenance.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/core.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/ds_decoder.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/h5attr.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/h5ext.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/h5utils.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/h5yaml.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/jsonld.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/wrapper/xr2hdf.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox.egg-info/dependency_links.txt +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox.egg-info/entry_points.txt +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox.egg-info/top_level.txt +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/pyproject.toml +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/setup.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/clean_zenodo_sandbox.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/conventions/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/conventions/test_convention_vfuncs.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/conventions/test_conventions.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/conventions/test_engmeta.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/conventions/test_references.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/conventions/test_toolbox_validators.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/conventions/test_utils.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/database/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/database/test_find_rdf.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/database/test_hdfDB.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/database/test_mongo.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/layouts/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/layouts/test_core.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/layouts/test_docs.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/ld/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/ld/test_user_graph.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/repository/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/test_cli.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/test_config.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/test_extensions.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/test_identifiers.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/test_plotting.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/test_repr.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/test_user.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/test_utils.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/test_xarray_export.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/wrapper/__init__.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/wrapper/test_core.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/wrapper/test_dump.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/wrapper/test_file.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/wrapper/test_h5ext.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/wrapper/test_lazy.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/wrapper/test_namespaces.py +0 -0
- {h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/tests/wrapper/test_xr2df.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: h5rdmtoolbox
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: Supporting a FAIR Research Data lifecycle using Python and HDF5.
|
|
5
5
|
Home-page: https://h5rdmtoolbox.readthedocs.io/en/latest/
|
|
6
6
|
Author: Matthias Probst
|
|
@@ -16,10 +16,10 @@ Classifier: Topic :: Scientific/Engineering
|
|
|
16
16
|
Requires-Python: <3.13,>=3.9
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: appdirs
|
|
19
|
+
Requires-Dist: appdirs~=1.4
|
|
20
20
|
Requires-Dist: importlib_resources<7.0.0,>=6.5.2
|
|
21
21
|
Requires-Dist: numpy<2.0.0,>=1.20
|
|
22
|
-
Requires-Dist: h5py
|
|
22
|
+
Requires-Dist: h5py~=3.8
|
|
23
23
|
Requires-Dist: matplotlib>=3.5.2
|
|
24
24
|
Requires-Dist: IPython>=7.34.0
|
|
25
25
|
Requires-Dist: pyyaml>=6.0
|
|
@@ -31,8 +31,8 @@ Requires-Dist: packaging>=24.1
|
|
|
31
31
|
Requires-Dist: ontolutils<0.20.0,>=0.19.2
|
|
32
32
|
Requires-Dist: python-forge==18.6.0
|
|
33
33
|
Requires-Dist: requests>=2.32.4
|
|
34
|
-
Requires-Dist: pydantic
|
|
35
|
-
Requires-Dist: rdflib
|
|
34
|
+
Requires-Dist: pydantic~=2.8
|
|
35
|
+
Requires-Dist: rdflib~=7.1
|
|
36
36
|
Requires-Dist: click==8.1.7
|
|
37
37
|
Provides-Extra: database
|
|
38
38
|
Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "database"
|
|
@@ -23,11 +23,15 @@ HDF5_FILTER_ONTOLOGY = {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def add_filter(dataset: h5py.Dataset, dataset_uri, graph) -> rdflib.Graph:
|
|
26
|
+
def add_filter(dataset: h5py.Dataset, dataset_uri, graph, blank_node_iri_base) -> rdflib.Graph:
|
|
27
27
|
# Check predefined compression filters
|
|
28
28
|
if dataset.compression:
|
|
29
29
|
filter_type = HDF5_FILTER_ONTOLOGY.get(dataset.compression, None)
|
|
30
|
-
filter_uri =
|
|
30
|
+
filter_uri = get_property_node(
|
|
31
|
+
dataset,
|
|
32
|
+
name='filter',
|
|
33
|
+
blank_node_iri_base=blank_node_iri_base
|
|
34
|
+
)
|
|
31
35
|
if filter_type:
|
|
32
36
|
graph.add((filter_uri, RDF.type, filter_type))
|
|
33
37
|
if filter_type == HDF5.FilterDeflate:
|
|
@@ -55,7 +59,7 @@ def process_dataset(
|
|
|
55
59
|
"""Process an HDF5 dataset, adding it to the RDF graph."""
|
|
56
60
|
graph.add((dataset_uri, RDF.type, HDF.Dataset))
|
|
57
61
|
|
|
58
|
-
graph = add_filter(dataset, dataset_uri, graph)
|
|
62
|
+
graph = add_filter(dataset, dataset_uri, graph, blank_node_iri_base)
|
|
59
63
|
|
|
60
64
|
graph.add((parent_uri, HDF.member, dataset_uri))
|
|
61
65
|
|
|
@@ -81,8 +81,7 @@ def validate_url(url: str) -> str:
|
|
|
81
81
|
url = KNOWN_NAMESPACES[prefix] + name
|
|
82
82
|
else:
|
|
83
83
|
raise RDFError(f'Invalid URL: "{url}".')
|
|
84
|
-
HttpUrl(url) # validate the URL, will raise an error if invalid
|
|
85
|
-
return str(url) # return the original string
|
|
84
|
+
return str(HttpUrl(url)) # validate the URL, will raise an error if invalid and return the encoded string
|
|
86
85
|
except pydantic.ValidationError as e:
|
|
87
86
|
raise RDFError(f'Invalid URL: "{url}". Expecting a valid URL. This was validated with pydantic. '
|
|
88
87
|
f'Tested with pydantic: {e}')
|
|
@@ -102,6 +101,8 @@ def set_predicate(attr: h5py.AttributeManager,
|
|
|
102
101
|
The name of the attribute
|
|
103
102
|
value : str
|
|
104
103
|
The value (identifier) to add to the iri dict attribute
|
|
104
|
+
rdf_predicate_attr_name: str, optional
|
|
105
|
+
The name of the attribute to store the predicate information, by default RDF_PREDICATE_ATTR_NAME
|
|
105
106
|
|
|
106
107
|
Returns
|
|
107
108
|
-------
|
|
@@ -349,6 +350,11 @@ class RDFManager:
|
|
|
349
350
|
'predicate',
|
|
350
351
|
'type'):
|
|
351
352
|
raise KeyError(f"Cannot set {key}. Only subject, predicate and type can be set!")
|
|
353
|
+
if key in ("subject", "predicate"):
|
|
354
|
+
try:
|
|
355
|
+
value = str(HttpUrl(value))
|
|
356
|
+
except pydantic.ValidationError as e:
|
|
357
|
+
RDFError(f"Invalid value. Expecting a valid URL. This was validated with pydantic: {value}")
|
|
352
358
|
super().__setattr__(key, value)
|
|
353
359
|
|
|
354
360
|
@property
|
|
@@ -394,7 +400,7 @@ class RDFManager:
|
|
|
394
400
|
if _subject == str(rdf_subject):
|
|
395
401
|
res_subject.append(node)
|
|
396
402
|
|
|
397
|
-
def _find_type(
|
|
403
|
+
def _find_type(_, node):
|
|
398
404
|
rdfm = RDFManager(node.attrs)
|
|
399
405
|
if not isinstance(rdfm.type, list):
|
|
400
406
|
types = [rdfm.type]
|
|
@@ -513,7 +519,7 @@ class RDFManager:
|
|
|
513
519
|
|
|
514
520
|
def pop_type(self, rdf_type: str):
|
|
515
521
|
"""Remove a type from the list of types"""
|
|
516
|
-
rdf_type = str(rdf_type)
|
|
522
|
+
rdf_type = str(HttpUrl(rdf_type))
|
|
517
523
|
iri_type_data = self._attr.get(RDF_TYPE_ATTR_NAME, None)
|
|
518
524
|
if iri_type_data is None:
|
|
519
525
|
return
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import pathlib
|
|
2
|
+
import urllib.parse
|
|
2
3
|
from typing import Optional
|
|
3
4
|
from typing import Union
|
|
4
5
|
|
|
@@ -7,6 +8,10 @@ import rdflib
|
|
|
7
8
|
from rdflib.namespace import XSD
|
|
8
9
|
|
|
9
10
|
|
|
11
|
+
def _parse_obj_name(obj_name: str):
|
|
12
|
+
return urllib.parse.quote(obj_name, safe='/')
|
|
13
|
+
|
|
14
|
+
|
|
10
15
|
def get_attr_dtype_as_XSD(data):
|
|
11
16
|
if isinstance(data, str):
|
|
12
17
|
return XSD.string
|
|
@@ -47,8 +52,8 @@ def _get_obj_id(file_id: float, obj: Union[h5py.Dataset, h5py.Group], name: Opti
|
|
|
47
52
|
if name is None:
|
|
48
53
|
if obj.name == "/":
|
|
49
54
|
return f"{_file_id}{obj.name}"
|
|
50
|
-
return f"{_file_id}{obj.name}"
|
|
51
|
-
return f"{_file_id}{obj.name}{name}"
|
|
55
|
+
return f"{_file_id}{_parse_obj_name(obj.name)}"
|
|
56
|
+
return f"{_file_id}{_parse_obj_name(obj.name)}{name}"
|
|
52
57
|
# return hashlib.md5(f"{obj.file.id.id}/{obj.name}{name}".encode()).hexdigest()
|
|
53
58
|
|
|
54
59
|
|
|
@@ -104,7 +109,7 @@ def get_property_node(
|
|
|
104
109
|
if obj.name == "/":
|
|
105
110
|
_id = f"{_file_id}@{name}"
|
|
106
111
|
else:
|
|
107
|
-
_id = f"{_file_id}{obj.name}__{name}"
|
|
112
|
+
_id = f"{_file_id}{_parse_obj_name(obj.name)}__{name}"
|
|
108
113
|
if blank_node_iri_base:
|
|
109
114
|
return rdflib.URIRef(f'{blank_node_iri_base}{_id}')
|
|
110
115
|
return rdflib.BNode(_id)
|
|
@@ -118,7 +123,7 @@ def get_attr_node(
|
|
|
118
123
|
if obj.name == "/":
|
|
119
124
|
_id = f"{_file_id}@{name}"
|
|
120
125
|
else:
|
|
121
|
-
_id = f"{_file_id}{obj.name}@{name}"
|
|
126
|
+
_id = f"{_file_id}{_parse_obj_name(obj.name)}@{name}"
|
|
122
127
|
if blank_node_iri_base:
|
|
123
128
|
return rdflib.URIRef(f'{blank_node_iri_base}{_id}')
|
|
124
129
|
return rdflib.BNode(f"{_id}")
|
|
@@ -69,7 +69,7 @@ class RepositoryFile:
|
|
|
69
69
|
access_url=self.access_url,
|
|
70
70
|
media_type=self.media_type,
|
|
71
71
|
checksum=self.checksum,
|
|
72
|
-
filename=self.
|
|
72
|
+
filename=self.name,
|
|
73
73
|
size=self.size)
|
|
74
74
|
|
|
75
75
|
def jsonld(self) -> str:
|
|
@@ -114,10 +114,6 @@ class RepositoryFile:
|
|
|
114
114
|
class RepositoryInterface(abc.ABC):
|
|
115
115
|
"""Abstract base class for repository interfaces."""
|
|
116
116
|
|
|
117
|
-
# __init__ must be implemented in the child class
|
|
118
|
-
def __init__(self):
|
|
119
|
-
raise RuntimeError('Not implemented.')
|
|
120
|
-
|
|
121
117
|
@property
|
|
122
118
|
@abc.abstractmethod
|
|
123
119
|
def identifier(self) -> str:
|
|
@@ -140,20 +136,6 @@ class RepositoryInterface(abc.ABC):
|
|
|
140
136
|
def set_metadata(self, metadata):
|
|
141
137
|
"""Set the metadata of the repository."""
|
|
142
138
|
|
|
143
|
-
@abc.abstractmethod
|
|
144
|
-
def download_file(self, filename):
|
|
145
|
-
"""Download a specific file from the repository.
|
|
146
|
-
|
|
147
|
-
..note: This method is deprecated. Use method `.files.get(filename).download()` method instead.
|
|
148
|
-
"""
|
|
149
|
-
|
|
150
|
-
@abc.abstractmethod
|
|
151
|
-
def download_files(self):
|
|
152
|
-
"""Download all files from the repository.
|
|
153
|
-
|
|
154
|
-
..note: This method is deprecated. Please iterate over `files` and call .download() on the items.
|
|
155
|
-
"""
|
|
156
|
-
|
|
157
139
|
@property
|
|
158
140
|
@abc.abstractmethod
|
|
159
141
|
def files(self) -> Dict[str, RepositoryFile]:
|
|
@@ -4,13 +4,12 @@ import logging
|
|
|
4
4
|
import pathlib
|
|
5
5
|
import time
|
|
6
6
|
import warnings
|
|
7
|
-
from typing import Union,
|
|
7
|
+
from typing import Union, Dict, Optional
|
|
8
8
|
|
|
9
9
|
import requests
|
|
10
10
|
from packaging.version import Version
|
|
11
11
|
from rdflib import Graph
|
|
12
12
|
|
|
13
|
-
from h5rdmtoolbox.utils import deprecated
|
|
14
13
|
from .metadata import Metadata
|
|
15
14
|
from .tokens import get_api_token
|
|
16
15
|
from ..interface import RepositoryInterface, RepositoryFile
|
|
@@ -226,31 +225,6 @@ class AbstractZenodoInterface(RepositoryInterface, abc.ABC):
|
|
|
226
225
|
rfiles = [RepositoryFile(**_parse(data)) for data in self.json()['files']]
|
|
227
226
|
return {f.name: f for f in rfiles}
|
|
228
227
|
|
|
229
|
-
@deprecated(version='1.4.0rc1',
|
|
230
|
-
msg='Please use `[file.download() for file in <repo>.files.values()]` instead.')
|
|
231
|
-
def download_files(self,
|
|
232
|
-
target_folder: Union[str, pathlib.Path] = None,
|
|
233
|
-
suffix: Union[str, List[str], None] = None) -> List[pathlib.Path]:
|
|
234
|
-
"""Download all (!) files from Zenodo. You may specify one or multiple suffixes to only download certain files.
|
|
235
|
-
|
|
236
|
-
Parameters
|
|
237
|
-
----------
|
|
238
|
-
target_folder : str or pathlib.Path, optional
|
|
239
|
-
The target folder, by default None
|
|
240
|
-
suffix: Union[str, List[str], None], optional=None
|
|
241
|
-
Specify a suffix to only download certain files
|
|
242
|
-
|
|
243
|
-
Returns
|
|
244
|
-
-------
|
|
245
|
-
List[pathlib.Path]
|
|
246
|
-
A list of all downloaded files.
|
|
247
|
-
"""
|
|
248
|
-
if suffix is None:
|
|
249
|
-
return [file.download(target_folder=target_folder) for file in self.files.values()]
|
|
250
|
-
if not isinstance(suffix, list):
|
|
251
|
-
suffix = [suffix, ]
|
|
252
|
-
return [file.download(target_folder=target_folder) for file in self.files.values() if file.suffix in suffix]
|
|
253
|
-
|
|
254
228
|
def download_file(self, filename: str, target_folder: Optional[Union[str, pathlib.Path]] = None) -> pathlib.Path:
|
|
255
229
|
"""Download a file based on URL. The url is validated using pydantic
|
|
256
230
|
|
|
@@ -673,29 +647,6 @@ class ZenodoRecord(RepositoryInterface):
|
|
|
673
647
|
rfiles = [RepositoryFile(**_parse(data)) for data in self.json()['files']]
|
|
674
648
|
return {f.name: f for f in rfiles}
|
|
675
649
|
|
|
676
|
-
@deprecated(version='1.4.0rc1',
|
|
677
|
-
msg='Please use `[file.download() for file in self.files.values()]` instead.')
|
|
678
|
-
def download_files(self,
|
|
679
|
-
target_folder: Union[str, pathlib.Path] = None,
|
|
680
|
-
suffix: Union[str, List[str], None] = None) -> List[pathlib.Path]:
|
|
681
|
-
"""Download all (!) files from Zenodo. You may specify one or multiple suffixes to only download certain files.
|
|
682
|
-
|
|
683
|
-
Parameters
|
|
684
|
-
----------
|
|
685
|
-
target_folder : str or pathlib.Path, optional
|
|
686
|
-
The target folder, by default None
|
|
687
|
-
suffix: Union[str, List[str], None], optional=None
|
|
688
|
-
Specify a suffix to only download certain files
|
|
689
|
-
|
|
690
|
-
Returns
|
|
691
|
-
-------
|
|
692
|
-
List[pathlib.Path]
|
|
693
|
-
A list of all downloaded files.
|
|
694
|
-
"""
|
|
695
|
-
warnings.warn("This method is deprecated. Please loop over `.files` and call `.download()` on the "
|
|
696
|
-
"items of the returned list", DeprecationWarning)
|
|
697
|
-
return [file.download(target_folder=target_folder) for file in self.files.values()]
|
|
698
|
-
|
|
699
650
|
def download_file(self, filename: str, target_folder: Optional[Union[str, pathlib.Path]] = None) -> pathlib.Path:
|
|
700
651
|
"""Download a file based on URL. The url is validated using pydantic
|
|
701
652
|
|
|
@@ -7,7 +7,7 @@ from typing import Union, Optional
|
|
|
7
7
|
logger = logging.getLogger('h5rdmtoolbox')
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def _parse_ini_file(zenodo_ini_filename: Union[str, pathlib.Path]):
|
|
10
|
+
def _parse_ini_file(zenodo_ini_filename: Optional[Union[str, pathlib.Path]]):
|
|
11
11
|
"""Parse the Zenodo ini file.
|
|
12
12
|
|
|
13
13
|
Parameters
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: h5rdmtoolbox
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: Supporting a FAIR Research Data lifecycle using Python and HDF5.
|
|
5
5
|
Home-page: https://h5rdmtoolbox.readthedocs.io/en/latest/
|
|
6
6
|
Author: Matthias Probst
|
|
@@ -16,10 +16,10 @@ Classifier: Topic :: Scientific/Engineering
|
|
|
16
16
|
Requires-Python: <3.13,>=3.9
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: appdirs
|
|
19
|
+
Requires-Dist: appdirs~=1.4
|
|
20
20
|
Requires-Dist: importlib_resources<7.0.0,>=6.5.2
|
|
21
21
|
Requires-Dist: numpy<2.0.0,>=1.20
|
|
22
|
-
Requires-Dist: h5py
|
|
22
|
+
Requires-Dist: h5py~=3.8
|
|
23
23
|
Requires-Dist: matplotlib>=3.5.2
|
|
24
24
|
Requires-Dist: IPython>=7.34.0
|
|
25
25
|
Requires-Dist: pyyaml>=6.0
|
|
@@ -31,8 +31,8 @@ Requires-Dist: packaging>=24.1
|
|
|
31
31
|
Requires-Dist: ontolutils<0.20.0,>=0.19.2
|
|
32
32
|
Requires-Dist: python-forge==18.6.0
|
|
33
33
|
Requires-Dist: requests>=2.32.4
|
|
34
|
-
Requires-Dist: pydantic
|
|
35
|
-
Requires-Dist: rdflib
|
|
34
|
+
Requires-Dist: pydantic~=2.8
|
|
35
|
+
Requires-Dist: rdflib~=7.1
|
|
36
36
|
Requires-Dist: click==8.1.7
|
|
37
37
|
Provides-Extra: database
|
|
38
38
|
Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "database"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
appdirs
|
|
1
|
+
appdirs~=1.4
|
|
2
2
|
importlib_resources<7.0.0,>=6.5.2
|
|
3
3
|
numpy<2.0.0,>=1.20
|
|
4
|
-
h5py
|
|
4
|
+
h5py~=3.8
|
|
5
5
|
matplotlib>=3.5.2
|
|
6
6
|
IPython>=7.34.0
|
|
7
7
|
pyyaml>=6.0
|
|
@@ -13,8 +13,8 @@ packaging>=24.1
|
|
|
13
13
|
ontolutils<0.20.0,>=0.19.2
|
|
14
14
|
python-forge==18.6.0
|
|
15
15
|
requests>=2.32.4
|
|
16
|
-
pydantic
|
|
17
|
-
rdflib
|
|
16
|
+
pydantic~=2.8
|
|
17
|
+
rdflib~=7.1
|
|
18
18
|
click==8.1.7
|
|
19
19
|
|
|
20
20
|
[complete]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = h5rdmtoolbox
|
|
3
|
-
version = 2.
|
|
3
|
+
version = 2.3.1
|
|
4
4
|
author = Matthias Probst
|
|
5
5
|
author_email = matth.probst@gmail.com
|
|
6
6
|
description = Supporting a FAIR Research Data lifecycle using Python and HDF5.
|
|
@@ -22,10 +22,10 @@ packages = find:
|
|
|
22
22
|
python_requires = >=3.9, <3.13
|
|
23
23
|
include_package_data = True
|
|
24
24
|
install_requires =
|
|
25
|
-
appdirs
|
|
25
|
+
appdirs~=1.4
|
|
26
26
|
importlib_resources>=6.5.2, <7.0.0
|
|
27
27
|
numpy >= 1.20, < 2.0.0 # 2.0.0 fails with pint
|
|
28
|
-
h5py
|
|
28
|
+
h5py~=3.8
|
|
29
29
|
matplotlib >= 3.5.2
|
|
30
30
|
IPython >= 7.34.0 # colab wants 7.34.0
|
|
31
31
|
pyyaml >= 6.0 # 5.4 does not work with python 3.11!
|
|
@@ -37,8 +37,8 @@ install_requires =
|
|
|
37
37
|
ontolutils>=0.19.2,<0.20.0
|
|
38
38
|
python-forge==18.6.0
|
|
39
39
|
requests>=2.32.4
|
|
40
|
-
pydantic
|
|
41
|
-
rdflib
|
|
40
|
+
pydantic~=2.8
|
|
41
|
+
rdflib~=7.1
|
|
42
42
|
click==8.1.7
|
|
43
43
|
|
|
44
44
|
[options.extras_require]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import pathlib
|
|
3
3
|
import unittest
|
|
4
|
+
from typing import Union
|
|
4
5
|
|
|
5
6
|
import numpy as np
|
|
6
7
|
import ontolutils
|
|
@@ -21,6 +22,41 @@ logger = h5tbx.logger
|
|
|
21
22
|
|
|
22
23
|
__this_dir__ = pathlib.Path(__file__).parent
|
|
23
24
|
|
|
25
|
+
EXCEPTION_PROPERTIES_NAMESPACES = {
|
|
26
|
+
str(rdflib.OWL),
|
|
27
|
+
str(rdflib.RDF),
|
|
28
|
+
str(rdflib.RDFS),
|
|
29
|
+
str(rdflib.XSD)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _raise_on_blank_nodes(
|
|
34
|
+
ttl,
|
|
35
|
+
exception_properties=None) -> rdflib.Graph:
|
|
36
|
+
"""Raises an error if the given RDF file contains blank nodes."""
|
|
37
|
+
if exception_properties is None:
|
|
38
|
+
exception_properties = EXCEPTION_PROPERTIES_NAMESPACES
|
|
39
|
+
|
|
40
|
+
temp_graph = rdflib.Graph()
|
|
41
|
+
temp_graph.parse(data=ttl, format='ttl')
|
|
42
|
+
|
|
43
|
+
# Check if there are any blank nodes
|
|
44
|
+
has_blank_nodes = any(
|
|
45
|
+
isinstance(term, rdflib.BNode)
|
|
46
|
+
for triple in temp_graph
|
|
47
|
+
for term in triple
|
|
48
|
+
)
|
|
49
|
+
if has_blank_nodes:
|
|
50
|
+
for s, p, o in temp_graph:
|
|
51
|
+
if isinstance(s, rdflib.BNode) or isinstance(p, rdflib.BNode) or isinstance(o, rdflib.BNode):
|
|
52
|
+
# allow all owl properties:
|
|
53
|
+
for ep in exception_properties:
|
|
54
|
+
if str(p).startswith(ep):
|
|
55
|
+
break
|
|
56
|
+
else:
|
|
57
|
+
raise ValueError(f"Blank nodes are not supported: {s}, {p}, {o}")
|
|
58
|
+
return temp_graph
|
|
59
|
+
|
|
24
60
|
|
|
25
61
|
class TestJSONLD(unittest.TestCase):
|
|
26
62
|
|
|
@@ -93,7 +129,7 @@ class TestJSONLD(unittest.TestCase):
|
|
|
93
129
|
h5.create_string_dataset('ds_str1', data=["Hello", "World"])
|
|
94
130
|
h5.create_dataset('ds1', data=[1, 2, 3])
|
|
95
131
|
h5.create_dataset('ds2', data=[[1, 2], [3, 4]])
|
|
96
|
-
ttl = h5.serialize(fmt="ttl", skipND=1)
|
|
132
|
+
ttl = h5.serialize(fmt="ttl", skipND=1, file_uri="https://example.org/#")
|
|
97
133
|
|
|
98
134
|
g = rdflib.Graph().parse(data=ttl, format="ttl")
|
|
99
135
|
sparql_str = """PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
|
@@ -110,6 +146,8 @@ WHERE {
|
|
|
110
146
|
bindings = res.bindings
|
|
111
147
|
self.assertEqual(0, len(bindings))
|
|
112
148
|
|
|
149
|
+
_raise_on_blank_nodes(ttl)
|
|
150
|
+
|
|
113
151
|
def test_serialize_multiple_types(self):
|
|
114
152
|
with h5tbx.File() as h5:
|
|
115
153
|
h5.rdf.type = [M4I.Tool, 'https://www.wikidata.org/wiki/Q1058834']
|
|
@@ -257,14 +257,15 @@ class TestRDF(unittest.TestCase):
|
|
|
257
257
|
'https://example.org/objectURI3'])
|
|
258
258
|
|
|
259
259
|
h5['/'].rdf.subject = 'https://example.org/is group'
|
|
260
|
-
self.assertEqual(h5.rdf.subject, 'https://example.org/is
|
|
260
|
+
self.assertEqual(h5.rdf.subject, 'https://example.org/is%20group')
|
|
261
261
|
|
|
262
262
|
h5['/'].rdf.subject = 'https://example.org/is root group'
|
|
263
|
-
self.assertEqual(h5.rdf.subject, 'https://example.org/is
|
|
263
|
+
self.assertEqual(h5.rdf.subject, 'https://example.org/is%20root%20group')
|
|
264
264
|
|
|
265
265
|
def test_delete_rdf_properties(self):
|
|
266
266
|
with h5tbx.File() as h5:
|
|
267
267
|
h5['/'].rdf.subject = 'https://example.org/is root group'
|
|
268
|
+
self.assertEqual(h5.rdf.subject, 'https://example.org/is%20root%20group')
|
|
268
269
|
del h5['/'].rdf.subject
|
|
269
270
|
self.assertEqual(h5.rdf.subject, None)
|
|
270
271
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from h5rdmtoolbox.ld.utils import _parse_obj_name
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TestUtile(unittest.TestCase):
|
|
7
|
+
|
|
8
|
+
def test_parsing_obj_names(self):
|
|
9
|
+
self.assertEqual(_parse_obj_name("/"), "/")
|
|
10
|
+
self.assertEqual(_parse_obj_name(" "), "%20")
|
|
11
|
+
self.assertEqual(_parse_obj_name("/My Group/"), "/My%20Group/")
|
|
12
|
+
self.assertEqual(_parse_obj_name("/My Group/My Dataset"), "/My%20Group/My%20Dataset")
|
|
13
|
+
self.assertEqual(_parse_obj_name("/My !&9]231,.0Group/My Dataset "), "/My%20%21%269%5D231%2C.0Group/My%20Dataset%20")
|
|
@@ -110,7 +110,7 @@ class TestZenodo(unittest.TestCase):
|
|
|
110
110
|
def test_creator(self):
|
|
111
111
|
from h5rdmtoolbox.repository.zenodo.metadata import Creator
|
|
112
112
|
with self.assertRaises(ValueError):
|
|
113
|
-
|
|
113
|
+
_ = Creator(name='John Doe', affiliation='University of Nowhere')
|
|
114
114
|
creator = Creator(name='Doe, John')
|
|
115
115
|
self.assertEqual(creator.name, 'Doe, John')
|
|
116
116
|
with self.assertRaises(pydantic.ValidationError):
|
|
@@ -163,41 +163,41 @@ class TestZenodo(unittest.TestCase):
|
|
|
163
163
|
|
|
164
164
|
with self.assertRaises(ValueError):
|
|
165
165
|
# wrong version
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
166
|
+
_ = Metadata(version='invalid',
|
|
167
|
+
title='h5rdmtoolbox',
|
|
168
|
+
description='A toolbox for managing HDF5-based research data management',
|
|
169
|
+
creators=[Creator(name='Doe, John', affiliation='University of Nowhere')],
|
|
170
|
+
keywords=['hdf5', 'research data management', 'rdm'],
|
|
171
|
+
upload_type='publication',
|
|
172
|
+
publication_type='other',
|
|
173
|
+
access_right='open',
|
|
174
|
+
publication_date='2023-01-01')
|
|
175
175
|
|
|
176
176
|
with self.assertRaises(ValueError):
|
|
177
177
|
# invalid embargo date
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
178
|
+
_ = Metadata(version='0.1.0-rc.1+build.1',
|
|
179
|
+
title='h5rdmtoolbox',
|
|
180
|
+
description='A toolbox for managing HDF5-based research data management',
|
|
181
|
+
creators=[Creator(name='Doe, John', affiliation='University of Nowhere')],
|
|
182
|
+
keywords=['hdf5', 'research data management', 'rdm'],
|
|
183
|
+
upload_type='publication',
|
|
184
|
+
publication_type='other',
|
|
185
|
+
access_right='embargoed',
|
|
186
|
+
embargo_date='2022-01-01', # too early!
|
|
187
|
+
publication_date='2023-01-01')
|
|
188
188
|
|
|
189
189
|
# invalid embargo date format
|
|
190
190
|
with self.assertRaises(ValueError):
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
191
|
+
_ = Metadata(version='0.1.0-rc.1+build.1',
|
|
192
|
+
title='h5rdmtoolbox',
|
|
193
|
+
description='A toolbox for managing HDF5-based research data management',
|
|
194
|
+
creators=[Creator(name='Doe, John', affiliation='University of Nowhere')],
|
|
195
|
+
keywords=['hdf5', 'research data management', 'rdm'],
|
|
196
|
+
upload_type='publication',
|
|
197
|
+
publication_type='other',
|
|
198
|
+
access_right='embargoed',
|
|
199
|
+
embargo_date='01-2022-01', # wrong format!
|
|
200
|
+
publication_date='2023-01-01')
|
|
201
201
|
|
|
202
202
|
def test_get_api(self):
|
|
203
203
|
self.assertIsInstance(get_api_token(sandbox=True), str)
|
|
@@ -270,7 +270,7 @@ class TestZenodo(unittest.TestCase):
|
|
|
270
270
|
access_token='321',
|
|
271
271
|
zenodo_ini_filename=ini_filename)
|
|
272
272
|
ini_filename = h5tbx.utils.generate_temporary_filename(suffix='.ini', touch=False)
|
|
273
|
-
with open(ini_filename, 'w')
|
|
273
|
+
with open(ini_filename, 'w'):
|
|
274
274
|
pass
|
|
275
275
|
set_api_token(sandbox=True,
|
|
276
276
|
access_token='321',
|
|
@@ -455,9 +455,6 @@ class TestZenodo(unittest.TestCase):
|
|
|
455
455
|
embargo_date='2020'
|
|
456
456
|
)
|
|
457
457
|
|
|
458
|
-
with self.assertRaises(TypeError):
|
|
459
|
-
z.set_metadata(12)
|
|
460
|
-
|
|
461
458
|
z.set_metadata(meta.model_dump())
|
|
462
459
|
z.set_metadata(meta)
|
|
463
460
|
ret_metadata = z.get_metadata()
|
|
@@ -489,14 +486,14 @@ class TestZenodo(unittest.TestCase):
|
|
|
489
486
|
tmpfile.unlink()
|
|
490
487
|
self.assertFalse(tmpfile.exists())
|
|
491
488
|
|
|
492
|
-
filename = z.
|
|
489
|
+
filename = z.files["testfile.txt"].download()
|
|
493
490
|
self.assertIsInstance(filename, pathlib.Path)
|
|
494
491
|
self.assertTrue(filename.exists())
|
|
495
492
|
with open(filename, 'r') as f:
|
|
496
493
|
self.assertEqual(f.read(), 'This is a test file.')
|
|
497
494
|
filename.unlink()
|
|
498
495
|
|
|
499
|
-
filenames = z.
|
|
496
|
+
filenames = [f.download() for f in z.files.values()]
|
|
500
497
|
|
|
501
498
|
self.assertIsInstance(filenames, list)
|
|
502
499
|
self.assertIsInstance(filenames[0], pathlib.Path)
|
|
@@ -505,17 +502,16 @@ class TestZenodo(unittest.TestCase):
|
|
|
505
502
|
filename.unlink()
|
|
506
503
|
|
|
507
504
|
hdf5_filenames = [file.download() for file in z.files.values() if file.suffix == '.hdf']
|
|
508
|
-
|
|
509
|
-
z.download_files(suffix='.hdf')
|
|
505
|
+
|
|
510
506
|
self.assertIsInstance(hdf5_filenames, list)
|
|
511
507
|
self.assertEqual(len(hdf5_filenames), 0)
|
|
512
508
|
|
|
513
|
-
txt_filenames = z.
|
|
509
|
+
txt_filenames = [f.download() for f in z.files.values() if f.suffix == ".txt"]
|
|
514
510
|
self.assertIsInstance(txt_filenames, list)
|
|
515
511
|
self.assertEqual(len(txt_filenames), 1)
|
|
516
512
|
self.assertEqual(txt_filenames[0].suffix, '.txt')
|
|
517
513
|
|
|
518
|
-
hdf_and_txt_filenames = z.
|
|
514
|
+
hdf_and_txt_filenames = [f.download() for f in z.files.values() if f.suffix in (".txt", "*.hdf")]
|
|
519
515
|
self.assertIsInstance(hdf_and_txt_filenames, list)
|
|
520
516
|
self.assertEqual(len(hdf_and_txt_filenames), 1)
|
|
521
517
|
self.assertEqual(hdf_and_txt_filenames[0].suffix, '.txt')
|
|
@@ -569,9 +565,6 @@ class TestZenodo(unittest.TestCase):
|
|
|
569
565
|
embargo_date='2020'
|
|
570
566
|
)
|
|
571
567
|
|
|
572
|
-
with self.assertRaises(TypeError):
|
|
573
|
-
z.set_metadata(12)
|
|
574
|
-
|
|
575
568
|
z.set_metadata(meta.model_dump())
|
|
576
569
|
z.set_metadata(meta)
|
|
577
570
|
ret_metadata = z.get_metadata()
|
|
@@ -603,14 +596,14 @@ class TestZenodo(unittest.TestCase):
|
|
|
603
596
|
tmpfile.unlink()
|
|
604
597
|
self.assertFalse(tmpfile.exists())
|
|
605
598
|
|
|
606
|
-
filename = z.
|
|
599
|
+
filename = z.files["testfile.txt"].download()
|
|
607
600
|
self.assertIsInstance(filename, pathlib.Path)
|
|
608
601
|
self.assertTrue(filename.exists())
|
|
609
602
|
with open(filename, 'r') as f:
|
|
610
603
|
self.assertEqual(f.read(), 'This is a test file.')
|
|
611
604
|
filename.unlink()
|
|
612
605
|
|
|
613
|
-
filenames = z.
|
|
606
|
+
filenames = [f.download() for f in z.files.values()]
|
|
614
607
|
|
|
615
608
|
self.assertIsInstance(filenames, list)
|
|
616
609
|
self.assertIsInstance(filenames[0], pathlib.Path)
|
|
@@ -618,16 +611,16 @@ class TestZenodo(unittest.TestCase):
|
|
|
618
611
|
self.assertTrue(filename.exists())
|
|
619
612
|
filename.unlink()
|
|
620
613
|
|
|
621
|
-
hdf5_filenames = z.
|
|
614
|
+
hdf5_filenames = [f.download() for f in z.files.values() if f.suffix == '.hdf']
|
|
622
615
|
self.assertIsInstance(hdf5_filenames, list)
|
|
623
|
-
self.assertEqual(len(hdf5_filenames),
|
|
616
|
+
self.assertEqual(len(hdf5_filenames), 0)
|
|
624
617
|
|
|
625
|
-
txt_filenames = z.
|
|
618
|
+
txt_filenames = [f.download() for f in z.files.values() if f.suffix == '.txt']
|
|
626
619
|
self.assertIsInstance(txt_filenames, list)
|
|
627
620
|
self.assertEqual(len(txt_filenames), 1)
|
|
628
621
|
self.assertEqual(txt_filenames[0].suffix, '.txt')
|
|
629
622
|
|
|
630
|
-
hdf_and_txt_filenames = z.
|
|
623
|
+
hdf_and_txt_filenames = [f.download() for f in z.files.values() if f.suffix in ('.txt', '.hdf')]
|
|
631
624
|
self.assertIsInstance(hdf_and_txt_filenames, list)
|
|
632
625
|
self.assertEqual(len(hdf_and_txt_filenames), 1)
|
|
633
626
|
self.assertEqual(hdf_and_txt_filenames[0].suffix, '.txt')
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import pathlib
|
|
2
2
|
import unittest
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import yaml
|
|
4
5
|
|
|
5
6
|
from h5rdmtoolbox import __version__, get_package_meta
|
|
6
7
|
|
|
@@ -34,14 +35,13 @@ class TestVersion(unittest.TestCase):
|
|
|
34
35
|
found = False
|
|
35
36
|
for line in lines:
|
|
36
37
|
if 'pip install' in line:
|
|
37
|
-
self.
|
|
38
|
+
self.assertTrue(f'"# !pip install h5rdmtoolbox=={__version__}"' in line.strip())
|
|
38
39
|
found = True
|
|
39
40
|
break
|
|
40
41
|
self.assertTrue(found)
|
|
41
42
|
|
|
42
43
|
def test_citation_cff(self):
|
|
43
44
|
citation_cff = __this_dir__ / "../CITATION.cff"
|
|
44
|
-
import yaml
|
|
45
45
|
with open(citation_cff, 'r') as f:
|
|
46
46
|
cff = yaml.safe_load(f)
|
|
47
47
|
self.assertTrue("todo" not in cff["doi"].lower(), "Please replace 'todo' in CITATION.cff")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{h5rdmtoolbox-2.2.1 → h5rdmtoolbox-2.3.1}/h5rdmtoolbox/data/tutorial_standard_name_table.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|