diff --git a/cimgen/cimgen.py b/cimgen/cimgen.py index d12d5a54..13c5efe9 100644 --- a/cimgen/cimgen.py +++ b/cimgen/cimgen.py @@ -510,28 +510,43 @@ def _write_python_files(elem_dict, lang_pack, output_path, version): lang_pack.set_float_classes(float_classes) lang_pack.set_enum_classes(enum_classes) - lang_pack.set_primitive_classes(primitive_classes) - lang_pack.set_cim_data_type_classes(cim_data_type_classes) + if "modernpython" in lang_pack.__name__: + lang_pack.set_primitive_classes(primitive_classes) + lang_pack.set_cim_data_type_classes(cim_data_type_classes) recommended_class_profiles = _get_recommended_class_profiles(elem_dict) for class_name in elem_dict.keys(): - - class_details = { - "attributes": _find_multiple_attributes(elem_dict[class_name].attributes()), - "class_location": lang_pack.get_class_location(class_name, elem_dict, output_path), - "class_name": class_name, - "class_origin": elem_dict[class_name].origins(), - "instances": elem_dict[class_name].instances(), - "has_instances": elem_dict[class_name].has_instances(), - "is_a_float": elem_dict[class_name].is_a_float(), - "is_a_primitive": elem_dict[class_name].is_a_primitive(), - "is_a_cim_data_type": elem_dict[class_name].is_a_cim_datatype(), - "langPack": lang_pack, - "sub_class_of": elem_dict[class_name].superClass(), - "sub_classes": elem_dict[class_name].subClasses(), - "recommended_class_profile": recommended_class_profiles[class_name], - } + if "modernpython" in lang_pack.__name__: + class_details = { + "attributes": _find_multiple_attributes(elem_dict[class_name].attributes()), + "class_location": lang_pack.get_class_location(class_name, elem_dict, output_path), + "class_name": class_name, + "class_origin": elem_dict[class_name].origins(), + "instances": elem_dict[class_name].instances(), + "has_instances": elem_dict[class_name].has_instances(), + "is_a_float": elem_dict[class_name].is_a_float(), + "is_a_primitive": elem_dict[class_name].is_a_primitive(), + "is_a_cim_data_type": elem_dict[class_name].is_a_cim_datatype(), + "langPack": lang_pack, + "sub_class_of": elem_dict[class_name].superClass(), + "sub_classes": elem_dict[class_name].subClasses(), + "recommended_class_profile": recommended_class_profiles[class_name], + } + else: + class_details = { + "attributes": _find_multiple_attributes(elem_dict[class_name].attributes()), + "class_location": lang_pack.get_class_location(class_name, elem_dict, output_path), + "class_name": class_name, + "class_origin": elem_dict[class_name].origins(), + "instances": elem_dict[class_name].instances(), + "has_instances": elem_dict[class_name].has_instances(), + "is_a_float": elem_dict[class_name].is_a_float(), + "langPack": lang_pack, + "sub_class_of": elem_dict[class_name].superClass(), + "sub_classes": elem_dict[class_name].subClasses(), + "recommended_class_profile": recommended_class_profiles[class_name], + } # extract comments if elem_dict[class_name].comment: