mirror of
https://github.com/esphome/esphome.git
synced 2025-10-12 23:03:46 +01:00
adj
This commit is contained in:
@@ -69,12 +69,17 @@ def create_intelligent_batches(
|
|||||||
# Components with the same signature stay in the same batches
|
# Components with the same signature stay in the same batches
|
||||||
batches = []
|
batches = []
|
||||||
|
|
||||||
# Sort signature groups by size (largest first) for better packing
|
# Sort signature groups to prioritize groupable components
|
||||||
sorted_groups = sorted(
|
# 1. Put "none" signature last (can't be grouped)
|
||||||
signature_groups.items(),
|
# 2. Sort groupable signatures by size (largest first)
|
||||||
key=lambda x: len(x[1]),
|
def sort_key(item):
|
||||||
reverse=True,
|
(platform, signature), components = item
|
||||||
)
|
is_none = platform == "none" and signature == "none"
|
||||||
|
# Put "none" last (1), groupable first (0)
|
||||||
|
# Within each category, sort by size (largest first)
|
||||||
|
return (is_none, -len(components))
|
||||||
|
|
||||||
|
sorted_groups = sorted(signature_groups.items(), key=sort_key)
|
||||||
|
|
||||||
for (platform, signature), group_components in sorted_groups:
|
for (platform, signature), group_components in sorted_groups:
|
||||||
# Split this signature group into batches of batch_size
|
# Split this signature group into batches of batch_size
|
||||||
|
Reference in New Issue
Block a user