pycnet.prog package

Module contents

Defines functions and classes for displaying text progress bars.

Functions:

makeProgBar

Generates a text progress bar.

Classes:

ProgBarWorker

Monitors progress and prints a text-based progress bar.

class pycnet.prog.ProgBarWorker(done_queue, total_size)

Bases: Process

A worker that prints a text-based progress bar.

When running, the worker will regularly check the number of items in done_queue, compute progress as a proportion of total_size, and generate and print a text-based progress bar. When the size of done_queue equals total_size (i.e., all tasks are complete), the process stops.

done_queue

Queue to track completed tasks.

Type:

Multiprocessing.Queue

total_size

Number of tasks to be performed.

Type:

int

run()

Method to be run in sub-process; can be overridden in sub-class

pycnet.prog.makeProgBar(done, total, width=30)

Create a nicely formatted text-based progress bar.

Parameters:
  • done (int) – How many items from the to-do list have been completed.

  • total (int) – How many items were in the to-do list initially.

  • width (int) – Number of characters comprising the fillable portion of the progress bar.

Returns:

A nicely formatted text-based progress bar.

Return type:

str