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:

[######################################1                                                             ]38%(123/322)[15.80ms/1.94s/3.14s]some extra information

Usage

Class instantiation

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

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.

time_on (Optional) If it is set to True, time of each step will be calculated and the average time, total time and rest time will be printed.

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 ProgressIter import Progressbar as PB
import time

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

some_iterable_dataset = range(10289)

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.3.tar.gz (2.8 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.3-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ProgressIter-0.3.tar.gz
  • Upload date:
  • Size: 2.8 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.3.tar.gz
Algorithm Hash digest
SHA256 951f53f2ccc576ed17192f81ec171d8c93bded37c5d04cc4c85a0188a1df099e
MD5 e387845c6625920ab2bc33f027eeeadd
BLAKE2b-256 e3722dc858bccf634c2001d5ac68b0ed9add085338d8a7473a33ec8009566b47

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ProgressIter-0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.7 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 999a7c7058f4aa83b795e9f18865d93a65d3cb6c40a38996c0e8b002c6b941fa
MD5 42be45aa07f9fa83ed608f15a1a1c720
BLAKE2b-256 586c61658cf2a09da876fdb08df46541e7f81d0e09365695e362136dceab40f9

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