Skip to content

Refactor async_context_manager type annotations using ParamSpec - #828

Open
junyilou wants to merge 1 commit into
ronf:developfrom
junyilou:develop
Open

Refactor async_context_manager type annotations using ParamSpec#828
junyilou wants to merge 1 commit into
ronf:developfrom
junyilou:develop

Conversation

@junyilou

Copy link
Copy Markdown

Refactored the type annotations for the async_context_manager decorator in asyncssh/misc.py by replacing Callable[..., ...] with ParamSpec (_ACMParam). By capturing parameter types with ParamSpec, static analysis tools and IDEs now accurately inspect and auto-complete the original function's arguments (names, types, and defaults) when calling decorated functions, significantly improving type safety and developer experience.

typing.ParamSpec was introduced in Python 3.10, which aligns with the project's target Python version.

Updated async_context_manager function to use ParamSpec for better type hinting.
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.

1 participant