2424from khiops .core .internals .common import (
2525 deprecation_message ,
2626 is_dict_like ,
27- is_list_like ,
2827 is_string_like ,
2928 type_error_message ,
3029)
@@ -861,13 +860,8 @@ def add_variable_from_spec(
861860 rule : str, optional
862861 Variable rule (in verbatim).
863862 meta_data : dict, optional
864- A Python dictionary which holds the metadata specification
865- with the following keys:
866- - keys : list, default []
867- list of meta-data keys
868- - values : list, default []
869- list of meta-data values.
870- The values can be str, bool, float or int.
863+ A Python dictionary which holds the metadata specification.
864+ The dictionary keys are str. The values can be str, bool, float or int.
871865
872866 Raises
873867 ------
@@ -899,27 +893,6 @@ def add_variable_from_spec(
899893 if meta_data is not None :
900894 if not is_dict_like (meta_data ):
901895 raise TypeError (type_error_message ("meta_data" , meta_data , "dict-like" ))
902- if "keys" not in meta_data or "values" not in meta_data :
903- raise ValueError (
904- "'meta_data' does not contain "
905- "the mandatory keys 'keys' and 'values'"
906- )
907- if not is_list_like (meta_data ["keys" ]):
908- raise TypeError (
909- type_error_message (
910- "meta_data['keys']" , meta_data ["keys" ], "list-like"
911- )
912- )
913- if not is_list_like (meta_data ["values" ]):
914- raise TypeError (
915- type_error_message (
916- "meta_data['values']" , meta_data ["values" ], "list-like"
917- )
918- )
919- if len (meta_data ["keys" ]) != len (meta_data ["values" ]):
920- raise ValueError (
921- "'meta_data' keys and values " "do not have the same size"
922- )
923896 if label is not None :
924897 if not is_string_like (label ):
925898 raise TypeError (type_error_message ("label" , label , "string-like" ))
@@ -943,7 +916,7 @@ def add_variable_from_spec(
943916 variable .type = type
944917 variable .used = used
945918 if meta_data is not None :
946- for key , value in zip ( meta_data [ "keys" ], meta_data [ "values" ] ):
919+ for key , value in meta_data . items ( ):
947920 variable .meta_data .add_value (key , value )
948921 if label is not None :
949922 variable .label = label
0 commit comments