PyONDE 0.1.6__tar.gz → 0.1.7__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.
- {pyonde-0.1.6 → pyonde-0.1.7}/PKG-INFO +1 -1
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE/_version.py +3 -3
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE/onde.py +47 -16
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE.egg-info/PKG-INFO +1 -1
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE.egg-info/scm_version.json +2 -2
- {pyonde-0.1.6 → pyonde-0.1.7}/demos/build_onde_file.py +1 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/demos/load_onde_file.py +1 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/.github/workflows/doc.yml +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/.github/workflows/push-to-pypi.yml +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/.gitignore +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/.vscode/settings.json +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/LICENSE.txt +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE/__init__.py +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE/bin/__init__.py +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE/onde_versions/ONDE_fields_v0.9.1pre.csv +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE/onde_versions/ONDE_fields_v0.9.2.csv +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE/onde_versions/ONDE_fields_v0.9.2pre.csv +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE.egg-info/SOURCES.txt +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE.egg-info/dependency_links.txt +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE.egg-info/not-zip-safe +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE.egg-info/scm_file_list.json +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/PyONDE.egg-info/top_level.txt +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/README.md +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/demos/build_onde_graph.py +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/demos/build_simple_graph.py +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/demos/graph_modification.py +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/doc/LowLevel_Class_Structure.md +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/doc/Makefile +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/doc/source/PyONDE.rst +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/doc/source/about.rst +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/doc/source/architecture.rst +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/doc/source/conf.py +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/doc/source/index.rst +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/doc/source/installation.rst +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/doc/source/modules.rst +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/doc/source/quickstart.rst +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/pyproject.toml +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/setup.cfg +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/setup.py +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/tests/try_array.py +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/tests/try_csv_read.py +0 -0
- {pyonde-0.1.6 → pyonde-0.1.7}/tests/try_dictionary.py +0 -0
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.1.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 1,
|
|
21
|
+
__version__ = version = '0.1.7'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 1, 7)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'gee5e6b5e8'
|
|
@@ -3731,30 +3731,44 @@ class ONDEFile(object):
|
|
|
3731
3731
|
hierarchical = None
|
|
3732
3732
|
file_is_blank = None
|
|
3733
3733
|
|
|
3734
|
-
def __init__(self, class_defs = None, h5path = None, mode = None, fh = None,version = None, filetype = None, hierarchical = False):
|
|
3734
|
+
def __init__(self, class_defs = None, h5path = None, mode = None, fh = None,version = None, filetype = None, file_is_blank = False, hierarchical = False):
|
|
3735
3735
|
self.class_defs = class_defs
|
|
3736
3736
|
self.h5path = h5path
|
|
3737
3737
|
self.mode = mode
|
|
3738
3738
|
self.fh = fh
|
|
3739
3739
|
self.version = version
|
|
3740
|
-
self.filetype = filetype
|
|
3741
3740
|
self.hierarchical = hierarchical
|
|
3742
|
-
self.file_is_blank =
|
|
3741
|
+
self.file_is_blank = file_is_blank
|
|
3743
3742
|
self.file_object_dict = {}
|
|
3744
3743
|
self.graph = ONDEFileGraph(class_defs = self.class_defs)
|
|
3745
3744
|
|
|
3746
3745
|
if self.mode not in {"r","r+","w","w-","x","a"}:
|
|
3747
3746
|
raise ValueError(f"Unknown mode: {self.mode:s}")
|
|
3748
3747
|
|
|
3749
|
-
if self.mode == "r+" or self.mode == "
|
|
3750
|
-
self.file_is_blank
|
|
3748
|
+
if self.mode == "r+" or self.mode == "r":
|
|
3749
|
+
assert(not self.file_is_blank)
|
|
3750
|
+
pass
|
|
3751
|
+
if file_is_blank:
|
|
3752
|
+
if filetype is None:
|
|
3753
|
+
raise ValueError("No filetype given when creating a new file")
|
|
3754
|
+
self.filetype = set(filetype)
|
|
3755
|
+
pass
|
|
3756
|
+
else:
|
|
3757
|
+
# file is not blank
|
|
3758
|
+
|
|
3751
3759
|
if version is not None:
|
|
3752
3760
|
raise ValueError("Attempting to set ONDE:VERSION on existing file.")
|
|
3753
|
-
|
|
3754
|
-
raise ValueError("Attempting to set ONDE:FILETYPE on existing file.")
|
|
3761
|
+
self.filetype = set()
|
|
3755
3762
|
self.load() # Attempt to read in current contents.
|
|
3763
|
+
|
|
3764
|
+
if filetype is not None:
|
|
3765
|
+
# Check that all the tags we are given are in the filetype
|
|
3766
|
+
for tag in set(filetype):
|
|
3767
|
+
if tag not in self.filetype:
|
|
3768
|
+
raise ValueError(f"Expected filetype tag {tag:s} not found when opening existing ONDE file \"{h5path:s}\"")
|
|
3769
|
+
pass
|
|
3770
|
+
pass
|
|
3756
3771
|
pass
|
|
3757
|
-
|
|
3758
3772
|
pass
|
|
3759
3773
|
|
|
3760
3774
|
def __getitem__(self,index):
|
|
@@ -3835,12 +3849,9 @@ class ONDEFile(object):
|
|
|
3835
3849
|
pass
|
|
3836
3850
|
|
|
3837
3851
|
if "ONDE:FILETYPE" not in self.fh.attrs:
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
else:
|
|
3842
|
-
self.fh.attrs["ONDE:FILETYPE"] = ["ONDE_DATASET"]
|
|
3843
|
-
pass
|
|
3852
|
+
assert(self.filetype is not None)
|
|
3853
|
+
self.fh.attrs["ONDE:FILETYPE"] = list(self.filetype)
|
|
3854
|
+
# self.fh.attrs["ONDE:FILETYPE"] = ["ONDE_DATASET","ONDE_UT"]
|
|
3844
3855
|
pass
|
|
3845
3856
|
|
|
3846
3857
|
# Make sure PyONDE_DB HDF5 group exists.
|
|
@@ -3964,7 +3975,27 @@ class ONDEFile(object):
|
|
|
3964
3975
|
return self._repr(0)
|
|
3965
3976
|
|
|
3966
3977
|
@classmethod
|
|
3967
|
-
def new(cls, h5path, mode, class_defs_path=None, extra_class_defs = None, onde_version = None, hierarchical = False):
|
|
3978
|
+
def new(cls, h5path, mode, filetype=None, class_defs_path=None, extra_class_defs = None, onde_version = None, hierarchical = False):
|
|
3979
|
+
"""Create a new ONDE file or open an existing one.
|
|
3980
|
+
Parameters:
|
|
3981
|
+
h5path: file system path to the file to open or create
|
|
3982
|
+
mode: h5py open mode ("r", "r+", "w", "w-", "x", or "a") as defined for opening h5py file objects
|
|
3983
|
+
filetype: mandatory for modes w, w-, x, and a. The set of tags for the ONDE_FILETYPE. For reading an existing file, all modes must be present or an exception will be thrown. For creating a new file, these tags will be assigned into the ONDE_FILETYPE field.
|
|
3984
|
+
class_defs_path: If given, load ONDE class definitions from a csv at the given path. The file name should end with ".csv".
|
|
3985
|
+
extra_class_defs: Place holder for a future way to add additional class definitions to those being loaded.
|
|
3986
|
+
onde_version: If class_defs_path is not given then onde_version can be a version string such as "0.9.2" to load in a set of class definitions that is embedded in the PyONDE library. These class definitions should match the code you are using to read and write the ONDE file; they do not need to match the version in the file itself.
|
|
3987
|
+
"""
|
|
3988
|
+
if os.path.exists(h5path):
|
|
3989
|
+
if mode in {"w"}:
|
|
3990
|
+
file_is_blank = True
|
|
3991
|
+
pass
|
|
3992
|
+
else:
|
|
3993
|
+
file_is_blank = False
|
|
3994
|
+
pass
|
|
3995
|
+
pass
|
|
3996
|
+
else:
|
|
3997
|
+
file_is_blank = True
|
|
3998
|
+
pass
|
|
3968
3999
|
fh = h5py.File(h5path, mode)
|
|
3969
4000
|
|
|
3970
4001
|
class_defs = None
|
|
@@ -3975,7 +4006,7 @@ class ONDEFile(object):
|
|
|
3975
4006
|
class_defs = ONDEClassDefinitions.load_from_csv(class_defs_path,extra_class_defs = extra_class_defs)
|
|
3976
4007
|
pass
|
|
3977
4008
|
|
|
3978
|
-
return cls(class_defs = class_defs, h5path = h5path, mode = mode, fh = fh, hierarchical = hierarchical)
|
|
4009
|
+
return cls(class_defs = class_defs, h5path = h5path, mode = mode, fh = fh, filetype = filetype, file_is_blank = file_is_blank, hierarchical = hierarchical)
|
|
3979
4010
|
|
|
3980
4011
|
pass
|
|
3981
4012
|
|
|
@@ -13,5 +13,6 @@ from PyONDE import ONDEDatasetFile
|
|
|
13
13
|
output_path = os.path.join(tempfile.gettempdir(), "pyonde_build_onde_file_output.onde")
|
|
14
14
|
|
|
15
15
|
of = ONDEDatasetFile.new(output_path, "r",
|
|
16
|
+
filetype = {"ONDE_DATASET", "ONDE_UT"},
|
|
16
17
|
#class_defs_path = class_def_csv_path,
|
|
17
18
|
onde_version = "0.9.2")
|
|
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
|