python: Clean up getattr, setattr, delattr calls with literal names.

These were useful as a transitional workaround to ignore type errors
that only show up with django-stubs, while avoiding errors about
unused type: ignore comments without django-stubs.  Now that the
django-stubs transition is complete, switch to type: ignore comments
so that mypy will tell us if they become unnecessary.  Many already
have.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2022-10-07 21:10:17 -07:00
committed by Tim Abbott
parent 5e1ebf2861
commit 1385a827c2
17 changed files with 50 additions and 55 deletions

View File

@@ -394,7 +394,7 @@ def instrument_url(f: UrlFuncT) -> UrlFuncT:
info = "<bytes>"
elif isinstance(info, dict):
info = {
k: "<file object>" if hasattr(v, "read") and callable(getattr(v, "read")) else v
k: "<file object>" if hasattr(v, "read") and callable(v.read) else v
for k, v in info.items()
}