Skip to content

Commit bf7b9ff

Browse files
only include keys of the dictionary of accepted values in the error message
1 parent e76c8a1 commit bf7b9ff

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

mkl/_mkl_service.pyx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,14 @@ cdef int __python_obj_to_int(obj, func_name):
390390

391391
cdef void __check_positive_num_threads(int p, func_name):
392392
if p <= 0:
393-
warnings.warn("Non-positive argument of " + func_name + " is being ignored, number of threads will not be changed")
393+
warnings.warn("Non-positive argument of " + func_name +
394+
" is being ignored, number of threads will not be changed")
394395

395396

396397
cdef void __check_non_negative_num_threads(int p, func_name):
397398
if p < 0:
398-
warnings.warn("Non-positive argument of " + func_name + " is being ignored, number of threads will not be changed")
399+
warnings.warn("Non-positive argument of " + func_name +
400+
" is being ignored, number of threads will not be changed")
399401

400402

401403
cdef inline int __mkl_str_to_int(variable, possible_variables_dict):
@@ -404,7 +406,8 @@ cdef inline int __mkl_str_to_int(variable, possible_variables_dict):
404406
if possible_variables_dict is None:
405407
raise RuntimeError("Dictionary mapping possible variable value to internal code is missing")
406408
if variable not in possible_variables_dict:
407-
raise ValueError('Variable: <' + str(variable) + '> not in ' + str(possible_variables_dict))
409+
raise ValueError('Variable: <' + str(variable) + '> not in ' +
410+
str(possible_variables_dict.keys()))
408411

409412
return possible_variables_dict[variable]
410413

@@ -414,7 +417,8 @@ cdef __mkl_int_to_str(int mkl_int_variable, possible_variables_dict):
414417
raise RuntimeError("Dictionary mapping possible internal code to output string is missing")
415418

416419
if mkl_int_variable not in possible_variables_dict:
417-
raise ValueError('Variable: <' + str(mkl_int_variable) + '> not in ' + str(possible_variables_dict))
420+
raise ValueError('Variable: <' + str(mkl_int_variable) + '> not in ' +
421+
str(possible_variables_dict.keys()))
418422

419423
return possible_variables_dict[mkl_int_variable]
420424

0 commit comments

Comments
 (0)