Skip to content

Commit beeaced

Browse files
fix(annotated): drop unnecessary string annotations, add changelog
Address review feedback on PR #1692: - Remove forward-reference quotes from _WithAnnotatedDecorator.__call__ since Callable, _CommandParams, and _CommandReturn are already in scope - Add a Bug Fixes changelog entry for the with_annotated type-hint fix
1 parent 58655e0 commit beeaced

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
- **complete_in_thread**: (boolean) if `True`, then completion will run in a separate
66
thread. If `False` then completion runs in the main thread and causes it to block if slow.
77
Defaults to `True`.
8+
- Bug Fixes
9+
- Fixed type hinting so that methods decorated with `with_annotated` no longer trigger spurious
10+
mypy errors and preserve their original signature.
811

912
## 4.0.0 (June 5, 2026)
1013

cmd2/annotated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2145,7 +2145,7 @@ def handler(self_arg: Any, ns: Any) -> Any:
21452145
class _WithAnnotatedDecorator(Protocol):
21462146
"""The signature-preserving decorator ``with_annotated(...)`` returns (generic per call)."""
21472147

2148-
def __call__(self, fn: "Callable[_CommandParams, _CommandReturn]", /) -> "Callable[_CommandParams, _CommandReturn]": ...
2148+
def __call__(self, fn: Callable[_CommandParams, _CommandReturn], /) -> Callable[_CommandParams, _CommandReturn]: ...
21492149

21502150

21512151
@overload

0 commit comments

Comments
 (0)