From b464a823d45705ddf47212085a5dc7a779febafc Mon Sep 17 00:00:00 2001 From: Riya Date: Fri, 20 Oct 2023 02:12:07 +0530 Subject: [PATCH] refactor code --- opl/investigator/config.py | 8 ++++---- opl/pass_or_fail.py | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/opl/investigator/config.py b/opl/investigator/config.py index cd211dd..b163441 100644 --- a/opl/investigator/config.py +++ b/opl/investigator/config.py @@ -91,11 +91,11 @@ def load_config(conf, fp): if conf.decisions_type == "csv": conf.decisions_filename = data["decisions"]["filename"] - decision_type = conf.decisions_type.split(",") - for d_type in decision_type: - if d_type.strip() == "elasticsearch": + conf.decisions_type = [d_type.strip() for d_type in conf.decisions_type.split(",")] + for d_type in conf.decisions_type: + if d_type == "elasticsearch": conf.decisions_es_server = data["decisions"]["es_server"] assert not conf.decisions_es_server.endswith("/") conf.decisions_es_index = data["decisions"]["es_index"] - if d_type.strip() == "csv": + if d_type == "csv": conf.decisions_filename = data["decisions"]["filename"] diff --git a/opl/pass_or_fail.py b/opl/pass_or_fail.py index a93b7e5..0be5e71 100755 --- a/opl/pass_or_fail.py +++ b/opl/pass_or_fail.py @@ -198,13 +198,12 @@ def main(): get_stats(info_all, "method") if not args.dry_run: - decision_type = args.decisions_type.split(",") - for d_type in decision_type: - if d_type.strip() == "elasticsearch": + for d_type in args.decisions_type: + if d_type == "elasticsearch": opl.investigator.elasticsearch_decisions.store( args.decisions_es_server, args.decisions_es_index, info_all ) - if d_type.strip() == "csv": + if d_type == "csv": opl.investigator.csv_decisions.store(args.decisions_filename, info_all) if not args.dry_run: