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

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

 



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.

Thanks for doing this!

>
> 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

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...

Note: I'd like it if kunit/run_checks.py could run pylint.
But the default python style contrasts with kernel style (mainly
around whitespace), so there's a lot of checks we'd need to disable to
get a clean signal.

>
> > I think the diff below [1] should fix the others as well.
> > I can send it out as a formal patch and add your name for the Reported-by?
>
> Sure!

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

Daniel




[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