Skip to content

Commit

Permalink
code review change: condensed cast into dictionary comprehension
Browse files Browse the repository at this point in the history
  • Loading branch information
AmandaBirmingham committed Oct 27, 2020
1 parent fc78b7a commit 6533aea
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions microsetta_private_api/repo/admin_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,16 +667,15 @@ def create_kits(self, number_of_kits, number_of_samples, kit_prefix,
FROM barcodes.project;"""

cur.execute(query)
known_projects = {id_: tmi for id_, tmi in cur.fetchall()}
projects_tmi = {id_: bool(tmi) for id_, tmi in cur.fetchall()}
is_tmi = False
for input_proj_id in project_ids:
if input_proj_id not in known_projects:
if input_proj_id not in projects_tmi:
raise KeyError("Project id %s does not exist" %
input_proj_id)
# if *any* of the projects the kits will be associate with are
# microsetta projects, set is_tmi to true
curr_tmi = bool(known_projects[input_proj_id])
if curr_tmi:
if projects_tmi[input_proj_id]:
is_tmi = True

# get existing kits to test for conflicts
Expand Down

0 comments on commit 6533aea

Please sign in to comment.