ty: un-ignore invalid-type-form - #15387
Conversation
|
@priya-sundaram-dev, please review. |
priya-sundaram-dev
left a comment
There was a problem hiding this comment.
LGTM — the four annotations that changed are genuinely the correct fix: Image is the module (from PIL import Image), and the actual image type is the Image.Image class, so -> Image.Image is right and -> Image was the invalid-type-form. With those fixed, dropping rules.invalid-type-form = "ignore" is safe and the ty CI check is green on this head, so the rule is now genuinely enforced rather than suppressed.
One small consistency note (non-blocking, fine as a follow-up): the parameter annotations still read image: Image / img: Image, i.e. the same module-vs-class distinction on the input side. ty isn't flagging them today so CI stays green, but tightening those to Image.Image too would make each signature read consistently. Happy either way — the PR as-is achieves its stated goal of un-ignoring the rule with green CI.
Co-authored-by: Christian Clauss <cclauss@me.com>
|
Came to this just after the merge — for the record it looks right to me. Since these files do |
Part of #15187.
Imagehere is the PIL.Image module, not the class, so ty flagged it underinvalid-type-form. Changed the annotations to
Image.Imageinmean_threshold, otsu_threshold, change_brightness and change_contrast, and
removed the rule from the ignore list in pyproject.toml.
Ran ty with the rule enabled and it's clean now. Only annotations changed,
nothing at runtime.
Describe your change
Checklist