Skip to content

Commit 91d8e0f

Browse files
committed
inline a dict creation
1 parent ff9bff9 commit 91d8e0f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

domain_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ def allocate_to(order, source):
2424
return allocations
2525

2626

27-
def allocate_to_sources(order, sources, allocations):
27+
def allocate_to_sources(order, sources):
28+
allocations = {}
2829
for sku, quantity in order.items():
2930
if sku in allocations:
3031
continue
3132
for source in sources:
3233
allocate_line(sku, quantity, source, allocations)
3334
if sku in allocations:
3435
break
36+
return allocations
3537

3638

3739

@@ -45,6 +47,4 @@ def allocate(order, stock, shipments):
4547
if skus(order) <= skus(shipment):
4648
return allocate_to(order, shipment)
4749

48-
allocations = {}
49-
allocate_to_sources(order, [stock] + shipments, allocations)
50-
return allocations
50+
return allocate_to_sources(order, [stock] + shipments)

0 commit comments

Comments
 (0)