2727 correct_dor ,
2828)
2929from src .energyml .utils .xml import *
30+ from utils .data .datasets_io import HDF5FileReader
3031
3132fi_cit = Citation (
3233 title = "An interpretation" ,
@@ -130,11 +131,7 @@ def file_test():
130131 print (find_schema_version_in_element (get_tree (xml_content )))
131132 print (get_class_name_from_xml (get_tree (xml_content )))
132133
133- print (
134- get_class_from_name (
135- "energyml.resqml.v2_2.resqmlv2.TriangulatedSetRepresentation"
136- )
137- )
134+ print (get_class_from_name ("energyml.resqml.v2_2.resqmlv2.TriangulatedSetRepresentation" ))
138135
139136 print (read_energyml_xml_str (xml_content ))
140137 print (read_energyml_xml_file (path ))
@@ -143,53 +140,27 @@ def file_test():
143140def tests_content_type ():
144141 print (RGX_CONTENT_TYPE )
145142
146- print (
147- parse_content_type (
148- "application/x-resqml+xml;version=2.2;type=TriangulatedSetRepresentation"
149- )
150- )
151- print (
152- parse_content_type (
153- "application/vnd.openxmlformats-package.core-properties+xml"
154- ).group ("domain" )
155- )
143+ print (parse_content_type ("application/x-resqml+xml;version=2.2;type=TriangulatedSetRepresentation" ))
144+ print (parse_content_type ("application/vnd.openxmlformats-package.core-properties+xml" ).group ("domain" ))
156145
157- print (
158- get_class_from_content_type (
159- "application/x-resqml+xml;version=2.2;type=TriangulatedSetRepresentation"
160- )
161- )
146+ print (get_class_from_content_type ("application/x-resqml+xml;version=2.2;type=TriangulatedSetRepresentation" ))
162147 print (
163148 "CT 201 : " ,
164- get_class_from_content_type (
165- "application/x-resqml+xml;version=2.0;type=obj_HorizonInterpretation"
166- ),
167- )
168- print (
169- parse_content_type (
170- "application/x-resqml+xml;version=2.0;type=obj_HorizonInterpretation"
171- )
149+ get_class_from_content_type ("application/x-resqml+xml;version=2.0;type=obj_HorizonInterpretation" ),
172150 )
151+ print (parse_content_type ("application/x-resqml+xml;version=2.0;type=obj_HorizonInterpretation" ))
173152
174- print (
175- get_class_from_content_type (
176- "application/vnd.openxmlformats-package.core-properties+xml"
177- )
178- )
153+ print (get_class_from_content_type ("application/vnd.openxmlformats-package.core-properties+xml" ))
179154
180155 print (get_content_type_from_class (tr ))
181156 print (get_qualified_type_from_class (tr ))
182157 print (
183158 get_qualified_type_from_class (DoubleHdf5Array ()),
184- get_class_from_qualified_type (
185- get_qualified_type_from_class (DoubleHdf5Array ())
186- ),
159+ get_class_from_qualified_type (get_qualified_type_from_class (DoubleHdf5Array ())),
187160 )
188161 print (
189162 get_qualified_type_from_class (dor_correct ),
190- get_class_from_qualified_type (
191- get_qualified_type_from_class (dor_correct )
192- ),
163+ get_class_from_qualified_type (get_qualified_type_from_class (dor_correct )),
193164 )
194165
195166 print (gen_energyml_object_path (tr , EpcExportVersion .EXPANDED ))
@@ -204,17 +175,11 @@ def tests_epc():
204175 print (epc )
205176 epc .export_file ("D:/Geosiris/Github/energyml/energyml-python/test.epc" )
206177 epc .export_version = EpcExportVersion .EXPANDED
207- epc .export_file (
208- "D:/Geosiris/Github/energyml/energyml-python/test_EXPANDED.epc"
209- )
178+ epc .export_file ("D:/Geosiris/Github/energyml/energyml-python/test_EXPANDED.epc" )
210179 epc .core_props = None
211- epc .export_file (
212- "D:/Geosiris/Github/energyml/energyml-python/test_no_core.epc"
213- )
180+ epc .export_file ("D:/Geosiris/Github/energyml/energyml-python/test_no_core.epc" )
214181
215- epc201 = Epc .read_file (
216- "D:/Geosiris/OSDU/manifestTranslation/#Data/VOLVE_STRUCT.epc"
217- )
182+ epc201 = Epc .read_file ("D:/Geosiris/OSDU/manifestTranslation/#Data/VOLVE_STRUCT.epc" )
218183 print (epc201 )
219184
220185 print (f"NB errors { len (validate_epc (epc201 ))} " )
@@ -239,10 +204,7 @@ def tests_dor():
239204
240205 print (
241206 json .dumps (
242- {
243- k : [get_obj_uuid (x ) for x in v ]
244- for k , v in get_reverse_dor_list (epc .energyml_objects ).items ()
245- },
207+ {k : [get_obj_uuid (x ) for x in v ] for k , v in get_reverse_dor_list (epc .energyml_objects ).items ()},
246208 indent = 4 ,
247209 )
248210 )
@@ -301,16 +263,8 @@ def test_introspection():
301263 print (search_attribute_matching_type (tr , "Citation" ))
302264 print (search_attribute_matching_type (tr , "DataObjectreference" ))
303265 print (search_attribute_matching_type_with_path (tr , "DataObjectreference" ))
304- print (
305- class_match_rgx (
306- ContactElement , "DataObjectreference" , super_class_search = False
307- )
308- )
309- print (
310- class_match_rgx (
311- ContactElement , "DataObjectreference" , super_class_search = True
312- )
313- )
266+ print (class_match_rgx (ContactElement , "DataObjectreference" , super_class_search = False ))
267+ print (class_match_rgx (ContactElement , "DataObjectreference" , super_class_search = True ))
314268 print (Enum in ExistenceKind .__bases__ )
315269 print (Enum in TriangulatedSetRepresentation .__bases__ )
316270 print (is_primitive (int ))
@@ -331,9 +285,7 @@ def test_introspection():
331285 print (TriangulatedSetRepresentation .__dataclass_params__ )
332286
333287 # print(random_value_from_class(int))
334- print (
335- serialize_xml (random_value_from_class (TriangulatedSetRepresentation ))
336- )
288+ print (serialize_xml (random_value_from_class (TriangulatedSetRepresentation )))
337289 # print(serialize_json(random_value_from_class(TriangulatedSetRepresentation)))
338290
339291 print (search_attribute_matching_name_with_path (tr , "[tT]it.*" ))
@@ -342,13 +294,7 @@ def test_introspection():
342294 print (AbstractPoint3DArray .__dict__ )
343295 print (TriangulatedSetRepresentation .__dict__ )
344296 print (get_sub_classes (AbstractObject ))
345- print (
346- list (
347- filter (
348- lambda _c : not is_abstract (_c ), get_sub_classes (AbstractObject )
349- )
350- )
351- )
297+ print (list (filter (lambda _c : not is_abstract (_c ), get_sub_classes (AbstractObject ))))
352298 print (AbstractColorMap .__name__ .startswith ("Abstract" ))
353299 print (is_abstract (AbstractColorMap ))
354300
@@ -366,17 +312,13 @@ def test_introspection():
366312
367313 print (f"object: { is_abstract (object )} " )
368314 print (f"HDF5FileReader: { is_abstract (HDF5FileReader )} " )
369- print (
370- f"TriangulatedSetRepresentation: { is_abstract (TriangulatedSetRepresentation )} "
371- )
315+ print (f"TriangulatedSetRepresentation: { is_abstract (TriangulatedSetRepresentation )} " )
372316
373317 # print("HDF5FileReader")
374318 # for func in dir(HDF5FileReader):
375319 # if callable(getattr(HDF5FileReader, func)) and not func.startswith("__"):
376320 # print(f"\t{func} {type(getattr(HDF5FileReader, func))}")
377- print (
378- get_classes_matching_name (TriangulatedSetRepresentation , "Abstract.*" )
379- )
321+ print (get_classes_matching_name (TriangulatedSetRepresentation , "Abstract.*" ))
380322 # print(get_matching_class_attribute_name(ExternalDataArrayPart, "(PathInHdfFile|PathInExternalFile)"))
381323 # print(object.__module__)
382324 # print(serialize_xml(random_value_from_class(PointSetRepresentation)))
@@ -390,21 +332,15 @@ def test_introspection():
390332 # print(serialize_xml(poly))
391333
392334 print ("=====] " , r"ClosedPolylines.\d+" )
393- for array_path , array_value in search_attribute_matching_name_with_path (
394- poly , r"ClosedPolylines.\d+"
395- ):
335+ for array_path , array_value in search_attribute_matching_name_with_path (poly , r"ClosedPolylines.\d+" ):
396336 print (f"{ array_path } \n \t { array_value } " )
397337
398338 print ("=====] " , r"ClosedPolylines.values.\d+" )
399- for array_path , array_value in search_attribute_matching_name_with_path (
400- poly , r"ClosedPolylines.values.\d+"
401- ):
339+ for array_path , array_value in search_attribute_matching_name_with_path (poly , r"ClosedPolylines.values.\d+" ):
402340 print (f"{ array_path } \n \t { array_value } " )
403341
404342 print ("=====] " , r"LinePatch.\d+" )
405- for array_path , array_value in search_attribute_matching_name_with_path (
406- poly , r"LinePatch.\d+"
407- ):
343+ for array_path , array_value in search_attribute_matching_name_with_path (poly , r"LinePatch.\d+" ):
408344 print (f"{ array_path } \n \t { array_value } " )
409345
410346
@@ -424,17 +360,15 @@ def tests_hdf():
424360
425361 for o in tr_list :
426362 print (o .__class__ )
427- print (get_hdf_reference_with_path (o ))
363+ print (get_path_in_external_with_path (o ))
428364 exit (0 )
429365
430366
431367def test_local_depth_crs ():
432368 # Fails because the xsi:type="VerticalCrsEpsgCode" doesn't
433369 # contain the namespace : xsi:type="eml:VerticalCrsEpsgCode"
434370 try :
435- depth3d = read_energyml_xml_file (
436- "../rc/obj_LocalDepth3dCrs_716f6472-18a3-4f19-a57c-d4f5642ccc53.xml"
437- )
371+ depth3d = read_energyml_xml_file ("../rc/obj_LocalDepth3dCrs_716f6472-18a3-4f19-a57c-d4f5642ccc53.xml" )
438372 print (serialize_json (depth3d , JSON_VERSION .XSDATA ))
439373 print (serialize_xml (depth3d ))
440374 except Exception as e :
@@ -445,9 +379,7 @@ def test_get_projected_uom():
445379 # Fails because the xsi:type="VerticalCrsEpsgCode" doesn't
446380 # contain the namespace : xsi:type="eml:VerticalCrsEpsgCode"
447381 try :
448- depth3d = read_energyml_xml_file (
449- "../rc/obj_LocalDepth3dCrs_716f6472-18a3-4f19-a57c-d4f5642ccc53.xml"
450- )
382+ depth3d = read_energyml_xml_file ("../rc/obj_LocalDepth3dCrs_716f6472-18a3-4f19-a57c-d4f5642ccc53.xml" )
451383 print (get_projected_uom (depth3d ).value )
452384 except Exception as e :
453385 print (e )
@@ -502,28 +434,18 @@ def class_field():
502434 print (get_class_fields (tr )["citation" ])
503435 print (get_class_pkg_version (tr ))
504436 print (create_energyml_object ("resqml22.TriangulatedSetRepresentation" ))
505- ext_20 = create_energyml_object (
506- "application/x-eml+xml;version=2.0;type=obj_EpcExternalPartReference"
507- )
437+ ext_20 = create_energyml_object ("application/x-eml+xml;version=2.0;type=obj_EpcExternalPartReference" )
508438 print (ext_20 )
509439 print (gen_energyml_object_path (ext_20 ))
510440 print (create_external_part_reference ("2.0" , "my_h5" ))
511441
512- print (
513- parse_content_or_qualified_type (
514- "application/x-eml+xml;version=2.0;type=obj_EpcExternalPartReference"
515- )
516- )
442+ print (parse_content_or_qualified_type ("application/x-eml+xml;version=2.0;type=obj_EpcExternalPartReference" ))
517443 print (
518444 get_domain_version_from_content_or_qualified_type (
519445 "application/x-eml+xml;version=2.0;type=obj_EpcExternalPartReference"
520446 )
521447 )
522- print (
523- get_domain_version_from_content_or_qualified_type (
524- "resqml20.obj_EpcExternalPartReference"
525- )
526- )
448+ print (get_domain_version_from_content_or_qualified_type ("resqml20.obj_EpcExternalPartReference" ))
527449
528450 # print(create_external_part_reference("2.2", "myfile.h5"))
529451 # print(create_external_part_reference("2.0", "myfile.h5"))
0 commit comments