-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from soda480/0.2.4
0.2.4
- Loading branch information
Showing
12 changed files
with
142 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
# -*- coding: utf-8 -*- | ||
import time | ||
import names | ||
from progress1bar import ProgressBar | ||
|
||
print('Processing names...') | ||
completed_message = 'Done processing all names' | ||
fill = {'max_total': 999} | ||
with ProgressBar(total=500, completed_message=completed_message, fill=fill, clear_alias=True) as pb: | ||
completed_message = 'Processed names' | ||
with ProgressBar(total=75, completed_message=completed_message, clear_alias=True, show_fraction=False, show_prefix=False) as pb: | ||
for _ in range(pb.total): | ||
pb.alias = names.get_full_name() | ||
# simulate work | ||
time.sleep(.08) | ||
pb.count += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,16 @@ | ||
# -*- coding: utf-8 -*- | ||
import time | ||
import random | ||
import logging | ||
import names | ||
from progress1bar import ProgressBar | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
TOTAL_ITEMS = 325 | ||
|
||
def process_message(pb, message): | ||
pb.match(message) | ||
logger.debug(message) | ||
|
||
regex = { | ||
'total': r'^processing total of (?P<value>\d+)$', | ||
'count': r'^processed .*$', | ||
'alias': r'^processor is (?P<value>.*)$' | ||
} | ||
fill = { | ||
'max_total': TOTAL_ITEMS | ||
} | ||
with ProgressBar(regex=regex, fill=fill) as pb: | ||
last_name = names.get_last_name() | ||
process_message(pb, f'processor is {last_name}') | ||
total = random.randint(50, TOTAL_ITEMS) | ||
process_message(pb, f'processing total of {total}') | ||
with ProgressBar(ticker=9644, regex=regex) as pb: | ||
pb.match(f'processor is {names.get_full_name()}') | ||
total = random.randint(500, 1000) | ||
pb.match(f'processing total of {total}') | ||
for _ in range(total): | ||
process_message(pb, f'processed {names.get_full_name()}') | ||
time.sleep(.01) | ||
pb.match(f'processed {names.get_full_name()}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
import time | ||
import random | ||
import time | ||
import names | ||
from progress1bar import ProgressBar | ||
|
||
TOTAL_ITEMS = 150 | ||
TOTAL_NAMES = 7 | ||
TOTAL_ITEMS = 800 | ||
ITERATIONS = 4 | ||
|
||
fill = { | ||
'max_total': TOTAL_ITEMS, | ||
'max_completed': TOTAL_NAMES | ||
} | ||
print(f'This progress bar will execute {TOTAL_NAMES} iterations of varying counts and keep track of how many have been completed ...') | ||
with ProgressBar(fill=fill) as pb: | ||
total_names = 0 | ||
print(f'Execute {ITERATIONS} iterations of varying totals:') | ||
with ProgressBar(show_prefix=False, show_fraction=False) as pb: | ||
iterations = 0 | ||
while True: | ||
pb.alias = names.get_last_name() | ||
pb.total = random.randint(50, TOTAL_ITEMS) | ||
if iterations == ITERATIONS: | ||
pb.alias = '' | ||
pb.complete = True | ||
break | ||
pb.alias = names.get_full_name() | ||
pb.total = random.randint(500, TOTAL_ITEMS) | ||
for _ in range(pb.total): | ||
names.get_full_name() | ||
pb.count += 1 | ||
time.sleep(.01) | ||
total_names += 1 | ||
if total_names == TOTAL_NAMES: | ||
pb.alias = '' | ||
break | ||
iterations += 1 | ||
pb.reset() | ||
time.sleep(.4) |
Oops, something went wrong.