mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
In a decorator annotated with generic type (ViewFuncT) -> ViewFuncT, the type variable ViewFuncT = TypeVar(…) must be instantiated to the *same* type in both places. This amounts to a claim that the decorator preserves the signature of the view function, which is not the case for decorators that add a user_profile parameter. The corrected annotations enforce no particular relationship between the input and output signatures, which is not the ideal type we might get if mypy supported variadic generics, but is better than enforcing a relationship that is guaranteed to be wrong. This removes a bunch of ‘# type: ignore[call-arg] # mypy doesn't seem to apply the decorator’ annotations. Mypy does apply the decorator, but the decorator’s incorrect annotation as signature-preserving made it appear as if it didn’t. Signed-off-by: Anders Kaseorg <anders@zulip.com>
7.5 KiB
7.5 KiB