Construct a reasonable type for a TypedDict type in runtime context. If it appears as a callee, it will be special-cased anyway, e.g. it is also allowed to accept a single positional argument if it is a dict literal. Note it is not safe to move this to type_object_type() si
(self, info: TypeInfo)
| 960 | return AnyType(TypeOfAny.from_error) |
| 961 | |
| 962 | def typeddict_callable(self, info: TypeInfo) -> CallableType: |
| 963 | """Construct a reasonable type for a TypedDict type in runtime context. |
| 964 | |
| 965 | If it appears as a callee, it will be special-cased anyway, e.g. it is |
| 966 | also allowed to accept a single positional argument if it is a dict literal. |
| 967 | |
| 968 | Note it is not safe to move this to type_object_type() since it will crash |
| 969 | on plugin-generated TypedDicts, that may not have the special_alias. |
| 970 | """ |
| 971 | assert info.special_alias is not None |
| 972 | target = info.special_alias.target |
| 973 | assert isinstance(target, ProperType) and isinstance(target, TypedDictType) |
| 974 | return self.typeddict_callable_from_context(target, info.defn.type_vars) |
| 975 | |
| 976 | def typeddict_callable_from_context( |
| 977 | self, callee: TypedDictType, variables: Sequence[TypeVarLikeType] | None = None |
no test coverage detected