Python: add comment about namespace packages

This commit is contained in:
Rasmus Lerchedahl Petersen
2023-08-15 12:02:02 +02:00
parent 307f44339c
commit 8f70c9f950

View File

@@ -195,6 +195,14 @@ private predicate isPotentialPackage(Folder f) {
}
private string moduleNameFromBase(Container file) {
// We used to also require `isPotentialPackage(f)` to hold in this case,
// but we saw modules not getting resolved because their folder did not
// contain an `__init__.py` file.
//
// This makes the folder not be a package but a namespace package instead.
//
// It is possible that we can keep the requirement here, but relax
// `isPotentialPackage` itself to allow for namespace packages.
result = file.getBaseName()
or
file instanceof File and result = file.getStem()