String (@NotNull Sdk sdk) { SdkAdditionalData sdkAdditionalData = sdk.getSdkAdditionalData(); if (sdkAdditionalData instanceof PyTargetAwareAdditionalData) { // TODO [targets] Cache version as for `PyRemoteSdkAdditionalDataBase` String versionString; try { versionString = PyInterpreterVersionUtil.getInterpreterVersion((PyTargetAwareAdditionalData)sdkAdditionalData, null, true); } catch (Exception e) { versionString = "undefined"; } return versionString; } else if (sdkAdditionalData instanceof PyRemoteSdkAdditionalDataBase data) { assert data != null; String versionString = data.getVersionString(); if (StringUtil.isEmpty(versionString)) { try { versionString = PyRemoteInterpreterUtil.getInterpreterVersion(null, data, true); } catch (Exception e) { LOG.warn("Couldn't get interpreter version:" + e.getMessage(), e); versionString = "undefined"; } data.setVersionString(versionString); } return versionString; } else { if (ApplicationManager.getApplication().isUnitTestMode()) { final var version = sdk.getUserData(MOCK_PY_VERSION_KEY); if (version != null) { return version; } } String homePath = sdk.getHomePath(); return homePath == null ? null : getVersionString(homePath); } }