Skip to content

step

step_cnt = 0 module-attribute

add_step(num_steps=1)

Source code in roc/jupyter/step.py
15
16
17
18
19
20
21
22
def add_step(num_steps: int = 1) -> None:
    global step_cnt

    step_cnt = num_steps
    logger.info(f"stepping {step_cnt} times...")

    breakpoints.add(do_step, name="step")
    breakpoints.resume(quiet=True)

do_step()

Source code in roc/jupyter/step.py
25
26
27
28
29
30
31
32
33
def do_step() -> bool:
    global step_cnt

    step_cnt -= 1
    if step_cnt <= 0:
        breakpoints.remove("step")
        return True

    return False

step_cli(num_steps)

Source code in roc/jupyter/step.py
 9
10
11
12
@click.command()
@click.argument("num_steps", type=int, default=1)
def step_cli(num_steps: int) -> None:
    add_step(num_steps)