PyType (@NotNull PsiElement anchor, @NotNull String typeString) { final String withoutOptional = cleanupOptional(typeString); final Set<PyType> types = new LinkedHashSet<>(); if (withoutOptional != null) { typeString = withoutOptional; } for (String typeName : getNumpyUnionType(typeString)) { PyType parsedType = parseSingleNumpyDocType(anchor, typeName); if (parsedType != null) { types.add(parsedType); } } if (!types.isEmpty() && withoutOptional != null) { types.add(PyNoneType.INSTANCE); } return getPsiFacade(anchor).createUnionType(types); }