ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Handle single element cases in PYI016

Open tusharsadhwani opened this issue 1 year ago • 1 comments

Summary

For code like:

from typing import Union
x: Union[int, Union[int]]

PYI016 was not being raised, since the iterator was only matching on Tuples inside the Union[].

Same as https://github.com/PyCQA/flake8-pyi/issues/484

Test Plan

cargo test

tusharsadhwani avatar May 03 '24 21:05 tusharsadhwani

Seems to have broken PYI055 pretty severely. The PYI041 failure seems like a false positive though!

tusharsadhwani avatar May 03 '24 21:05 tusharsadhwani

Hi @tusharsadhwani. Could you help me understand what's left to do for this PR and if you plan to work on it?

MichaReiser avatar Sep 08 '24 18:09 MichaReiser

Hey, from what I remember adding this test case and the implementation for it ended up breaking other lints, and I never got around to figuring out why the other lints broke.

tusharsadhwani avatar Sep 08 '24 18:09 tusharsadhwani

Thanks. Are you okay with me closing the PR or do you plan to look into this in the future?

MichaReiser avatar Sep 08 '24 19:09 MichaReiser

It ended up being troublesome in the original flake8-pyi project as well, probably best to close it for now.

tusharsadhwani avatar Sep 08 '24 19:09 tusharsadhwani

Thanks for the quick reply and for exploring an implementation of this rule.

MichaReiser avatar Sep 08 '24 19:09 MichaReiser