You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "mypy/semanal.py", line 808, in visit_func_def
File "mypy/semanal.py", line 837, in analyze_func_def
File "mypy/typeanal.py", line 865, in visit_callable_type
File "mypy/typeanal.py", line 1391, in anal_array
File "mypy/typeanal.py", line 1400, in anal_type
File "mypy/types.py", line 1792, in accept
File "mypy/typeanal.py", line 865, in visit_callable_type
File "mypy/typeanal.py", line 1391, in anal_array
File "mypy/typeanal.py", line 1400, in anal_type
File "mypy/types.py", line 933, in accept
File "mypy/typeanal.py", line 845, in visit_unpack_type
NotImplementedError
[6] Error running mypy in /workspaces/nvcloud: the mypy daemon crashed. This is probably a bug in mypy itself, see Output panel for details. The daemon will be restarted automatically.
To Reproduce
I tried to unpack a named tuple inside a callable.
class StackArgs(TypedDict):
"""The arguments that are passed to boto when creating or updating a stack.
Args:
StackName (str): The name of the stack to create, must be unique within the region.
Capabilities (Sequence[CapabilityType]): A list of capabilities that the stack is granted.
TemplateBody (Optional[str], optional): The Cloudformation template as a str. Defaults to None.
TemplateURL (Optional[str], optional): A URL to the Cloudformation template. Defaults to None.
Parameters (Optional[Sequence[ParameterTypeDef]], optional): The parameters to use when createing the stack.
Defaults to None.
Tags (Optional[Sequence[TagTypeDef]], optional): The tags to apply to the stack, which will get applied
to all resources created by the stack. Defaults to None.
EnableTerminationProtection (bool, optional): If enabled the stack is unable to be deleted until its removed.
Defaults to False.
"""
StackName: str
TemplateBody: NotRequired[str]
TemplateURL: NotRequired[str]
Parameters: NotRequired[Sequence["ParameterTypeDef"]]
DisableRollback: NotRequired[bool]
RollbackConfiguration: NotRequired["RollbackConfigurationTypeDef"]
TimeoutInMinutes: NotRequired[int]
NotificationARNs: NotRequired[Sequence[str]]
Capabilities: NotRequired[Sequence["CapabilityType"]]
ResourceTypes: NotRequired[Sequence[str]]
RoleARN: NotRequired[str]
OnFailure: NotRequired["OnFailureType"]
StackPolicyBody: NotRequired[str]
StackPolicyURL: NotRequired[str]
Tags: NotRequired[Sequence["TagTypeDef"]]
ClientRequestToken: NotRequired[str]
EnableTerminationProtection: NotRequired[bool]
class StackOperation(NamedTuple):
name: str
func: Callable[[Unpack[StackArgs]], "StackResource"]
Your Environment
Mypy version used: latest and 0.9X
Mypy command-line flags: None except path to file
Mypy configuration options from mypy.ini (and other config files): I have the experimental unpack feature turned on
Fixes#16082
Currently we only allow `Unpack` of a TypedDict when it appears in a
function definition. This PR also allows this in `Callable` types,
similarly to how we do this for variadic types.
Note this still doesn't allow having both variadic unpack and a
TypedDict unpack in the same `Callable`. Supporting this is tricky, so
let's not so this until people will actually ask for this. FWIW we can
always suggest callback protocols for such tricky cases.
Crash Report
I tried to use the
Unpack
inside of a callable.Traceback
To Reproduce
I tried to unpack a named tuple inside a callable.
Your Environment
mypy.ini
(and other config files): I have the experimental unpack feature turned on@ilevkivskyi
The text was updated successfully, but these errors were encountered: