AccessDirection (PyElement element) { final PsiElement parent = element.getParent(); if (element instanceof PyTargetExpression) { return WRITE; } else if (parent instanceof PyAssignmentStatement) { for (PyExpression target : ((PyAssignmentStatement)parent).getTargets()) { if (target == element) { return WRITE; } } } else if (parent instanceof PyDelStatement) { return DELETE; } return READ; }