Re: [PATCH] kunit: tool: fix type annotation for IO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2023-03-16 at 10:35 -0700, Daniel Latypov wrote:
> On Thu, Mar 16, 2023 at 12:42 AM Johannes Berg
> <johannes@xxxxxxxxxxxxxxxx> wrote:
> > 
> > On Wed, 2023-03-15 at 23:02 -0700, Daniel Latypov wrote:
> > > This is a good catch, thanks.
> > > But we also have a few more bare generic types that warrant attention.
> > 
> > Oh, that might well be true. I was using kunit_parser in a script, and
> > that imports kunit_printer, and then tried to check *my* script for type
> > annotations with mypy. This led it to go check through the dependencies
> > too, and since it was just one small thing there I decided to just fix
> > it rather than figure out how to tell mypy that I don't care about those
> > dependencies :-)
> 
> There's --exclude='<regex>', if you ever end up needing to ignore other files.
> But yeah, we should try and make sure that mpyy is happy w/ kunit.py code.

Yes, but that has other complexities I think? Anyway, I didn't even
really read much into it since it was so easy.

> > Now for everything else? I didn't even look.
> 
> Oh, does mypy complain about this now?
> That'd be nice.
> 
> Hmm, I don't see it even after upgrading my local version.
> $ pip install --upgrade mypy pytype
> $ ../tools/testing/kunit/run_checks.py
> <no errors>
> # Checking if it doesn't report error but logs a warning:
> $ mypy ./tools/testing/kunit/*.py
> Success: no issues found in 9 source files

Oh, I use --strict, and

$ mypy --version
mypy 0.941

right now. Probably old.

And

$ mypy --strict tools/testing/kunit/*.py

has a _lot_ of complaints.

> How I found the rest is Google has a wrapper around pylint, which has
> a number of custom checks. "g-bare-generic" is one of them, which
> complains about these.
> 
> I don't think there's a publicly accessible version of those checks,
> even though the base pylintrc file is...

:)

> https://lore.kernel.org/linux-kselftest/20230316172900.755430-1-dlatypov@xxxxxxxxxx
> 

Great, thanks!

johannes




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux