boolean (PyExpression target) { if (!(target instanceof PyTargetExpression)) { return false; } final ScopeOwner owner = ScopeUtil.getScopeOwner(target); if (owner instanceof PyFunction method) { if (method.getContainingClass() != null) { if (method.getStub() != null) { return true; } final PyParameter[] params = method.getParameterList().getParameters(); if (params.length > 0) { final PyTargetExpression targetExpr = (PyTargetExpression)target; final PyExpression qualifier = targetExpr.getQualifier(); return qualifier != null && qualifier.getText().equals(params[0].getName()); } } } return false; }