当前位置: 首页>>代码示例>>Java>>正文


Java PyClassTypeImpl类代码示例

本文整理汇总了Java中com.jetbrains.python.psi.types.PyClassTypeImpl的典型用法代码示例。如果您正苦于以下问题:Java PyClassTypeImpl类的具体用法?Java PyClassTypeImpl怎么用?Java PyClassTypeImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PyClassTypeImpl类属于com.jetbrains.python.psi.types包,在下文中一共展示了PyClassTypeImpl类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReturnType

import com.jetbrains.python.psi.types.PyClassTypeImpl; //导入依赖的package包/类
@Override
public Ref<PyType> getReturnType(@NotNull PyCallable callable, @NotNull TypeEvalContext context) {
  if (PyNames.INIT.equals(callable.getName()) && callable instanceof PyFunction) {
    final PyFunction function = (PyFunction)callable;
    final PyClass containingClass = function.getContainingClass();
    if (containingClass != null && ourQt4Signal.equals(containingClass.getName())) {
      final String classQName = containingClass.getQualifiedName();
      if (classQName != null) {
        final QualifiedName name = QualifiedName.fromDottedString(classQName);
        final String qtVersion = name.getComponents().get(0);
        final PyClass aClass = PyClassNameIndex.findClass(qtVersion + "." + ourQtBoundSignal, function.getProject());
        if (aClass != null) {
          final PyType type = new PyClassTypeImpl(aClass, false);
          return Ref.create(type);
        }
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PyQtTypeProvider.java

示例2: getCallableType

import com.jetbrains.python.psi.types.PyClassTypeImpl; //导入依赖的package包/类
@Nullable
@Override
public PyType getCallableType(@NotNull PyCallable callable, @NotNull TypeEvalContext context) {
  if (callable instanceof PyFunction) {
    final String qualifiedName = callable.getQualifiedName();
    if (qualifiedName != null && qualifiedName.startsWith("PyQt")){
      final QualifiedName name = QualifiedName.fromDottedString(qualifiedName);
      final String qtVersion = name.getComponents().get(0);
      final String docstring = ((PyFunction)callable).getDocStringValue();
      if (docstring != null && docstring.contains("[signal]")) {
        final PyClass aClass = PyClassNameIndex.findClass(qtVersion + "." + ourQtBoundSignal, callable.getProject());
        if (aClass != null)
          return new PyClassTypeImpl(aClass, false);
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PyQtTypeProvider.java

示例3: analyzeContract

import com.jetbrains.python.psi.types.PyClassTypeImpl; //导入依赖的package包/类
@NotNull
private PyContractAnalysisResult analyzeContract(PyDecorator decorator) {
    PyExpression contractExpression = decorator.getKeywordArgument("contract");

    if (contractExpression instanceof PyReferenceExpression) {
        PyReferenceExpression referenceExpression = (PyReferenceExpression)contractExpression;
        PsiElement referencedElement = referenceExpression.getReference().resolve();

        if (referencedElement instanceof PyClass) {
            PyClass memberClass = (PyClass)referencedElement;
            PyType pyType = new PyClassTypeImpl(memberClass, false);
            return new PyContractAnalysisResult(pyType, false);
        }

        return noContractResult;
    }

    if (contractExpression instanceof StringLiteralExpression) {
        String contract = ((StringLiteralExpression)contractExpression).getStringValue();

        ContractNode parsedContract = PyContractsUtil.parse(contract);

        if (parsedContract != null) {
            PyType computedType = parsedContract.accept(new PyContractsTypeComputer(myPyClass));
            boolean acceptNone = parsedContract.accept(new PyContractsNoneAnalyzer());
            return new PyContractAnalysisResult(computedType, acceptNone);
        }
    }

    return noContractResult;
}
 
开发者ID:jhominal,项目名称:pysynthetic-intellij,代码行数:32,代码来源:SyntheticTypeInfoReader.java

示例4: isGettingCompletionVariants

import com.jetbrains.python.psi.types.PyClassTypeImpl; //导入依赖的package包/类
private static boolean isGettingCompletionVariants() {
    StackTraceElement[] stackTrace = new Throwable().getStackTrace();
    for (int i = 2; i < stackTrace.length; i++) {
        StackTraceElement current = stackTrace[i];
        if (!PyClassTypeImpl.class.getName().equals(current.getClassName())) {
            return false;
        } else if ("getCompletionVariants".equals(current.getMethodName())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:jhominal,项目名称:pysynthetic-intellij,代码行数:13,代码来源:SyntheticMembersProvider.java

示例5: getClassType

import com.jetbrains.python.psi.types.PyClassTypeImpl; //导入依赖的package包/类
private static PyClassType getClassType(@NotNull final PsiElement element) {
  if (element instanceof PyQualifiedExpression) {
    final PyExpression qualifier = ((PyQualifiedExpression)element).getQualifier();
    if (qualifier == null) return null;
    final PyType type = TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile()).getType(qualifier);
    return type instanceof PyClassType ? (PyClassType)type : null;
  }
  final PyClass aClass = PsiTreeUtil.getParentOfType(element, PyClass.class);
  return aClass != null ? new PyClassTypeImpl(aClass, false) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AddFieldQuickFix.java

示例6: getClassType

import com.jetbrains.python.psi.types.PyClassTypeImpl; //导入依赖的package包/类
private static PyClassType getClassType(@NotNull final PsiElement problemElement) {
  if ((problemElement instanceof PyQualifiedExpression)) {
    final PyExpression qualifier = ((PyQualifiedExpression)problemElement).getQualifier();
    if (qualifier == null) return null;
    final PyType type = TypeEvalContext.userInitiated(problemElement.getProject(), problemElement.getContainingFile()).getType(qualifier);
    return type instanceof PyClassType ? (PyClassType)type : null;
  }
  final PyClass pyClass = PsiTreeUtil.getParentOfType(problemElement, PyClass.class);
  return pyClass != null ? new PyClassTypeImpl(pyClass, false) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AddMethodQuickFix.java


注:本文中的com.jetbrains.python.psi.types.PyClassTypeImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。