21 lines
644 B
Python
21 lines
644 B
Python
def hex_to_rgb(hex):
|
|
if type(hex) != str and str("Values must be of type <class 'str'>"):
|
|
# chatch wierd openxl things
|
|
hex = "#0"
|
|
hex= "{:06}".format(str(hex).lstrip("#"))
|
|
return tuple(int(hex[i:i+2],16) for i in (0, 2, 4))
|
|
|
|
def delegate_tasks(tasks, threats, min_tasks_per_threat):
|
|
n = len(tasks)
|
|
|
|
# determine usable cores
|
|
usable_cores = min(threats, n // min_tasks_per_threat)
|
|
|
|
if usable_cores == 0:
|
|
usable_cores = 1
|
|
|
|
# split tasks evenly
|
|
chunk_size = (n + usable_cores - 1) // usable_cores
|
|
chunks = [tasks[i:i + chunk_size] for i in range(0, n, chunk_size)]
|
|
return chunks
|