Skip to content

Commit

Permalink
Fix trailing whitespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
mshukuno committed Mar 8, 2024
1 parent c694e1a commit 75cbfe0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
18 changes: 9 additions & 9 deletions popsborder/contamination.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def add_contaminant_uniform_random(config, consignment):


def _contaminated_items_to_cluster_sizes(
contaminated_items, contaminated_units_per_cluster
contaminated_items, contaminated_units_per_cluster
):
"""Get list of cluster sizes for a given number of contaminated items
Expand All @@ -195,7 +195,7 @@ def _contaminated_items_to_cluster_sizes(


def _contaminated_boxes_to_cluster_sizes(
contaminated_boxes, contaminated_units_per_cluster
contaminated_boxes, contaminated_units_per_cluster
):
"""Get list of cluster sizes for a given number of contaminated items
Expand Down Expand Up @@ -240,8 +240,8 @@ def choose_strata_for_clusters(num_units, cluster_width, num_clusters):
if num_strata < num_clusters:
raise ValueError(
"""Cannot avoid overlapping clusters. Increase
contaminated_units_per_cluster
or decrease cluster_item_width (if using item contamination_unit)"""
contaminated_units_per_cluster or decrease cluster_item_width (if using item
contamination_unit)"""
)
# If all strata are needed, all strata are selected for clusters
if num_clusters == num_strata:
Expand Down Expand Up @@ -289,7 +289,7 @@ def add_contaminant_clusters_to_boxes(config, consignment):
consignment.boxes[cluster_index].items.fill(1)
# In last box of last cluster, contaminate partial box if needed
cluster_start = (
contaminated_units_per_cluster * cluster_strata[len(cluster_sizes) - 1]
contaminated_units_per_cluster * cluster_strata[len(cluster_sizes) - 1]
)
cluster_indexes = np.arange(
start=cluster_start, stop=cluster_start + cluster_sizes[-1]
Expand Down Expand Up @@ -352,7 +352,7 @@ def add_contaminant_clusters_to_items(config, consignment):
cluster_item_width, (consignment.num_items - cluster_start)
)
assert (
cluster_width >= cluster_size
cluster_width >= cluster_size
), "Not enough items available to contaminate in selected cluster stratum."
cluster = np.random.choice(cluster_width, cluster_size, replace=False)
cluster += cluster_start
Expand Down Expand Up @@ -402,9 +402,9 @@ def consignment_matches_selection_rule(rule, consignment):
# provided in configuration, we count it as match so that consignment
# can be selected using only one property.
selected = (
(not commodity or commodity == consignment.commodity)
and (not origin or origin == consignment.origin)
and (not port or port == consignment.port)
(not commodity or commodity == consignment.commodity)
and (not origin or origin == consignment.origin)
and (not port or port == consignment.port)
)
if not selected:
return False
Expand Down
4 changes: 1 addition & 3 deletions popsborder/inspections.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,7 @@ def inspect(config, consignment, n_units_to_inspect, detailed):
config, consignment, n_units_to_inspect
)

# TODO Effectiveness config validation should be done in the main. Validation can be
# avoided by adding default values to the config such as "effectiveness" = 1 under
# "inspection".
# TODO May not be needing this if default effectiveness is added to config.
effectiveness = validate_effectiveness(config)

# Inspect selected boxes, count opened boxes, inspected items,
Expand Down

0 comments on commit 75cbfe0

Please sign in to comment.