Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tenumerate ignores total parameter #1017

Closed
5 of 8 tasks
udalrich opened this issue Jul 31, 2020 · 0 comments · Fixed by #1008
Closed
5 of 8 tasks

tenumerate ignores total parameter #1017

udalrich opened this issue Jul 31, 2020 · 0 comments · Fixed by #1008
Assignees
Labels
c1-quick 🕐 Complexity low p2-bug-warning ⚠ Visual output bad submodule ⊂ Periphery/subclasses to-merge ↰ Imminent
Projects
Milestone

Comments

@udalrich
Copy link

  • I have marked all applicable categories:
    • exception-raising bug
    • visual output bug
    • documentation request (i.e. "X is missing from the documentation." If instead I want to ask "how to use X?" I understand StackOverflow#tqdm is more appropriate)
    • new feature request
  • I have visited the source website, and in particular
    read the known issues
  • I have searched through the issue tracker for duplicates
  • I have mentioned version numbers, operating system and
    environment, where applicable:
    import tqdm, sys
    print(tqdm.__version__, sys.version, sys.platform)
    4.48.0 3.7.7 (default, Mar 10 2020, 15:43:03) 
    [Clang 11.0.0 (clang-1100.0.33.17)] darwin

tenumerate does not use the total parameter when it cannot figure out the length of the iterable.

This script shows the difference in output:

from tqdm.contrib import tenumerate
from tqdm import tqdm
import time

count=20
for n in tenumerate(zip(range(count), range(count)),
                    desc='Tenum Without total'):
    time.sleep(0.1)

for n in tenumerate(zip(range(count), range(count)),
                    total=count,
                    desc='Tenum With total'):
    time.sleep(0.1)

for n in tqdm(enumerate(zip(range(count), range(count))),
              desc='Tqdm enum Without total'):
    time.sleep(0.1)
for n in tqdm(enumerate(zip(range(count), range(count))),
              total=count,
              desc='Tqdm enum With total'):
    time.sleep(0.1)

The output is:

$ python tenum-bug.py 
Tenum Without total: 20it [00:02,  9.76it/s]
Tenum With total: 20it [00:02,  9.81it/s]
Tqdm enum Without total: 20it [00:02,  9.79it/s]
Tqdm enum With total: 100%|███████████████████████████████████████████████████████████████████| 20/20 [00:02<00:00,  9.71it/s]

The Tenum with total line should have a progress bar, like the Tqdm enum line.

@casperdcl casperdcl self-assigned this Jul 31, 2020
@casperdcl casperdcl added c1-quick 🕐 Complexity low p2-bug-warning ⚠ Visual output bad submodule ⊂ Periphery/subclasses to-merge ↰ Imminent labels Jul 31, 2020
@casperdcl casperdcl added this to the Non-breaking milestone Jul 31, 2020
@casperdcl casperdcl added this to Next Release in Casper Jul 31, 2020
casperdcl added a commit that referenced this issue Jul 31, 2020
Casper automation moved this from Next Release to Done Aug 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c1-quick 🕐 Complexity low p2-bug-warning ⚠ Visual output bad submodule ⊂ Periphery/subclasses to-merge ↰ Imminent
Projects
Casper
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants