diff options
author | Slasnista <stan.chambon@gmail.com> | 2017-08-28 14:07:55 +0200 |
---|---|---|
committer | Slasnista <stan.chambon@gmail.com> | 2017-08-28 14:07:55 +0200 |
commit | c5d7c40c1d850879abd5f2c513afa1a2c5d5987e (patch) | |
tree | 341b525dffe325be2709d72e0f0863ad9bfc66de /ot/utils.py | |
parent | a8fa91bec26caa93329e61a104e0ad6afdf37363 (diff) |
check input parameters with helper functions
Diffstat (limited to 'ot/utils.py')
-rw-r--r-- | ot/utils.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ot/utils.py b/ot/utils.py index 29ad536..01f2a67 100644 --- a/ot/utils.py +++ b/ot/utils.py @@ -168,6 +168,27 @@ def parmap(f, X, nprocs=multiprocessing.cpu_count()): return [x for i, x in sorted(res)] +def check_params(**kwargs): + """check_params: check whether some parameters are missing + """ + + missing_params = [] + check = True + + for param in kwargs: + if kwargs[param] is None: + missing_params.append(param) + + if len(missing_params) > 0: + print("POT - Warning: following necessary parameters are missing") + for p in missing_params: + print("\n", p) + + check = False + + return check + + class deprecated(object): """Decorator to mark a function or class as deprecated. |