PY-13140 Fix several minor issues found during code review

This commit is contained in:
Mikhail Golubev
2014-07-10 18:26:37 +04:00
parent 99058ce9a0
commit 3674c5e773
3 changed files with 2 additions and 5 deletions
@@ -52,9 +52,7 @@ public class PyStarImportElementImpl extends PyElementImpl implements PyStarImpo
for (PsiElement importedFile : new HashSet<PsiElement>(importedFiles)) { // resolver gives lots of duplicates
final PsiElement source = PyUtil.turnDirIntoInit(importedFile);
if (source instanceof PyFile) {
// PY-13140
Iterable<PyElement> declaredNames = ((PyFile)source).iterateNames();
// Filter out names starting with underscore only if __all__ attribute is not defined in the module
if (((PyFile)source).getDunderAll() == null) {
declaredNames = excludeUnderscoredNames(declaredNames);
}
@@ -70,7 +68,7 @@ public class PyStarImportElementImpl extends PyElementImpl implements PyStarImpo
return Iterables.filter(declaredNames, new Predicate<PyElement>() {
@Override
public boolean apply(@Nullable PyElement input) {
String name = input != null ? input.getName() : null;
final String name = input != null ? input.getName() : null;
if (name != null && name.startsWith("_")) {
return false;
}
@@ -97,7 +95,6 @@ public class PyStarImportElementImpl extends PyElementImpl implements PyStarImpo
final PsiElement result = results != null && !results.isEmpty() ? results.get(0).getElement() : null;
if (result != null) {
final List<String> all = sourceFile.getDunderAll();
// PY-13140
if (all != null ? !all.contains(name) : name.startsWith("_")) {
continue;
}
@@ -618,7 +618,6 @@ public class PythonCompletionTest extends PyTestCase {
// PY-13140
public void testModulePrivateNamesCompletedInsideImport() {
//doMultiFileTest();
myFixture.copyDirectoryToProject("completion/" + getTestName(true), "");
myFixture.configureByFile("a.py");
myFixture.completeBasic();
@@ -366,6 +366,7 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase {
doMultiFileTest();
}
// PY-13140
public void testPrivateModuleNames() {
doMultiFileTest();
}