this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Reapply "Inline split_list and be more idiomatic"

Fix bug with len(list)>1

This reverts commit eec4ce492d58c875a40929e8f299f8215cd96886.

+5 -8
+5 -8
omegastar.py
··· 3 3 import logging 4 4 5 5 6 - # Return two halves of the given list. For odd-length lists, the second half 7 - # will be larger. 8 - def split_list(items): 9 - half = len(items) // 2 10 - return items[0:half], items[half:] 11 - 12 - 13 6 # Attempt to reduce the `items` argument as much as possible, returning the 14 7 # shorter version. `fixed` will always be used as part of the items when 15 8 # running `command`. ··· 21 14 while len(items) > 1: 22 15 logging.info(f"{indent}{len(fixed) + len(items)} candidates") 23 16 24 - left, right = split_list(items) 17 + # Return two halves of the given list. For odd-length lists, the second 18 + # half will be larger. 19 + half = len(items) // 2 20 + left = items[0:half] 21 + right = items[half:] 25 22 if not command(fixed + left): 26 23 items = left 27 24 continue