mirror of
https://github.com/astral-sh/ruff
synced 2026-01-07 06:34:07 -05:00
## Summary Typeshed has a (fake) `__getattr__` method on `types.ModuleType` with a return type of `Any`. We ignore this method when accessing attributes on module *literals*, but with this PR, we respect this method when dealing with `ModuleType` itself. That is, we allow arbitrary attribute accesses on instances of `types.ModuleType`. This is useful because dynamic import mechanisms such as `importlib.import_module` use `ModuleType` as a return type. closes https://github.com/astral-sh/ty/issues/1346 ## Ecosystem Massive reduction in diagnostics. The few new diagnostics are true positives. ## Test Plan Added regression test.