mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Refactored isPackage() checks
This commit is contained in:
@@ -628,6 +628,17 @@ public class PyUtil {
|
||||
return target;
|
||||
}
|
||||
|
||||
public static boolean isPackage(@NotNull PsiDirectory directory) {
|
||||
if (turnDirIntoInit(directory) != null) {
|
||||
return true;
|
||||
}
|
||||
return hasNamespacePackageFile(directory);
|
||||
}
|
||||
|
||||
public static boolean isPackage(@NotNull PsiFile file) {
|
||||
return turnInitIntoDir(file) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts initial underscores of an identifier.
|
||||
*
|
||||
|
||||
@@ -61,7 +61,7 @@ public class PyModuleType implements PyType { // Modules don't descend from obje
|
||||
if (attribute != null) {
|
||||
return ResolveResultList.to(attribute);
|
||||
}
|
||||
if (location != null && isPackage(myModule)) {
|
||||
if (location != null && PyUtil.isPackage(myModule)) {
|
||||
return resolveImplicitPackageMember(name, location);
|
||||
}
|
||||
return null;
|
||||
@@ -128,10 +128,6 @@ public class PyModuleType implements PyType { // Modules don't descend from obje
|
||||
return visibleImports;
|
||||
}
|
||||
|
||||
private static boolean isPackage(@NotNull PyFile file) {
|
||||
return PyUtil.turnInitIntoDir(file) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param directory the module directory
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user