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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ProgressIter-0.3.1.tar.gz
  • Upload date:
  • Size: 2.9 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.1.tar.gz
Algorithm Hash digest
SHA256 1d1b6905477ae59d4a49fde40bf4769222dd8326c893a10a1f824deeb2c38ca1
MD5 00ec655f784b40fae4990be6040eb8c6
BLAKE2b-256 9601cdfacbab7302a7ec782843b494f343026d1edd0ec56412a1df7eb6cabd4f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ProgressIter-0.3.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 231e59d4b187403b87c3d75acb274fdc6f905d7ff5a633376b84e18892db7d9c
MD5 17e01bba7fde19606d772fea6ea333e0
BLAKE2b-256 5fc1c7e0a9432fa1dc0cde3aa4ff16b377395352c58f4db64892b5dba2dd6798

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