mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-19 20:14:17 +02:00
fix(context): move elicit overload docs inside the stubs
The explanatory string literals for Context.elicit's @overload stubs sat
between the stubs rather than inside them, as bare class-body expression
statements. A statement between overloads terminates the overload series
for mypy, so mypy saw only the first stub and rejected every documented
response_type at the call site:
error: Argument "response_type" to "elicit" of "Context" has
incompatible type "list[str]"; expected "None" [arg-type]
pyright tolerates the interleaved statements, so this only reproduced
under mypy.
Moving each literal into its stub's body puts the prose in docstring
position, attached to the stub it describes, and restores the chain.
The implementation function is untouched (verified byte-identical), so
there is no runtime or API change.
This commit is contained in:
parent
875e8e18bd
commit
10895a96e9
1 changed files with 15 additions and 24 deletions
|
|
@ -962,9 +962,8 @@ class Context:
|
|||
*,
|
||||
response_title: str | None = None,
|
||||
response_description: str | None = None,
|
||||
) -> AcceptedElicitation[T] | DeclinedElicitation | CancelledElicitation: ...
|
||||
|
||||
"""The accepted elicitation will contain the response data"""
|
||||
) -> AcceptedElicitation[T] | DeclinedElicitation | CancelledElicitation:
|
||||
"""The accepted elicitation will contain the response data"""
|
||||
|
||||
@overload
|
||||
async def elicit(
|
||||
|
|
@ -974,10 +973,9 @@ class Context:
|
|||
*,
|
||||
response_title: str | None = None,
|
||||
response_description: str | None = None,
|
||||
) -> AcceptedElicitation[str] | DeclinedElicitation | CancelledElicitation: ...
|
||||
|
||||
"""When response_type is a list of strings, the accepted elicitation will
|
||||
contain the selected string response"""
|
||||
) -> AcceptedElicitation[str] | DeclinedElicitation | CancelledElicitation:
|
||||
"""When response_type is a list of strings, the accepted elicitation will
|
||||
contain the selected string response"""
|
||||
|
||||
@overload
|
||||
async def elicit(
|
||||
|
|
@ -987,10 +985,9 @@ class Context:
|
|||
*,
|
||||
response_title: str | None = None,
|
||||
response_description: str | None = None,
|
||||
) -> AcceptedElicitation[str] | DeclinedElicitation | CancelledElicitation: ...
|
||||
|
||||
"""When response_type is a dict mapping keys to title dicts, the accepted
|
||||
elicitation will contain the selected key"""
|
||||
) -> AcceptedElicitation[str] | DeclinedElicitation | CancelledElicitation:
|
||||
"""When response_type is a dict mapping keys to title dicts, the accepted
|
||||
elicitation will contain the selected key"""
|
||||
|
||||
@overload
|
||||
async def elicit(
|
||||
|
|
@ -1000,12 +997,9 @@ class Context:
|
|||
*,
|
||||
response_title: str | None = None,
|
||||
response_description: str | None = None,
|
||||
) -> (
|
||||
AcceptedElicitation[list[str]] | DeclinedElicitation | CancelledElicitation
|
||||
): ...
|
||||
|
||||
"""When response_type is a list containing a list of strings (multi-select),
|
||||
the accepted elicitation will contain a list of selected strings"""
|
||||
) -> AcceptedElicitation[list[str]] | DeclinedElicitation | CancelledElicitation:
|
||||
"""When response_type is a list containing a list of strings (multi-select),
|
||||
the accepted elicitation will contain a list of selected strings"""
|
||||
|
||||
@overload
|
||||
async def elicit(
|
||||
|
|
@ -1015,13 +1009,10 @@ class Context:
|
|||
*,
|
||||
response_title: str | None = None,
|
||||
response_description: str | None = None,
|
||||
) -> (
|
||||
AcceptedElicitation[list[str]] | DeclinedElicitation | CancelledElicitation
|
||||
): ...
|
||||
|
||||
"""When response_type is a list containing a dict mapping keys to title dicts
|
||||
(multi-select with titles), the accepted elicitation will contain a list of
|
||||
selected keys"""
|
||||
) -> AcceptedElicitation[list[str]] | DeclinedElicitation | CancelledElicitation:
|
||||
"""When response_type is a list containing a dict mapping keys to title dicts
|
||||
(multi-select with titles), the accepted elicitation will contain a list of
|
||||
selected keys"""
|
||||
|
||||
async def elicit(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue