Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
riya-17 authored and jhutar committed Oct 20, 2023
1 parent 5986bee commit b464a82
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions opl/investigator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
7 changes: 3 additions & 4 deletions opl/pass_or_fail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b464a82

Please sign in to comment.