mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -17,6 +17,6 @@
|
||||
<localInspection language="Manifest" displayName="Missing Final New Line" groupName="Manifest"
|
||||
enabledByDefault="true" level="ERROR" implementationClass="org.jetbrains.lang.manifest.highlighting.MissingFinalNewlineInspection"/>
|
||||
<localInspection language="Manifest" displayName="Unknown or Misspelled Header Name" groupName="Manifest"
|
||||
enabledByDefault="true" level="WARNING" implementationClass="org.jetbrains.lang.manifest.highlighting.MisspelledHeaderInspection"/>
|
||||
enabledByDefault="true" level="WEAK WARNING" implementationClass="org.jetbrains.lang.manifest.highlighting.MisspelledHeaderInspection"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package org.jetbrains.lang.manifest;
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.lang.manifest.highlighting.MisspelledHeaderInspection;
|
||||
|
||||
import java.util.List;
|
||||
@@ -31,13 +30,13 @@ public class MisspelledHeaderInspectionTest extends LightCodeInsightFixtureTestC
|
||||
|
||||
public void testNoProblem() {
|
||||
myFixture.configureByText(ManifestFileTypeFactory.MANIFEST, "Manifest-Version: 1.0\n");
|
||||
Assert.assertEquals(0, myFixture.getAvailableIntentions().size());
|
||||
assertEquals(0, myFixture.getAvailableIntentions().size());
|
||||
}
|
||||
|
||||
public void testFix() {
|
||||
myFixture.configureByText(ManifestFileTypeFactory.MANIFEST, "ManifestVersion: 1.0\n");
|
||||
List<IntentionAction> intentions = myFixture.filterAvailableIntentions("Change to");
|
||||
Assert.assertTrue(intentions.size() > 0);
|
||||
assertTrue(intentions.size() > 0);
|
||||
myFixture.launchAction(intentions.get(0));
|
||||
myFixture.checkResult("Manifest-Version: 1.0\n");
|
||||
}
|
||||
|
||||
+3
-3
@@ -102,12 +102,12 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt
|
||||
warningLabel = createHTMLLabel("Enables Vim-keymap and 'insert' mode for editing. " +
|
||||
"Not recommended if you are unfamiliar with Vim.");
|
||||
|
||||
if (SystemInfo.isMac) UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, warningLabel);
|
||||
if (!SystemInfo.isWindows) UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, warningLabel);
|
||||
}
|
||||
|
||||
final CardLayout wrapperLayout = new CardLayout();
|
||||
final JPanel buttonWrapper = new JPanel(wrapperLayout);
|
||||
final JButton installButton = new JButton(isVIM ? "Install and Enable Vim Editor" : "Install");
|
||||
final JButton installButton = new JButton(isVIM ? "Install and Enable" : "Install");
|
||||
|
||||
final JProgressBar progressBar = new JProgressBar(0, 100);
|
||||
progressBar.setStringPainted(true);
|
||||
@@ -234,7 +234,7 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt
|
||||
JPanel warningPanel = new JPanel(new BorderLayout()) {
|
||||
@Override
|
||||
public Color getBackground() {
|
||||
return new JBColor(ColorUtil.fromHex("F6F199"), ColorUtil.fromHex("52503A"));
|
||||
return new JBColor(new Color(252, 254, 200), ColorUtil.fromHex("52503A"));
|
||||
}
|
||||
};
|
||||
warningPanel.setBorder(new EmptyBorder(5, 10, 5, 10));
|
||||
|
||||
+2
-1
@@ -18,11 +18,12 @@ package com.intellij.openapi.vcs.changes.ui;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class ComplexFocusedComponentWrapper extends JPanel {
|
||||
|
||||
public ComplexFocusedComponentWrapper(@NotNull JComponent component) {
|
||||
super();
|
||||
super(new BorderLayout());
|
||||
add(component);
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ class ndarray(object):
|
||||
|
||||
def __rmul__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rmul__(y) <==> x*y
|
||||
x.__rmul__(y) <==> y*x
|
||||
|
||||
Returns
|
||||
-------
|
||||
@@ -159,6 +159,16 @@ class ndarray(object):
|
||||
"""
|
||||
pass
|
||||
|
||||
def __radd__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__radd__(y) <==> y+x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __copy__(self, order=None): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
a.__copy__([order])
|
||||
@@ -179,7 +189,6 @@ class ndarray(object):
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def __div__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__div__(y) <==> x/y
|
||||
@@ -190,6 +199,215 @@ class ndarray(object):
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rdiv__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rdiv__(y) <==> y/x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __truediv__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__truediv__(y) <==> x/y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rtruediv__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rtruediv__(y) <==> y/x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __floordiv__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__floordiv__(y) <==> x//y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rfloordiv__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rfloordiv__(y) <==> y//x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __mod__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__mod__(y) <==> x%y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rmod__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rmod__(y) <==> y%x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __lshift__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__lshift__(y) <==> x<<y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rlshift__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rlshift__(y) <==> y<<x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rshift__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rshift__(y) <==> x>>y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rrshift__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rrshift__(y) <==> y>>x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __and__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__and__(y) <==> x&y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rand__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rand__(y) <==> y&x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __or__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__or__(y) <==> x|y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __ror__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__ror__(y) <==> y|x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __xor__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__xor__(y) <==> x^y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rxor__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rxor__(y) <==> y^x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __ge__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__ge__(y) <==> x>=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rge__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rge__(y) <==> y>=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __eq__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__eq__(y) <==> x==y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __req__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__req__(y) <==> y==x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __sub__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
@@ -199,4 +417,354 @@ class ndarray(object):
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rsub__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rsub__(y) <==> y-x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __lt__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__lt__(y) <==> x<y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rlt__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rlt__(y) <==> y<x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __le__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__le__(y) <==> x<=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rle__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rle__(y) <==> y<=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __gt__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__gt__(y) <==> x>y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rgt__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rgt__(y) <==> y>x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __ne__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__ne__(y) <==> x!=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rne__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rne__(y) <==> y!=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __iadd__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__iadd__(y) <==> x+=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __riadd__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__riadd__(y) <==> y+=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __isub__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__isub__(y) <==> x-=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __risub__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__risub__(y) <==> y-=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __imul__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__imul__(y) <==> x*=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rimul__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rimul__(y) <==> y*=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __idiv__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__idiv__(y) <==> x/=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __ridiv__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__ridiv__(y) <==> y/=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __itruediv__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__itruediv__(y) <==> x/y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __ritruediv__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__ritruediv__(y) <==> y/x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __ifloordiv__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__ifloordiv__(y) <==> x//y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rifloordiv__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rifloordiv__(y) <==> y//x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __imod__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__imod__(y) <==> x%=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rimod__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rimod__(y) <==> y%=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __ipow__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__ipow__(y) <==> x**=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __ripow__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__ripow__(y) <==> y**=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __ilshift__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__ilshift__(y) <==> x<<=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rilshift__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rilshift__(y) <==> y<<=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __irshift__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__irshift__(y) <==> x>>=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rirshift__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rirshift__(y) <==> y>>=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __iand__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__iand__(y) <==> x&=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __riand__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__riand__(y) <==> y&=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __ior__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__ior__(y) <==> x|=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rior__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rior__(y) <==> y|=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __ixor__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__ixor__(y) <==> x^=y
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
|
||||
def __rixor__(self, y): # real signature unknown; restored from __doc__
|
||||
"""
|
||||
x.__rixor__(y) <==> y^=x
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
"""
|
||||
pass
|
||||
@@ -17,10 +17,14 @@ package com.jetbrains.python.psi.impl;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.python.psi.types.PyType;
|
||||
import com.jetbrains.python.psi.types.TypeEvalContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface PyResolveResultRater {
|
||||
ExtensionPointName<PyResolveResultRater> EP_NAME = ExtensionPointName.create("Pythonid.resolveResultRater");
|
||||
|
||||
int getRate(@NotNull final PsiElement target);
|
||||
int getImportElementRate(@NotNull final PsiElement target);
|
||||
|
||||
int getMemberRate(PsiElement member, PyType type, TypeEvalContext context);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.psi.impl;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.python.psi.types.PyType;
|
||||
import com.jetbrains.python.psi.types.TypeEvalContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PyResolveResultRaterBase implements PyResolveResultRater {
|
||||
|
||||
public int getImportElementRate(@NotNull final PsiElement target) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getMemberRate(PsiElement member, PyType type, TypeEvalContext context) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -627,6 +627,7 @@
|
||||
<!-- NumPy -->
|
||||
<pyModuleMembersProvider implementation="com.jetbrains.numpy.codeInsight.NumpyModuleMembersProvider"/>
|
||||
<typeProvider implementation="com.jetbrains.numpy.codeInsight.NumpyDocStringTypeProvider"/>
|
||||
<resolveResultRater implementation="com.jetbrains.numpy.codeInsight.NumpyResolveRater"/>
|
||||
</extensions>
|
||||
|
||||
<project-components>
|
||||
|
||||
@@ -46,13 +46,18 @@ import java.util.*;
|
||||
*/
|
||||
public class NumpyDocStringTypeProvider extends PyTypeProviderBase {
|
||||
private static final Map<String, String> NUMPY_ALIAS_TO_REAL_TYPE = new HashMap<String, String>();
|
||||
public static String NDARRAY = "numpy.core.multiarray.ndarray";
|
||||
|
||||
private static String NDARRAY_OR_ITERABLE = NDARRAY + " or collections.Iterable";
|
||||
|
||||
static {
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("ndarray", "numpy.core.multiarray.ndarray");
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("numpy.ndarray", "numpy.core.multiarray.ndarray");
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("ndarray", NDARRAY);
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("numpy.ndarray", NDARRAY);
|
||||
// 184 occurrences
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("array_like", "numpy.core.multiarray.ndarray or collections.Iterable");
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("array-like", "numpy.core.multiarray.ndarray or collections.Iterable");
|
||||
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("array_like", NDARRAY_OR_ITERABLE);
|
||||
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("array-like", NDARRAY_OR_ITERABLE);
|
||||
// Parameters marked as 'data-type' actually get any Python type identifier such as 'bool' or
|
||||
// an instance of 'numpy.core.multiarray.dtype', however the type checker isn't able to check it.
|
||||
// 30 occurrences
|
||||
@@ -61,8 +66,8 @@ 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", "numpy.core.multiarray.ndarray or collections.Iterable");
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("numpy.array", "numpy.core.multiarray.ndarray or collections.Iterable");
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("array", NDARRAY_OR_ITERABLE);
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("numpy.array", NDARRAY_OR_ITERABLE);
|
||||
// 9 occurrences
|
||||
NUMPY_ALIAS_TO_REAL_TYPE.put("any", "object");
|
||||
// 5 occurrences
|
||||
|
||||
@@ -42,13 +42,24 @@ public class NumpyModuleMembersProvider extends PyModuleMembersProvider {
|
||||
"float16", "float32", "float64", "float80", "float96", "float128", "float256",
|
||||
"complex32", "complex64", "complex128", "complex160", "complex192", "complex256", "complex512", "double"
|
||||
};
|
||||
private static final String[] PYTHON_TYPES = {
|
||||
"int_", "bool_", "float_", "cfloat", "string_", "str_",
|
||||
"unicode_", "object_", "complex_", "bytes_", "byte", "ubyte", "void",
|
||||
"short", "ushort", "intc", "uintc", "intp", "uintp", "uint",
|
||||
"longlong", "ulonglong", "single", "csingle",
|
||||
"longfloat", "clongfloat"};
|
||||
|
||||
private static String DTYPE = "numpy.core.multiarray.dtype";
|
||||
|
||||
@Override
|
||||
protected Collection<PyCustomMember> getMembersByQName(PyFile module, String qName) {
|
||||
if ("numpy".equals(qName)) {
|
||||
final List<PyCustomMember> members = new ArrayList<PyCustomMember>();
|
||||
for (String type : NUMERIC_TYPES) {
|
||||
members.add(new PyCustomMember(type, "numpy.core.multiarray.dtype", false));
|
||||
members.add(new PyCustomMember(type, DTYPE, false));
|
||||
}
|
||||
for (String type : PYTHON_TYPES) {
|
||||
members.add(new PyCustomMember(type, DTYPE, false));
|
||||
}
|
||||
addTestingModule(module, members);
|
||||
return members;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.numpy.codeInsight;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.psi.impl.PyResolveResultRaterBase;
|
||||
import com.jetbrains.python.psi.types.PyType;
|
||||
import com.jetbrains.python.psi.types.PyTypeChecker;
|
||||
import com.jetbrains.python.psi.types.PyTypeParser;
|
||||
import com.jetbrains.python.psi.types.TypeEvalContext;
|
||||
|
||||
public class NumpyResolveRater extends PyResolveResultRaterBase {
|
||||
|
||||
@Override
|
||||
public int getMemberRate(PsiElement member, PyType type, TypeEvalContext context) {
|
||||
if (member instanceof PsiNamedElement) {
|
||||
final PyType ndArray = PyTypeParser.getTypeByName(member, NumpyDocStringTypeProvider.NDARRAY);
|
||||
if (PyTypeChecker.match(ndArray, type, context) &&
|
||||
PyNames.isRightOperatorName(((PsiNamedElement)member).getName())) {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -384,7 +384,7 @@ public class ResolveImportUtil {
|
||||
rate += 100;
|
||||
}
|
||||
for (PyResolveResultRater rater : Extensions.getExtensions(PyResolveResultRater.EP_NAME)) {
|
||||
rate += rater.getRate(target);
|
||||
rate += rater.getImportElementRate(target);
|
||||
}
|
||||
}
|
||||
ret.poke(target, rate);
|
||||
@@ -396,7 +396,7 @@ public class ResolveImportUtil {
|
||||
/**
|
||||
* @param element what we test (identifier, reference, import element, etc)
|
||||
* @return the how the element relates to an enclosing import statement, if any
|
||||
* @see com.jetbrains.python.psi.resolve.PointInImport
|
||||
* @see PointInImport
|
||||
*/
|
||||
@NotNull
|
||||
public static PointInImport getPointInImport(@NotNull PsiElement element) {
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.jetbrains.python.codeInsight.PyCustomMember;
|
||||
import com.jetbrains.python.codeInsight.PyCustomMemberUtils;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.impl.PyBuiltinCache;
|
||||
import com.jetbrains.python.psi.impl.PyResolveResultRater;
|
||||
import com.jetbrains.python.psi.impl.ResolveResultList;
|
||||
import com.jetbrains.python.psi.resolve.*;
|
||||
import com.jetbrains.python.psi.stubs.PyClassNameIndex;
|
||||
@@ -190,9 +191,16 @@ public class PyClassTypeImpl extends UserDataHolderBase implements PyClassType {
|
||||
|
||||
classMember = resolveByOverridingAncestorsMembersProviders(this, name, location);
|
||||
if (classMember != null) {
|
||||
return ResolveResultList.to(classMember);
|
||||
final ResolveResultList list = new ResolveResultList();
|
||||
int rate = RatedResolveResult.RATE_NORMAL;
|
||||
for (PyResolveResultRater rater : Extensions.getExtensions(PyResolveResultRater.EP_NAME)) {
|
||||
rate += rater.getMemberRate(classMember, this, context);
|
||||
}
|
||||
list.poke(classMember, rate);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
if (inherited) {
|
||||
for (PyClassLikeType type : myClass.getAncestorTypes(context)) {
|
||||
if (type instanceof PyClassType) {
|
||||
|
||||
@@ -28,7 +28,7 @@ public class EscapeSequenceTokenizer {
|
||||
StringBuilder currentToken = new StringBuilder();
|
||||
int currentTokenStart = startOffset;
|
||||
for (int i = 0; i < unescapedText.length(); i++) {
|
||||
if (offsets[i+1]-offsets[i] == 1) {
|
||||
if (offsets[i+1]-offsets[i] == 1 || !Character.isWhitespace(unescapedText.charAt(i))) {
|
||||
if (currentToken.length() == 0) {
|
||||
currentTokenStart = offsets[i] + startOffset;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user