Skip to content

Commit

Permalink
Split the step_completed function (#2058)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbern committed Jul 29, 2024
1 parent a7f4103 commit 7c95262
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions modal/_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ def step_progress_update(spinner: Spinner, message: str):
spinner.update(text=message)


def step_completed(message: str, is_substep: bool = False) -> RenderableType:
"""Returns the element to be rendered when a step is completed."""
def step_completed(message: str) -> RenderableType:
return f"[green]✓[/green] {message}"

STEP_COMPLETED = "[green]✓[/green]"
SUBSTEP_COMPLETED = "🔨"

symbol = SUBSTEP_COMPLETED if is_substep else STEP_COMPLETED
return f"{symbol} {message}"
def substep_completed(message: str) -> RenderableType:
return f"🔨 {message}"


def download_progress_bar() -> Progress:
Expand Down
4 changes: 2 additions & 2 deletions modal/_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def message(self, message):
step_progress_update(self._spinner, message)

def finish(self, message):
from ._output import step_completed, step_progress_update
from ._output import step_progress_update, substep_completed

if self._step_node is not None:
step_progress_update(self._spinner, message)
self._step_node.label = step_completed(message, is_substep=True)
self._step_node.label = substep_completed(message)


class Resolver:
Expand Down

0 comments on commit 7c95262

Please sign in to comment.