mypy
f08d72b7 - Add getattr overload variants to help mypy type inference

Commit
4 years ago
Add getattr overload variants to help mypy type inference These silence errors about missing type annotations for calls like these: ``` x = getattr(o, 'a', []) y = getattr(o, 'b', {}) ``` This is basically a generalization of #5518 and other overloads we already have. This works around python/mypy#11572. I encountered the issue in several places when testing recent typeshed against an internal repo. Manually cherry-picked from python/typeshed#6355.
Author
Parents
Loading