PY-76642 Add correct imports when generating type hints containing TypedDict

(cherry picked from commit 5c7761bea54741d68a7137788a46785db61f4247)

IJ-CR-149697

GitOrigin-RevId: 9eafefe6cef2bd599e6b84cf7d199f72c675b14f
This commit is contained in:
Mikhail Golubev
2024-10-16 11:56:28 +03:00
committed by intellij-monorepo-bot
parent 1d8c4eebd6
commit 2864833fca
9 changed files with 50 additions and 2 deletions

View File

@@ -0,0 +1,10 @@
from typing import TypedDict
class Movie(TypedDict):
name: str
year: int
def blockbuster() -> Movie:
...

View File

@@ -0,0 +1,3 @@
from lib import blockbuster
mo<caret>vie = blockbuster()

View File

@@ -0,0 +1,3 @@
from lib import blockbuster, Movie
movie: [Movie] = blockbuster()

View File

@@ -0,0 +1 @@
v<caret>ar = {"foo": 42, "bar": "baz"}

View File

@@ -0,0 +1 @@
v<caret>ar = {"foo": 42, "bar": "baz"}

View File

@@ -0,0 +1,3 @@
from typing import Dict, Union
var: [Dict[str, Union[str, int]]] = {"foo": 42, "bar": "baz"}

View File

@@ -0,0 +1 @@
var: [dict[str, str | int]] = {"foo": 42, "bar": "baz"}