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)
@@ -848,13 +847,9 @@ def add_variable_from_spec(
848847 rule : str, optional
849848 Variable rule (in verbatim).
850849 meta_data : dict, optional
851- A Python dictionary which holds the metadata specification
852- with the following keys:
853- - keys : list, default []
854- list of meta-data keys
855- - values : list, default []
856- list of meta-data values.
857- The values can be str, bool, float or int.
850+ A Python dictionary which holds the metadata specification.
851+ The dictionary keys are str.
852+ The values can be str, bool, float or int.
858853
859854 Raises
860855 ------
@@ -886,27 +881,6 @@ def add_variable_from_spec(
886881 if meta_data is not None :
887882 if not is_dict_like (meta_data ):
888883 raise TypeError (type_error_message ("meta_data" , meta_data , "dict-like" ))
889- if "keys" not in meta_data or "values" not in meta_data :
890- raise ValueError (
891- "'meta_data' does not contain "
892- "the mandatory keys 'keys' and 'values'"
893- )
894- if not is_list_like (meta_data ["keys" ]):
895- raise TypeError (
896- type_error_message (
897- "meta_data['keys']" , meta_data ["keys" ], "list-like"
898- )
899- )
900- if not is_list_like (meta_data ["values" ]):
901- raise TypeError (
902- type_error_message (
903- "meta_data['values']" , meta_data ["values" ], "list-like"
904- )
905- )
906- if len (meta_data ["keys" ]) != len (meta_data ["values" ]):
907- raise ValueError (
908- "'meta_data' keys and values " "do not have the same size"
909- )
910884 if label is not None :
911885 if not is_string_like (label ):
912886 raise TypeError (type_error_message ("label" , label , "string-like" ))
@@ -930,7 +904,7 @@ def add_variable_from_spec(
930904 variable .type = type
931905 variable .used = used
932906 if meta_data is not None :
933- for key , value in zip ( meta_data [ "keys" ], meta_data [ "values" ] ):
907+ for key , value in meta_data . items ( ):
934908 variable .meta_data .add_value (key , value )
935909 if label is not None :
936910 variable .label = label
0 commit comments