mirror of
https://github.com/esphome/esphome.git
synced 2025-10-12 14:53:49 +01:00
adj
This commit is contained in:
@@ -65,9 +65,9 @@ def create_intelligent_batches(
|
|||||||
# No buses found
|
# No buses found
|
||||||
signature_groups[("none", "none")].append(component)
|
signature_groups[("none", "none")].append(component)
|
||||||
|
|
||||||
# Create batches by grouping components with same signature
|
# Create batches by keeping signature groups together
|
||||||
|
# Components with the same signature stay in the same batches
|
||||||
batches = []
|
batches = []
|
||||||
current_batch = []
|
|
||||||
|
|
||||||
# Sort signature groups by size (largest first) for better packing
|
# Sort signature groups by size (largest first) for better packing
|
||||||
sorted_groups = sorted(
|
sorted_groups = sorted(
|
||||||
@@ -77,17 +77,13 @@ def create_intelligent_batches(
|
|||||||
)
|
)
|
||||||
|
|
||||||
for (platform, signature), group_components in sorted_groups:
|
for (platform, signature), group_components in sorted_groups:
|
||||||
# Add components from this signature group to batches
|
# Split this signature group into batches of batch_size
|
||||||
for component in sorted(group_components): # Sort for determinism
|
# This keeps components with the same signature together
|
||||||
current_batch.append(component)
|
sorted_components = sorted(group_components) # Sort for determinism
|
||||||
|
|
||||||
if len(current_batch) >= batch_size:
|
for i in range(0, len(sorted_components), batch_size):
|
||||||
batches.append(current_batch)
|
batch = sorted_components[i : i + batch_size]
|
||||||
current_batch = []
|
batches.append(batch)
|
||||||
|
|
||||||
# Add remaining components
|
|
||||||
if current_batch:
|
|
||||||
batches.append(current_batch)
|
|
||||||
|
|
||||||
return batches
|
return batches
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user