mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-13140 Fix several minor issues found during code review
This commit is contained in:
@@ -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();
|
||||
|
||||
+1
@@ -366,6 +366,7 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase {
|
||||
doMultiFileTest();
|
||||
}
|
||||
|
||||
// PY-13140
|
||||
public void testPrivateModuleNames() {
|
||||
doMultiFileTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user