From 07965cba4b3eec94fd810ae520942bfb441fd118 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 21 Oct 2021 20:28:29 +0000 Subject: [PATCH] added working validate_config for Match module Signed-off-by: Arthur Lu Former-commit-id: b9e2de2dc673987ac514cc019196522017a3ba2e --- src/cli/module.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cli/module.py b/src/cli/module.py index 8f0e6d6..e1ed08d 100644 --- a/src/cli/module.py +++ b/src/cli/module.py @@ -32,7 +32,18 @@ class Match: self.teams = teams def validate_config(self): - return True + if self.config == None: + return "config cannot be empty" + elif self.apikey == None or self.apikey == "": + return "apikey cannot be empty" + elif self.tbakey == None or self.tbakey == "": + return "tbakey cannot be empty" + elif not(self.config["scope"] in ["competition", "season", "none"]): + return "scope must be one of: (competition, season, none)" + elif not(self.config["agglomeration"] in ["none", "mean"]): + return "agglomeration must be one of: (none, mean)" + else: + return None def load_data(self): pass