Skip to content

Commit 9257c6f

Browse files
committed
aaaand the alloc_to becomes a dict comprehension
1 parent f20bf90 commit 9257c6f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

domain_model.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ def skus(d):
99

1010

1111
def allocate_to(order, source):
12-
allocations = {}
13-
for sku, quantity in order.items():
14-
if source.get(sku, 0) > quantity:
15-
allocations[sku] = source
16-
return allocations
12+
return {
13+
sku: source
14+
for sku, quantity in order.items()
15+
if source.get(sku, 0) > quantity
16+
}
1717

1818

1919
def allocate(order, stock, shipments):

0 commit comments

Comments
 (0)