[python] migrate code to use Strings.areSameInstance instead of comparison operations (IDEA-312368)

This is needed to make the intention explicit and avoid warnings.

GitOrigin-RevId: be902bbeea65827d6afcf41a6015d2107e3f5eb2
This commit is contained in:
Nikolay Chashnikov
2023-02-06 10:59:45 +01:00
committed by intellij-monorepo-bot
parent 3db1e0326b
commit b9055571c0
2 changed files with 5 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.Strings;
import com.intellij.psi.util.QualifiedName;
import com.intellij.util.PathUtil;
import com.jetbrains.python.psi.PyStringLiteralCoreUtil;
@@ -54,7 +55,7 @@ public final class PythonStringUtil {
s = FileUtil.toSystemIndependentName(s);
final List<String> components = StringUtil.split(s, "/");
for (String name : components) {
if (name == components.get(0) && SystemInfo.isWindows && name.endsWith(":")) {
if (Strings.areSameInstance(name, components.get(0)) && SystemInfo.isWindows && name.endsWith(":")) {
continue;
}
if (!PathUtil.isValidFileName(name)) {