Add YAPF style + ignore, and format tracked Python files

This commit is contained in:
2025-12-29 18:42:02 -08:00
parent c019c00aed
commit 507946a3e4
108 changed files with 11664 additions and 6494 deletions

View File

@@ -27,16 +27,24 @@ class PipelineProgress:
def ui_and_pipe_index(self) -> Tuple[Optional[Any], int]:
ui = None
try:
ui = self._ctx.get_live_progress() if hasattr(self._ctx, "get_live_progress") else None
ui = self._ctx.get_live_progress(
) if hasattr(self._ctx,
"get_live_progress") else None
except Exception:
ui = None
pipe_idx: int = 0
try:
stage_ctx = (
self._ctx.get_stage_context() if hasattr(self._ctx, "get_stage_context") else None
self._ctx.get_stage_context()
if hasattr(self._ctx,
"get_stage_context") else None
)
maybe_idx = getattr(stage_ctx, "pipe_index", None) if stage_ctx is not None else None
maybe_idx = getattr(
stage_ctx,
"pipe_index",
None
) if stage_ctx is not None else None
if isinstance(maybe_idx, int):
pipe_idx = int(maybe_idx)
except Exception:
@@ -111,7 +119,11 @@ class PipelineProgress:
return
def update_transfer(
self, *, label: str, completed: Optional[int], total: Optional[int] = None
self,
*,
label: str,
completed: Optional[int],
total: Optional[int] = None
) -> None:
ui, _ = self.ui_and_pipe_index()
if ui is None:
@@ -149,13 +161,19 @@ class PipelineProgress:
return
def ensure_local_ui(
self, *, label: str, total_items: int, items_preview: Optional[Sequence[Any]] = None
self,
*,
label: str,
total_items: int,
items_preview: Optional[Sequence[Any]] = None
) -> bool:
"""Start a local PipelineLiveProgress panel if no shared UI exists."""
try:
existing = (
self._ctx.get_live_progress() if hasattr(self._ctx, "get_live_progress") else None
self._ctx.get_live_progress()
if hasattr(self._ctx,
"get_live_progress") else None
)
except Exception:
existing = None
@@ -179,7 +197,10 @@ class PipelineProgress:
try:
ui.begin_pipe(
0, total_items=max(1, int(total_items)), items_preview=list(items_preview or [])
0,
total_items=max(1,
int(total_items)),
items_preview=list(items_preview or [])
)
except Exception:
pass
@@ -221,7 +242,9 @@ class PipelineProgress:
items_preview: Optional[Sequence[Any]] = None,
) -> Iterator["PipelineProgress"]:
created = self.ensure_local_ui(
label=label, total_items=total_items, items_preview=items_preview
label=label,
total_items=total_items,
items_preview=items_preview
)
try:
yield self