void (@NotNull List<PyType> types, @NotNull TypeEvalContext context, @NotNull PsiFile file) { final Set<PsiNamedElement> symbols = new LinkedHashSet<>(); final Set<String> namesFromTyping = new LinkedHashSet<>(); for (PyType type : types) { collectImportTargetsFromType(type, context, symbols, namesFromTyping); } final boolean builtinTyping = LanguageLevel.forElement(file).isAtLeast(LanguageLevel.PYTHON35); final ImportPriority priority = builtinTyping ? ImportPriority.BUILTIN : ImportPriority.THIRD_PARTY; for (String name : namesFromTyping) { AddImportHelper.addOrUpdateFromImportStatement(file, "typing", name, null, priority, null); } for (PsiNamedElement symbol : symbols) { PyPsiRefactoringUtil.insertImport(file, symbol, null, true); } }