koladata

Home
Overview
Fundamentals
Glossary
Cheatsheet
API Reference
Quick Recipes
Deep Dive
Common Pitfalls and Gotchas
Persistent Storage

View the Project on GitHub google/koladata

kd_ext.tqdm.ProgressState API

Immutable snapshot of tqdm progress state.

This mirrors the information available via `tqdm.format_dict` and can be
round-tripped through the `ProgressRecord` proto for serialization over
RPCs, storage, or inter-process communication.

Attributes:
  n: Number of items completed.
  total: Total number of items, or `None`/`0` if the bar is indeterminate
    (e.g., pulling from a generator). Indeterminate bars will still show
    iterations and rate, but not a total or ETA.
  elapsed_secs: Seconds elapsed since the progress bar started.
  rate: Processing rate in items/s (EMA-smoothed), or `None` if unavailable.
  initial: Starting counter value (usually 0).
  unit: Unit label (e.g. "it", "batch", "step").
  desc: Description prefix set by the user.
  postfix: Postfix string set by the user.
  bar_id: Unique identifier for the progress bar.
  is_closed: True if the progress bar has been closed.
  is_displayed: True if the progress bar should be displayed (usually False
    if closed and `leave=False` or if `disable=True`).

ProgressState.__init__(self, n: float | None = None, total: float | None = None, elapsed_secs: float = 0.0, rate: float | None = None, initial: float = 0.0, unit: str = 'it', desc: str | None = None, postfix: str | None = None, bar_id: str = '', is_closed: bool = False, is_displayed: bool = True) -> None

Initialize self.  See help(type(self)) for accurate signature.

ProgressState.bar_id

''

ProgressState.desc

None

ProgressState.elapsed_secs

0.0

ProgressState.fraction

Progress fraction, computed as `n / total`.

ProgressState.from_proto(ps: ProgressRecord) -> Self

Constructs a ProgressState from a `ProgressRecord` proto.

ProgressState.from_tqdm(fmt: dict[str, Any], bar_id: str, is_closed: bool, is_displayed: bool) -> Self

Constructs a ProgressState from a tqdm `format_dict`.

ProgressState.initial

0.0

ProgressState.is_closed

False

ProgressState.is_displayed

True

ProgressState.n

None

ProgressState.postfix

None

ProgressState.rate

None

ProgressState.remaining_s

Estimated seconds until completion, or None if rate is unknown.

ProgressState.to_proto(self) -> ProgressRecord

Serializes this ProgressState to a `ProgressRecord` proto.

ProgressState.total

None

ProgressState.unit

'it'