An entry of __all__ is not a string, or names nothing the module defines
What it finds
__all__ = ["load", "dump", Loader]: __all__ lists the names that from module import * copies, as strings. An entry that is not a string makes the star import raise TypeError, and a name the module does not define makes it raise AttributeError, often in a user's code rather than in the module's own tests.
Names are looked up among the module's own bindings. A module with a star import, a module-level __getattr__, or a call of globals() can define names this check does not see, so only non-string entries are reported there. So is a package's __init__.py, whose __all__ may list submodules, which a star import loads.
From the rule's source, dunder_all_entry.rs.
from .helpers import helper __all__ = [ "load", "dump", "helper", "missing",tx0 reports: __all__ lists missing, which this module does not define Loader,tx0 reports: Loader in __all__ is not a string, so import * raises TypeError] def load(): pass def dump(): pass class Loader: pass __all__ += ["Loader", "gone"]tx0 reports: __all__ lists gone Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:dunder-all-entry" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:dunder-all-entry] reason="..."tx0 explain tx0/python:dunder-all-entry shows the same in the terminal. Found a false positive? Report it.