A simple wrapper of any Iterator or Iterable
Project description
ProgressIter v0.4.0
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,
bar_len=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.
bar_len (Optional) Length of the bar string. Default 100.
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.
global_bar_len(length:int)
length It set the default value of optional parameter bar_len 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ProgressIter-0.4.0.tar.gz.
File metadata
- Download URL: ProgressIter-0.4.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4929299a8dd0a6deeced05598c7d4663f810aacac794fb441e9f9a43ba7d31ec
|
|
| MD5 |
2891cdebfe246d81d56749dd2003388c
|
|
| BLAKE2b-256 |
f00206bbe69f5a95ad366ce1cdd6aa470718c3664a501a340b45566cdcd93c66
|
File details
Details for the file ProgressIter-0.4.0-py3-none-any.whl.
File metadata
- Download URL: ProgressIter-0.4.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9583f9413e4e7835304fc3d082422802f190565d1b98d9957659b0d3f902c19b
|
|
| MD5 |
08d3e8a29aaba0323619b9e39bbe3df4
|
|
| BLAKE2b-256 |
1e19591737be33f19d036a94afd9e7a54bbe47a0a85d65e58b33b6739ac46af3
|