Skip to content

[tqdm] Include timeout in concurrent map stubs - #16924

Open
Lushiyao5 wants to merge 1 commit into
python:mainfrom
Lushiyao5:fix/tqdm-map-timeout-20261129
Open

Lushiyao5 wants to merge 1 commit into
python:mainfrom
Lushiyao5:fix/tqdm-map-timeout-20261129

Conversation

@Lushiyao5

Copy link
Copy Markdown

The concurrent mapping helpers forward timeout to Executor.map, but the shared keyword stub omits it. Add timeout as an optional int, float or None so calls such as thread_map(abs, [-2], timeout=2.5) pass type checking.

Verified thread_map and process_map at runtime on tqdm 4.70.1 with Python 3.12. mypy rejects their timeout calls on the base stub and accepts both after the change, inferring list[int].

Prepared with assistance from OpenAI Codex.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

# Concurrent-specific parameters
tqdm_class: type[tqdm[object]]
max_workers: int | None
timeout: FloatInt | None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
timeout: FloatInt | None
timeout: float | int | None

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants