def test_juxt_generator_input(): data = list(range(10)) juxtfunc = juxt(itemgetter(2 * i) for i in range(5)) assert juxtfunc(data) == (0, 2, 4, 6, 8) assert juxtfunc(data) == (0, 2, 4, 6, 8)
def aoc4(*validators): validator = juxt(*validators) return sum(all(validator(n)) for n in map(str, puzzle_bounds))
def test_juxt_generator_input(): data = list(range(10)) juxtfunc = juxt(itemgetter(2*i) for i in range(5)) assert tuple(juxtfunc(data)) == (0, 2, 4, 6, 8) assert tuple(juxtfunc(data)) == (0, 2, 4, 6, 8)
def __init__(self, *feature_funcs): self._combined = functoolz.juxt(feature_funcs)