Skip to content

Commit 3687dbd

Browse files
reading title and other meta with stream as it seems not to be so long
1 parent ed8a0e3 commit 3687dbd

2 files changed

Lines changed: 70 additions & 278 deletions

File tree

energyml-utils/example/attic/test_list_object.py

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,44 @@ def list_epc_classical(epc_file):
77
epc = EpcStreamReader(epc_file, rels_update_mode=RelsUpdateMode.MANUAL)
88

99
time_start = datetime.now()
10-
for obj in epc.list_objects():
11-
print(f"Object: {obj}")
12-
print(len(epc.list_objects()))
13-
time_end = datetime.now()
14-
print(f"Time taken: {time_end - time_start}")
15-
10+
# for obj in epc.list_objects():
11+
# print(f"Object: {obj}")
12+
print(len(epc.list_objects(object_type="eml23.DataobjectCollection")))
1613

17-
def list_epc_fast(epc_file):
18-
"""List contents of an EPC file using fast method."""
19-
epc = EpcStreamReader(
20-
epc_file,
21-
rels_update_mode=RelsUpdateMode.MANUAL,
22-
)
23-
24-
time_start = datetime.now()
25-
# for obj in epc.list_objects_parallel():
26-
# print(f"Object: {obj}")
27-
print(len(epc.list_objects_parallel()))
14+
for obj in epc.list_objects(object_type="eml23.DataobjectCollection"):
15+
print(f"DataobjectCollection: {obj}")
2816
time_end = datetime.now()
2917
print(f"Time taken: {time_end - time_start}")
3018

3119

32-
def list_epc_seq(epc_file):
33-
"""List contents of an EPC file using sequential method."""
34-
epc = EpcStreamReader(
35-
epc_file,
36-
rels_update_mode=RelsUpdateMode.MANUAL,
37-
)
38-
39-
time_start = datetime.now()
40-
# for obj in epc.list_objects_seq():
41-
# print(f"Object: {obj}")
42-
print(len(epc.list_objects_seq()))
43-
time_end = datetime.now()
44-
print(f"Time taken: {time_end - time_start}")
20+
# def list_epc_fast(epc_file):
21+
# """List contents of an EPC file using fast method."""
22+
# epc = EpcStreamReader(
23+
# epc_file,
24+
# rels_update_mode=RelsUpdateMode.MANUAL,
25+
# )
26+
27+
# time_start = datetime.now()
28+
# # for obj in epc.list_objects_parallel():
29+
# # print(f"Object: {obj}")
30+
# print(len(epc.list_objects_parallel()))
31+
# time_end = datetime.now()
32+
# print(f"Time taken: {time_end - time_start}")
33+
34+
35+
# def list_epc_seq(epc_file):
36+
# """List contents of an EPC file using sequential method."""
37+
# epc = EpcStreamReader(
38+
# epc_file,
39+
# rels_update_mode=RelsUpdateMode.MANUAL,
40+
# )
41+
42+
# time_start = datetime.now()
43+
# # for obj in epc.list_objects_seq():
44+
# # print(f"Object: {obj}")
45+
# print(len(epc.list_objects_seq()))
46+
# time_end = datetime.now()
47+
# print(f"Time taken: {time_end - time_start}")
4548

4649

4750
if __name__ == "__main__":

0 commit comments

Comments
 (0)