Skip to main content

A simple wrapper of any Iterator or Iterable

Project description

ProgressIter v0.3.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=None,
    time_on=None,
)

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.

global_on(on:bool)

on It set the default value of optional parameter on for all instantiation.

global_time_on(on:bool)

on It set the default value of optional parameter time_on for all instantiation.

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('this data = %d' % data)

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.2.tar.gz (3.0 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.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ProgressIter-0.3.2.tar.gz
  • Upload date:
  • Size: 3.0 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.2.tar.gz
Algorithm Hash digest
SHA256 8c548136ea32002340899cdabd0c0d512446c61866658b54ba76a4477856d9df
MD5 e4d2cfdb1e1304d7a828a0ae012ee10e
BLAKE2b-256 c9db23120bc6d7e69b7cd2e3b263e0eca77d83486023d3513ea1f15ce1282793

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ProgressIter-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 22db19a5db0e363a6a5f654247fb88e4d2fdf3eaf402942d188b3d7e673ffb49
MD5 60f1df8d7a32aa977648169219a70a30
BLAKE2b-256 aa85823059b47694aeffb918d1b4ecb92353e4e9afed8096a34e4207496ec60a

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