Skip to content

fix: expose .retry, .statistics, .retry_with to type checkers#601

Merged
mergify[bot] merged 1 commit intomainfrom
devs/jd/fix/retry-decorated-typing/I8c2bc7b49a0cb51175a8e0bf33d9742f10bc49a0
Feb 23, 2026
Merged

fix: expose .retry, .statistics, .retry_with to type checkers#601
mergify[bot] merged 1 commit intomainfrom
devs/jd/fix/retry-decorated-typing/I8c2bc7b49a0cb51175a8e0bf33d9742f10bc49a0

Conversation

@jd
Copy link
Owner

@jd jd commented Feb 23, 2026

Add _RetryDecorated Protocol that combines the original callable
signature (via ParamSpec) with the retry control attributes. Update
all retry() overloads, _AsyncRetryDecorator, and wraps() methods to
return _RetryDecorated[P, R] instead of bare WrappedFn.

This lets mypy see .retry, .statistics, and .retry_with on decorated
functions without # type: ignore, fixing a long-standing typing gap.

Removes ~30 now-unnecessary type: ignore comments from tests.

Closes #346

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Add _RetryDecorated Protocol that combines the original callable
signature (via ParamSpec) with the retry control attributes. Update
all retry() overloads, _AsyncRetryDecorator, and wraps() methods to
return _RetryDecorated[P, R] instead of bare WrappedFn.

This lets mypy see .retry, .statistics, and .retry_with on decorated
functions without # type: ignore, fixing a long-standing typing gap.

Removes ~30 now-unnecessary type: ignore comments from tests.

Closes #346

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change-Id: I8c2bc7b49a0cb51175a8e0bf33d9742f10bc49a0
@jd jd force-pushed the devs/jd/fix/retry-decorated-typing/I8c2bc7b49a0cb51175a8e0bf33d9742f10bc49a0 branch from 137d9a2 to c25b946 Compare February 23, 2026 16:28
@jd jd marked this pull request as ready for review February 23, 2026 16:32
@mergify mergify bot merged commit f4a31e1 into main Feb 23, 2026
9 checks passed
@mergify mergify bot deleted the devs/jd/fix/retry-decorated-typing/I8c2bc7b49a0cb51175a8e0bf33d9742f10bc49a0 branch February 23, 2026 16:32
@mergify
Copy link
Contributor

mergify bot commented Feb 23, 2026

Merge Queue Status

Rule: default


  • Entered queue2026-02-23 16:32 UTC
  • Checks passed · in-place
  • Merged2026-02-23 16:32 UTC · at c25b94659bb6f4b067f33963e8fb5b021170b7c6

This pull request spent 8 seconds in the queue, with no time running CI.

Required conditions to merge

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.

mypy error: "Callable[..., Any]" has no attribute "retry"

1 participant