Fix that tqdm_class cannot be passed to tmap and tzip#1148
Merged
casperdcl merged 2 commits intotqdm:develfrom Apr 5, 2021
Merged
Fix that tqdm_class cannot be passed to tmap and tzip#1148casperdcl merged 2 commits intotqdm:develfrom
tmap and tzip#1148casperdcl merged 2 commits intotqdm:develfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1148 +/- ##
==========================================
- Coverage 84.73% 84.55% -0.19%
==========================================
Files 25 25
Lines 1651 1651
Branches 273 273
==========================================
- Hits 1399 1396 -3
- Misses 213 216 +3
Partials 39 39 |
casperdcl
reviewed
Mar 16, 2021
Comment on lines
-83
to
+84
| for i in zip(tqdm_class(iter1, **tqdm_kwargs), *iter2plus): | ||
| for i in zip(tqdm_class(iter1, **kwargs), *iter2plus): |
Merged
bdice
added a commit
to glotzerlab/signac-flow
that referenced
this pull request
Feb 27, 2022
This was referenced Feb 27, 2022
bdice
added a commit
to glotzerlab/signac-flow
that referenced
this pull request
Mar 1, 2022
* Fix: tqdm.auto requires ipywidgets for notebook support. * Update changelog. * Use tqdm_class to avoid bug in automatic detection. * Bump tqdm requirement to 4.60.0 for tqdm/tqdm#1148.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There's currently the issue that
tqdm_classcannot be passed totmapandtzip. This PR fixes the issue and adds tests for it.Here's a repex of the problem:
--------------------------------------------------------------------------- TqdmKeyError Traceback (most recent call last) <ipython-input-4-62e01f8ad3b6> in <module> ----> 1 list(tmap(print, range(10), tqdm_class=tqdm)) ~/anaconda3/lib/python3.7/site-packages/tqdm/contrib/__init__.py in _tmap(function, *sequences, **tqdm_kwargs) 64 tqdm_class : [default: tqdm.auto.tqdm]. 65 """ ---> 66 for i in _tzip(*sequences, **tqdm_kwargs): 67 yield function(*i) 68 ~/anaconda3/lib/python3.7/site-packages/tqdm/contrib/__init__.py in _tzip(iter1, *iter2plus, **tqdm_kwargs) 52 kwargs = deepcopy(tqdm_kwargs) 53 tqdm_class = kwargs.pop("tqdm_class", tqdm_auto) ---> 54 for i in zip(tqdm_class(iter1, **tqdm_kwargs), *iter2plus): 55 yield i 56 ~/anaconda3/lib/python3.7/site-packages/tqdm/std.py in __init__(self, iterable, desc, total, leave, file, ncols, mininterval, maxinterval, miniters, ascii, disable, unit, unit_scale, dynamic_ncols, smoothing, bar_format, initial, position, postfix, unit_divisor, write_bytes, lock_args, nrows, gui, **kwargs) 961 fp_write=getattr(file, 'write', sys.stderr.write)) 962 if "nested" in kwargs else --> 963 TqdmKeyError("Unknown argument(s): " + str(kwargs))) 964 965 # Preprocess the arguments TqdmKeyError: "Unknown argument(s): {'tqdm_class': <class 'tqdm.std.tqdm'>}"