aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/configs/checkers.py
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-11-11 22:57:16 +0800
committerAaron LI <aaronly.me@outlook.com>2016-11-11 22:57:16 +0800
commitb0808761421d1909d8175986dce7e9ec247515ad (patch)
tree7e10cb231c1a886bae4b24facad9f45e165bf57f /fg21sim/configs/checkers.py
parent56853d117d14df0a2636902e085a253394095486 (diff)
downloadfg21sim-b0808761421d1909d8175986dce7e9ec247515ad.tar.bz2
configs/checkers.py: Check missing before validating the values
Diffstat (limited to 'fg21sim/configs/checkers.py')
-rw-r--r--fg21sim/configs/checkers.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/fg21sim/configs/checkers.py b/fg21sim/configs/checkers.py
index 0788443..1ab2a85 100644
--- a/fg21sim/configs/checkers.py
+++ b/fg21sim/configs/checkers.py
@@ -55,12 +55,20 @@ def check_common(configs):
results = {}
# "common/nside" must be a power of 2
key = "common/nside"
- if not _is_power2(configs.getn(key)):
- results[key] = "not a power of 2"
+ res = _check_missing(configs, key)
+ if res == {}:
+ if not _is_power2(configs.getn(key)):
+ results[key] = "not a power of 2"
+ else:
+ results.update(res)
# "common/lmax" must be greater than "common/lmin"
key = "common/lmax"
- if configs.getn(key) <= configs.getn("common/lmin"):
- results[key] = "not greater than 'common/lmin'"
+ res = _check_missing(configs, [key, "common/lmin"])
+ if res == {}:
+ if configs.getn(key) <= configs.getn("common/lmin"):
+ results[key] = "not greater than 'common/lmin'"
+ else:
+ results.update(res)
# Check enabled components
key = "common/components"
if len(configs.getn(key)) == 0: