mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-14430 Inspection fails for Numpy Arrays return by some functions
Used appropriate type for arrays, trim array element type names (f.i array of ndtype float -> array)
This commit is contained in:
@@ -49,7 +49,7 @@ public class NumpyDocStringTypeProvider extends PyTypeProviderBase {
|
||||
// 16 occurrences
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("scalar", "int or long or float or complex");
|
||||
// 10 occurrences
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("array", "collections.Iterable");
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("array", "numpy.core.multiarray.ndarray");
|
||||
// 9 occurrences
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("any", "object");
|
||||
// 5 occurrences
|
||||
|
||||
@@ -17,12 +17,12 @@ package com.jetbrains.numpy.documentation;
|
||||
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.psi.PyClass;
|
||||
import com.jetbrains.python.psi.PyFile;
|
||||
import com.jetbrains.python.psi.PyFunction;
|
||||
import com.jetbrains.python.psi.PyPsiFacade;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -283,6 +283,10 @@ public class NumPyDocString {
|
||||
if (index >= 0) {
|
||||
return typeString.substring(0, index);
|
||||
}
|
||||
index = typeString.indexOf(" of "); // e.g. ndarray of dtype float
|
||||
if (index >= 0) {
|
||||
return typeString.substring(0, index);
|
||||
}
|
||||
return typeString;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user