ruff/crates/ty_python_semantic/resources/mdtest/scopes
David Peter 6a26f86778
[ty] Make __getattr__ available for ModuleType instances (#21450)
## 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.
2025-11-14 13:59:14 +01:00
..
annotate_global.md [pyflakes] Fix false positives for __annotate__ (Py3.14+) and __warningregistry__ (F821) (#20154) 2025-09-23 08:16:00 -04:00
builtin.md [ty] No union with Unknown for module-global symbols (#20664) 2025-10-01 16:40:30 +02:00
eager.md [ty] No union with Unknown for module-global symbols (#20664) 2025-10-01 16:40:30 +02:00
global-constants.md [ty] Add support for global __debug__ constant (#18540) 2025-06-10 06:48:59 +00:00
global.md [ty] No union with Unknown for module-global symbols (#20664) 2025-10-01 16:40:30 +02:00
moduletype_attrs.md [ty] Make __getattr__ available for ModuleType instances (#21450) 2025-11-14 13:59:14 +01:00
nonlocal.md [ty] improve lazy scope place lookup (#19321) 2025-07-25 07:11:11 +00:00
unbound.md [ty] Improve error messages for unresolved attribute diagnostics (#20963) 2025-10-19 10:58:25 +01:00