def first(result, *results): """Return the first result finish from a list of results. If no one is finished yet - all of the results are placeholders - return the first placeholder from the list. """ rs = [] for r in i_or_args(result, results): if is_result_proxy(r): rs.append(r) else: return r return min(rs, key=_order_key)
def finish_order(result, *results): """Return the results in their finish order. The results that aren't finished yet will be at the end with their relative order preserved. """ rs = [] for r in i_or_args(result, results): if is_result_proxy(r): rs.append(r) else: yield r for r in sorted(rs, key=_order_key): yield r