OEDots

class OEDots

Provides a simple progress bar interface for command line applications. Dots, ., characters are printed to OEPlatform_oeerr to indicate to the user of the command line application that progress is indeed being made and the program is not hung indefinitely.

See also

A version of this class that is safe to used from multiple threads of computation: OEThreadedDots.

Constructors

OEDots(bigstep: int, smallstep: int, objectname: str = "",
       action: str = "processed") -> OEDots

Controls how the following output gets updated:

.......... 10000 things processed.
.......... 20000 things processed.
.......... 30000 things processed.
.......... 40000 things processed.
.......... 50000 things processed.
.......... 60000 things processed.
.......... 70000 things processed.
.......... 80000 things processed.
bigstep

The number of elements before a new line is generated. The above example is a bigstep of 10000.

smallstep

The number of elements before a single new dot, ., is printed. The above example is a smallstep of 1000. Or 10 dots per line.

objectname

A description of what is being processed. In the above example, this is “things”.

action

A description of what is done to the ‘objects’. In the above example, this is “processed”.

GetBigStep

GetBigStep() -> int

Returns the bigstep size used to construct this instance.

GetCounts

GetCounts() -> int

Returns the current number of elements counted by this instance.

GetSmallStep

GetSmallStep() -> int

Returns the smallstep size used to construct this instance.

SetBigStep

SetBigStep(s: int) -> None

Sets a new bigstep size for this instance.

SetSmallStep

SetSmallStep(s: int) -> None

Sets a new smallstep size for this instance.

Total

Total() -> None

Prints a final summary line like the following:

Total: 80000 things processed.

Typically only run once at the end of all processing.

Update

Update(step: int = 1) -> None
Update(symbol: str, step: int = 1) -> None

Update the progress with the number of elements specified by step. The default is 1 element, but any number can be specified. However, 0 is not a valid step size and will throw an error. The second overload allows to specify a symbol to be displayed as progress, instead of a dot.

Note

Not thread-safe, see OEThreadedDots if this method needs to be called from multiple threads.

See also