@@ -142,7 +142,7 @@ def _is_object_type(type_str):
142142 return type_str in ["Entity" , "Table" ]
143143
144144
145- class DictionaryDomain ( KhiopsJSONObject ) :
145+ class DictionaryDomain :
146146 """Main class containing the information of a Khiops dictionary file
147147
148148 A DictionaryDomainain is a collection of `Dictionary` objects. These dictionaries
@@ -175,8 +175,12 @@ def __init__(self, json_data=None):
175175 if json_data is not None and not isinstance (json_data , dict ):
176176 raise TypeError (type_error_message ("json_data" , json_data , dict ))
177177
178- # Initialize base attributes
179- super ().__init__ (json_data = json_data )
178+ # Create KhiopsJSONObject and use it via composition
179+ self ._json_object = KhiopsJSONObject (json_data )
180+
181+ # Propagate the relevant attributes from the KhiopsJSONObject instance
182+ self .tool = self ._json_object .tool
183+ self .version = self ._json_object .version
180184
181185 # Transform to an empty dictionary if json_data is not specified
182186 if json_data is None :
@@ -220,9 +224,7 @@ def copy(self):
220224 dictionary_domain_copy = DictionaryDomain ()
221225 dictionary_domain_copy .tool = self .tool
222226 dictionary_domain_copy .version = self .version
223- dictionary_domain_copy .khiops_encoding = self .khiops_encoding
224- dictionary_domain_copy .ansi_chars = self .ansi_chars
225- dictionary_domain_copy .colliding_utf8_chars = self .colliding_utf8_chars
227+ dictionary_domain_copy ._json_object = self ._json_object
226228 for dictionary in self .dictionaries :
227229 dictionary_domain_copy .add_dictionary (dictionary .copy ())
228230 return dictionary_domain_copy
@@ -489,7 +491,9 @@ def export_khiops_dictionary_file(self, kdic_file_path):
489491 Path of the output dictionary file (``.kdic``).
490492 """
491493 with io .BytesIO () as kdic_contents_stream :
492- kdic_file_writer = self .create_output_file_writer (kdic_contents_stream )
494+ kdic_file_writer = self ._json_object .create_output_file_writer (
495+ kdic_contents_stream
496+ )
493497 self .write (kdic_file_writer )
494498 fs .write (kdic_file_path , kdic_contents_stream .getvalue ())
495499
@@ -502,7 +506,7 @@ def write(self, stream_or_writer):
502506 Output stream or writer.
503507 """
504508 if isinstance (stream_or_writer , io .IOBase ):
505- writer = self .create_output_file_writer (stream_or_writer )
509+ writer = self ._json_object . create_output_file_writer (stream_or_writer )
506510 elif isinstance (stream_or_writer , KhiopsOutputWriter ):
507511 writer = stream_or_writer
508512 else :
0 commit comments