codemap
codemap copied to clipboard
python: 'from <namespace package> import a, b' links every file in the directory
from <package> import a, b where <package> is a namespace package (a directory with no __init__.py) produces an edge to every .py file in that directory, not just a.py and b.py.
Found by the import-accuracy benchmark (#264): on AUTOMATIC1111/stable-diffusion-webui this one pattern is 19,215 of the repo's 19,240 false positives and pulls held-out Python precision to 0.261. It is the largest accuracy defect the benchmark found.
Repro (codemap 4.7.0):
modules/{a,b,c,d,e}.py
modules/user.py: from modules import a, b
codemap --importers modules/c.py # reports modules/user.py, should be none
Expected: edges to modules/a.py and modules/b.py only (each imported name that is a submodule file).
Part of #240.