datumaro.components.progress_reporting#

Classes

NullProgressReporter()

ProgressReporter()

Only one set of methods must be called:

SimpleProgressReporter([period, interval])

TQDMProgressReporter([period, interval])

class datumaro.components.progress_reporting.ProgressReporter[source]#

Bases: object

Only one set of methods must be called:
  • start - report_status - finish

  • iter

  • split

This class is supposed to manage the state of children progress bars and release of their resources, if necessary.

property period: float#

Returns reporting period.

For example, 0.1 would mean every 10%.

property interval: float#

Returns reporting time interval in second.

start(total: int, *, desc: str | None = None)[source]#

Initializes the progress bar

report_status(progress: int)[source]#

Updates the progress bar

finish()[source]#

Finishes the progress bar

iter(iterable: Iterable[T], *, total: int | None = None, desc: str | None = None) Iterable[T][source]#

Traverses the iterable and reports progress simultaneously.

Starts and finishes the progress bar automatically.

Parameters:
  • iterable – An iterable to be traversed

  • total – The expected number of iterations. If not provided, will try to use iterable.__len__.

  • desc – The status message

Returns:

An iterable over elements of the input sequence

split(count: int) Tuple[ProgressReporter, ...][source]#

Splits the progress bar into few independent parts. In case of 0 must return an empty tuple.

This class is supposed to manage the state of children progress bars and release of their resources, if necessary.

class datumaro.components.progress_reporting.NullProgressReporter[source]#

Bases: ProgressReporter

property period: float#

Returns reporting period.

For example, 0.1 would mean every 10%.

property interval: float#

Returns reporting time interval in second.

start(total: int, *, desc: str | None = None)[source]#

Initializes the progress bar

report_status(progress: int)[source]#

Updates the progress bar

iter(iterable: Iterable[T], *, total: int | None = None, desc: str | None = None) Iterable[T][source]#

Traverses the iterable and reports progress simultaneously.

Starts and finishes the progress bar automatically.

Parameters:
  • iterable – An iterable to be traversed

  • total – The expected number of iterations. If not provided, will try to use iterable.__len__.

  • desc – The status message

Returns:

An iterable over elements of the input sequence

split(count: int) Tuple[ProgressReporter][source]#

Splits the progress bar into few independent parts. In case of 0 must return an empty tuple.

This class is supposed to manage the state of children progress bars and release of their resources, if necessary.

class datumaro.components.progress_reporting.SimpleProgressReporter(period: float = 0.1, interval: float = inf)[source]#

Bases: ProgressReporter

property period: float#

Returns reporting period.

For example, 0.1 would mean every 10%.

property interval: float#

Returns reporting time interval in second.

start(total: int, *, desc: str | None = None)[source]#

Initializes the progress bar

report_status(progress: int)[source]#

Updates the progress bar

finish()[source]#

Finishes the progress bar

split(count: int)[source]#

Splits the progress bar into few independent parts. In case of 0 must return an empty tuple.

This class is supposed to manage the state of children progress bars and release of their resources, if necessary.

class datumaro.components.progress_reporting.TQDMProgressReporter(period: float = 0.1, interval: float = 0.1, **options)[source]#

Bases: ProgressReporter

property period: float#

Returns reporting period.

For example, 0.1 would mean every 10%.

property interval: float#

Returns reporting time interval in second.

start(total: int, *, desc: str | None = None)[source]#

Initializes the progress bar

report_status(progress: int)[source]#

Updates the progress bar

finish()[source]#

Finishes the progress bar

split(count: int)[source]#

Splits the progress bar into few independent parts. In case of 0 must return an empty tuple.

This class is supposed to manage the state of children progress bars and release of their resources, if necessary.