change: weights are divided among children

This commit is contained in:
boyska 2024-05-10 13:37:22 +02:00
parent 4c9f73f705
commit 4c02335412

4
feed
View file

@ -603,7 +603,7 @@ def expand_glob(sources: list, weights: list) -> tuple:
'''
Let's say that sources=["foo", "bar*"] and weight=["2", "3"] and on filesystem there are bar1 and bar2.
Result: ["foo", "bar1", "bar2"], ["2", "3", "3"]
Result: ["foo", "bar1", "bar2"], ["2", "1.5", "1.5"]
'''
new_sources = []
new_weights = []
@ -614,7 +614,7 @@ def expand_glob(sources: list, weights: list) -> tuple:
else:
expanded_source = [src]
logging.debug("glob: %s -> %s", src, expanded_source)
expanded_weight = [weight] * len(expanded_source)
expanded_weight = [weight / len(expanded_source)] * len(expanded_source)
new_sources += expanded_source
new_weights += expanded_weight