Skip to content

Commit 9cf5a12

Browse files
authored
Merge pull request #1830 from eaubin/master
2 parents 8d6ff8d + 24b9e1e commit 9cf5a12

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎.github/PULL_REQUEST_TEMPLATE/pr.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ about: Use this template for proposing change(s)
99
+ [ ] documentation modification
1010
+ [ ] new feature
1111
- [ ] If applicable, I have mentioned the relevant/related issue(s)
12-
- [ ] Any AI-assisted commits are clearly marked ([author], [Co-authored-by] or [Assisted-by])
12+
- [ ] Any AI-assisted commits are clearly marked ([author], [Co-authored-by] or [Assisted-by]) using the syntax `Provider Model <email>`, e.g. `Co-authored-by: Claude Opus 5 <[email protected]>`
1313

1414
Less important but also useful:
1515

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ repos:
7272
- id: pyupgrade
7373
args: [--py38-plus]
7474
- repo: https://github.com/PyCQA/isort
75-
rev: 9.0.0b1
75+
rev: 9.0.1
7676
hooks:
7777
- id: isort
7878
- repo: https://github.com/kynan/nbstripout

‎tests/tests_concurrent.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ def dummy_func(x):
1111
return x + 1
1212

1313

14+
def test_min_map_len():
15+
assert concurrent._min_map_len([]) == 0
16+
assert concurrent._min_map_len([(i for i in range(9))]) == 0
17+
assert concurrent._min_map_len([(i for i in range(9)), range(5)]) == 5
18+
19+
1420
@mark.parametrize("mapper", [interpreter_map, process_map, thread_map])
1521
def test_concurrent_map(mapper, caperr):
1622
a = range(9)
@@ -23,6 +29,17 @@ def test_concurrent_map(mapper, caperr):
2329
assert '0/9' in err
2430

2531

32+
@mark.parametrize("mapper", [interpreter_map, process_map, thread_map])
33+
def test_concurrent_map_unknown_len(mapper, caperr):
34+
b = [i + 1 for i in range(9)]
35+
try:
36+
assert mapper(dummy_func, (i for i in range(9))) == b
37+
except ImportError as err:
38+
skip(str(err))
39+
err = caperr()
40+
assert '9it [' in err
41+
42+
2643
def check_lock(args):
2744
"""Check that another interpreter cannot acquire a held tqdm lock"""
2845
from os.path import exists

‎tqdm/contrib/concurrent.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def _get_interpreter_init(tqdm_class, lock_queue_id):
100100

101101

102102
def _min_map_len(iterables):
103-
"""min(map(length_hint, iterables))"""
104-
return min(n for it in iterables if (n := length_hint(it, -1)) >= 0)
103+
"""min(map(length_hint, iterables), default=0)"""
104+
return min((n for it in iterables if (n := length_hint(it, -1)) >= 0), default=0)
105105

106106

107107
def _executor_map(

0 commit comments

Comments
 (0)