Skip to content

pfun.schedule.spaced(delta)

Create a schedule that repeats delta forever.

Parameters:

Name Type Description Default
delta timedelta

time interval to repeat

required

Returns:

Type Description
Schedule[object]

Schedule that repeats delta forever

pfun.schedule.exponential(delta)

Create a schedule that increases time intervals exponentially forever, starting from delta

Parameters:

Name Type Description Default
delta timedelta

base interval to increase exponentially

required

Returns:

Type Description
Schedule[object]

Schedule that increases exponentially forever

pfun.schedule.recurs(n, schedule)

Create a schedule that consumes n steps from schedule. If schedule is exhausted in less than n steps, the resulting schedule is also exhausted.

Parameters:

Name Type Description Default
n int

Number of steps to consume from schedule

required
schedule Schedule[R]

Schedule to consume intervals from

required

Returns:

Type Description
Schedule[R]

Schedule that consumes n steps from schedule, or all intervals from schedule

pfun.schedule.take_while(p, schedule)

Create a schedule that consumes intervals from schedule until p returns False.

Parameters:

Name Type Description Default
p Callable[[timedelta], bool]

Predicate to test intervals from schedule with

required
schedule Schedule[R]

Schedule to consume intervals from

required

Returns:

Type Description
Schedule[R]

Schedule that consumes intervals from schedule until p returns False

pfun.schedule.until(delta, schedule)

Create a schedule that consumes intervals from schedule until an interval is greater than delta.

Parameters:

Name Type Description Default
delta timedelta

Max interval

required
schedule Schedule[R]

Schedule to consume intervals from

required

Returns:

Type Description
Schedule[R]

Schedule that consumes intervals from schedule until an interval is greater than delta

pfun.schedule.jitter(schedule)

Create a schedule that randomly adds between 0 and 1 second to intervals in schedule

Parameters:

Name Type Description Default
schedule Schedule[R]

Schedule to which random delays are added

required

Returns:

Type Description
Schedule[Intersection[R, HasRandom]]

Schedule that consumes from schedule and adds between 0 and 1 second randomly