From 493405023ad66d9fdb989bdc3329d9771d400b9a Mon Sep 17 00:00:00 2001 From: liutongtong Date: Sat, 18 Sep 2021 17:36:16 +0800 Subject: [PATCH] codecheck clean --- mindspore/_checkparam.py | 11 ++++++++--- mindspore/context.py | 1 + mindspore/log.py | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/mindspore/_checkparam.py b/mindspore/_checkparam.py index c6973938a80..253cd88f311 100644 --- a/mindspore/_checkparam.py +++ b/mindspore/_checkparam.py @@ -28,6 +28,7 @@ from mindspore import log as logger from mindspore.common import dtype as mstype from mindspore._c_expression import Tensor as Tensor_ + class Rel(Enum): """Numerical relationship between variables, logical relationship enumeration definition of range.""" @@ -827,9 +828,12 @@ class Validator: return True type_str = "" - if type_int: type_str += "int, " - if type_tuple: type_str += "tuple, " - if type_list: type_str += "list, " + if type_int: + type_str += "int, " + if type_tuple: + type_str += "tuple, " + if type_list: + type_str += "list, " raise TypeError(f"Axis should be {type_str}but got {type(axis)}.") @staticmethod @@ -968,6 +972,7 @@ def args_unreset_check(*unreset_args, **unreset_kwargs): def unreset_check(func): sig = inspect.signature(func) bound_unreset = sig.bind_partial(*unreset_args, **unreset_kwargs).arguments + @wraps(func) def wrapper(*args, **kwargs): nonlocal bound_unreset diff --git a/mindspore/context.py b/mindspore/context.py index 3c8ce8d5289..c68ed9eb12d 100644 --- a/mindspore/context.py +++ b/mindspore/context.py @@ -509,6 +509,7 @@ def _check_target_specific_cfgs(device, arg_key): ", ignore it.") return False + @args_unreset_check(device_id=int, variable_memory_max_size=str, max_device_memory=str) @args_type_check(mode=int, precompile_only=bool, device_target=str, device_id=int, save_graphs=bool, save_graphs_path=str, enable_dump=bool, auto_tune_mode=str, diff --git a/mindspore/log.py b/mindspore/log.py index f975ce3a61c..94488b12dc5 100644 --- a/mindspore/log.py +++ b/mindspore/log.py @@ -269,6 +269,7 @@ def _get_env_config(): config_dict[key] = value.strip() return config_dict + def _verify_config(kwargs): """