Skip to main content

A simple wrapper of any Iterator or Iterable

Project description

ProgressIter v0.2

Discription

This is a simple wrapper of any Iterator or Iterable and print the progressbar string during a for loop.

Like this:

[#################################################8                                                  ]49%(5131/10289)some extra information

Usage

Class instantiation

Progressbar(
    iter
    length=0,
    on=True,
)

iter is the Iterator or the Iterable object you want to iterate in a for loop.

length (Optional) The total length of iter. Only use if the iter object has no attribute __len__. If the length was set wrong, the printing string of progressbar may act wrong.

on (Optional) If it is set to False, nothing will be print. The progressbar will act the same as the iterable object.

Methods

show_message(str)

str Some extra information you want to print after the string of progressbar. When this method is called, the information will not be print immediately. When the iterable object goes to the next step, this information will be print.

Example

from Progressbar import Progressbar as PB
import time

def some_work(some_data):
    time.sleep(0.001)

some_iterable_dataset = range(1000)

start_time = time.time()
pb = PB(some_iterable_dataset, on=True)
for data in pb:
    some_work(data)
    pb.show_message('time:%.1f sec'%(time.time()-start_time))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ProgressIter-0.2.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ProgressIter-0.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file ProgressIter-0.2.tar.gz.

File metadata

  • Download URL: ProgressIter-0.2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

File hashes

Hashes for ProgressIter-0.2.tar.gz
Algorithm Hash digest
SHA256 0a985a2d3814ccbec071c18dc2749474a12b91dacd9c6257f1cc1fa66cff4e56
MD5 e627aa032868430b959865b5cc03fc3d
BLAKE2b-256 db1f79805d203ff78c011e2b0d724bdea0fd56c31145e39128d0a66a882e28fe

See more details on using hashes here.

File details

Details for the file ProgressIter-0.2-py3-none-any.whl.

File metadata

  • Download URL: ProgressIter-0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

File hashes

Hashes for ProgressIter-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b1f168b0bc4ea8687dc7397ca4cb401904ee9331e9a061dd82b367e3d6b7baf3
MD5 da24cff8cd7bf847ec42b22b0527eee2
BLAKE2b-256 308aa36d9e4072739d91961d4ddbeb1a8b7504fe3d9983377485bbe45d64f5ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page