@Nullable
 public QualifiedName asQualifiedName() {
   if (myQualifiedName == null) {
     myQualifiedName = PyPsiUtils.asQualifiedName(this);
   }
   return myQualifiedName;
 }
 @Override
 public Icon getIcon(int flags) {
   PyPsiUtils.assertValid(this);
   final Property property = getProperty();
   if (property != null) {
     if (property.getGetter().valueOrNull() == this) {
       return PythonIcons.Python.PropertyGetter;
     }
     if (property.getSetter().valueOrNull() == this) {
       return PythonIcons.Python.PropertySetter;
     }
     if (property.getDeleter().valueOrNull() == this) {
       return PythonIcons.Python.PropertyDeleter;
     }
     return PlatformIcons.PROPERTY_ICON;
   }
   if (getContainingClass() != null) {
     return PlatformIcons.METHOD_ICON;
   }
   return PythonIcons.Python.Function;
 }
Ejemplo n.º 3
0
 @Nullable
 public static String extractDeprecationMessage(List<PyStatement> statements) {
   for (PyStatement statement : statements) {
     if (statement instanceof PyExpressionStatement) {
       PyExpressionStatement expressionStatement = (PyExpressionStatement) statement;
       if (expressionStatement.getExpression() instanceof PyCallExpression) {
         PyCallExpression callExpression = (PyCallExpression) expressionStatement.getExpression();
         if (callExpression.isCalleeText(PyNames.WARN)) {
           PyReferenceExpression warningClass =
               callExpression.getArgument(1, PyReferenceExpression.class);
           if (warningClass != null
               && (PyNames.DEPRECATION_WARNING.equals(warningClass.getReferencedName())
                   || PyNames.PENDING_DEPRECATION_WARNING.equals(
                       warningClass.getReferencedName()))) {
             return PyPsiUtils.strValue(callExpression.getArguments()[0]);
           }
         }
       }
     }
   }
   return null;
 }