Skip to content

Commit 46d74e5

Browse files
downgradin h5py version
1 parent 096c613 commit 46d74e5

3 files changed

Lines changed: 35 additions & 2 deletions

File tree

energyml-utils/example/attic/perf_tests.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
# Benchmark de performance pour get_obj_uuid
22
import time
33
import re
4-
from types import SimpleNamespace
54

65
UUID_RGX: re.Pattern = re.compile(r"[Uu]u?id|UUID")
76

87

8+
# Version dot
9+
def get_obj_uuid_pointe(obj):
10+
try:
11+
return obj.uuid
12+
except AttributeError:
13+
try:
14+
return obj.uid
15+
except AttributeError:
16+
if isinstance(obj, dict):
17+
for k in obj.keys():
18+
if UUID_RGX.match(k):
19+
return obj[k]
20+
return None
21+
22+
923
# Version originale
1024
def get_obj_uuid_original(obj):
1125
try:
@@ -54,5 +68,12 @@ def __init__(self, uuid):
5468
assert get_obj_uuid_fast(obj) == obj.uuid
5569
elapsed_fast = time.perf_counter() - start
5670

71+
# Test version pointe
72+
start = time.perf_counter()
73+
for obj in objs:
74+
assert get_obj_uuid_pointe(obj) == obj.uuid
75+
elapsed_point = time.perf_counter() - start
76+
5777
print(f"Original version: {elapsed_original:.6f} s for {N} calls")
5878
print(f"Optimized version: {elapsed_fast:.6f} s for {N} calls")
79+
print(f"Point version: {elapsed_point:.6f} s for {N} calls")

energyml-utils/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ segy = ["segyio"]
6767
python = "^3.9"
6868
xsdata = {version = "^24.0", extras = ["cli", "lxml"]}
6969
energyml-opc = "^1.12.0"
70-
h5py = { version = "^3.7.0", optional = false }
70+
h5py = { version = "^3.11.0", optional = false }
7171
numpy = { version = "^1.16.6", optional = false }
7272
pyarrow = { version = "^14.0.1", optional = true }
7373
pandas = { version = "^1.1.0", optional = true }

energyml-utils/src/energyml/utils/data/datasets_io.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,9 @@ def list_arrays(self, source: Union[BytesIO, str, Any]) -> List[str]:
10241024
def can_handle_file(self, file_path: str) -> bool:
10251025
return os.path.splitext(file_path)[1].lower() in [".h5", ".hdf5"] # dat for Galaxy compatibility
10261026

1027+
# Alias so the public name is always importable
1028+
HDF5ArrayHandler = MockHDF5ArrayHandler
1029+
10271030

10281031
# Parquet Handler
10291032
if __PARQUET_MODULE_EXISTS__:
@@ -1214,6 +1217,9 @@ def list_arrays(self, source: Union[BytesIO, str, Any]) -> List[str]:
12141217
def can_handle_file(self, file_path: str) -> bool:
12151218
return os.path.splitext(file_path)[1].lower() in [".parquet", ".pq"]
12161219

1220+
# Alias so the public name is always importable
1221+
ParquetArrayHandler = MockParquetArrayHandler
1222+
12171223

12181224
# CSV Handler
12191225
if __CSV_MODULE_EXISTS__:
@@ -1563,6 +1569,9 @@ def can_handle_file(self, file_path: str) -> bool:
15631569
ext = os.path.splitext(file_path)[1].lower()
15641570
return ext == ".las"
15651571

1572+
# Alias so the public name is always importable
1573+
LASArrayHandler = MockLASArrayHandler
1574+
15661575

15671576
# SEG-Y Handler
15681577
if __SEGYIO_MODULE_EXISTS__:
@@ -1792,3 +1801,6 @@ def can_handle_file(self, file_path: str) -> bool:
17921801
"""Check if this handler can process the file."""
17931802
ext = os.path.splitext(file_path)[1].lower()
17941803
return ext in [".sgy", ".segy"]
1804+
1805+
# Alias so the public name is always importable
1806+
SEGYArrayHandler = MockSEGYArrayHandler

0 commit comments

Comments
 (0)