mirror of
https://github.com/astral-sh/ruff.git
synced 2026-11-21 12:16:15 +08:00
495 B
495 B
What it does
Checks for accesses of submodules that might not've been imported.
Why is this bad?
When module a has a submodule b, import a isn't generally enough to let you access a.b. You
either need to explicitly import a.b, or else you need the __init__.py file of a to include
from . import b. Without one of those, a.b is an AttributeError.
Examples
import html
# AttributeError: module 'html' has no attribute 'parser'
html.parser # error