diff options
author | Slasnista <stan.chambon@gmail.com> | 2017-08-28 14:07:55 +0200 |
---|---|---|
committer | Nicolas Courty <Nico@MacBook-Pro-de-Nicolas.local> | 2017-09-01 11:09:13 +0200 |
commit | 84e56a0637f3194c5b1b160bd4f89ccd0ffe661d (patch) | |
tree | 341b525dffe325be2709d72e0f0863ad9bfc66de /ot/utils.py | |
parent | f79f4831e9d70217ceab2758733abe62dc93208b (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. |