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)
@@ -849,13 +848,9 @@ def add_variable_from_spec(
849848 rule : str, optional
850849 Variable rule (in verbatim).
851850 meta_data : dict, optional
852- A Python dictionary which holds the metadata specification
853- with the following keys:
854- - keys : list, default []
855- list of meta-data keys
856- - values : list, default []
857- list of meta-data values.
858- The values can be str, bool, float or int.
851+ A Python dictionary which holds the metadata specification.
852+ The dictionary keys are str.
853+ The values can be str, bool, float or int.
859854
860855 Raises
861856 ------
@@ -892,27 +887,6 @@ def add_variable_from_spec(
892887 if meta_data is not None :
893888 if not is_dict_like (meta_data ):
894889 raise TypeError (type_error_message ("meta_data" , meta_data , "dict-like" ))
895- if "keys" not in meta_data or "values" not in meta_data :
896- raise ValueError (
897- "'meta_data' does not contain "
898- "the mandatory keys 'keys' and 'values'"
899- )
900- if not is_list_like (meta_data ["keys" ]):
901- raise TypeError (
902- type_error_message (
903- "meta_data['keys']" , meta_data ["keys" ], "list-like"
904- )
905- )
906- if not is_list_like (meta_data ["values" ]):
907- raise TypeError (
908- type_error_message (
909- "meta_data['values']" , meta_data ["values" ], "list-like"
910- )
911- )
912- if len (meta_data ["keys" ]) != len (meta_data ["values" ]):
913- raise ValueError (
914- "'meta_data' keys and values " "do not have the same size"
915- )
916890 if label is not None :
917891 if not is_string_like (label ):
918892 raise TypeError (type_error_message ("label" , label , "string-like" ))
@@ -936,7 +910,7 @@ def add_variable_from_spec(
936910 variable .type = type
937911 variable .used = used
938912 if meta_data is not None :
939- for key , value in zip ( meta_data [ "keys" ], meta_data [ "values" ] ):
913+ for key , value in meta_data . items ( ):
940914 variable .meta_data .add_value (key , value )
941915 if label is not None :
942916 variable .label = label
0 commit comments