Revert "work around python/mypy#11852"

This reverts commit 83675fe768.
This commit is contained in:
Anthony Sottile 2022-01-10 15:35:33 -05:00
parent a33773182e
commit bba6cf4296
2 changed files with 3 additions and 6 deletions

View file

@ -159,8 +159,7 @@ def xargs(
) )
threads = min(len(partitions), target_concurrency) threads = min(len(partitions), target_concurrency)
# https://github.com/python/mypy/issues/11852 with _thread_mapper(threads) as thread_map:
with _thread_mapper(threads) as thread_map: # type: ignore
results = thread_map(run_cmd_partition, partitions) results = thread_map(run_cmd_partition, partitions)
for proc_retcode, proc_out, _ in results: for proc_retcode, proc_out, _ in results:

View file

@ -166,15 +166,13 @@ def test_xargs_concurrency():
def test_thread_mapper_concurrency_uses_threadpoolexecutor_map(): def test_thread_mapper_concurrency_uses_threadpoolexecutor_map():
# https://github.com/python/mypy/issues/11852 with xargs._thread_mapper(10) as thread_map:
with xargs._thread_mapper(10) as thread_map: # type: ignore
_self = thread_map.__self__ # type: ignore _self = thread_map.__self__ # type: ignore
assert isinstance(_self, concurrent.futures.ThreadPoolExecutor) assert isinstance(_self, concurrent.futures.ThreadPoolExecutor)
def test_thread_mapper_concurrency_uses_regular_map(): def test_thread_mapper_concurrency_uses_regular_map():
# https://github.com/python/mypy/issues/11852 with xargs._thread_mapper(1) as thread_map:
with xargs._thread_mapper(1) as thread_map: # type: ignore
assert thread_map is map assert thread_map is map