from mindspore._checkparam import Validator def foo(n): n = Validator.check_non_negative_int(n, 'n') ...
from mindspore._checkparam import Validator def bar(lst): lst = Validator.check_type('lst', lst, list) lst = [Validator.check_value_type('lst[{}]'.format(i), x, int) for i, x in enumerate(lst)] ...These examples demonstrate how the Validator functions can be used to validate function arguments and inputs in MindSpore. The package library is MindSpore.