All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Vincent Fazio <vfazio@xes-inc.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH libgpiod] bindings: python: provide fileno() for Chip and LineRequest
Date: Tue, 10 Dec 2024 22:58:55 +0800	[thread overview]
Message-ID: <20241210145855.GA211178@rigel> (raw)
In-Reply-To: <CAMRc=McLjp8J_jWqZcN-rGvc8aKqEyjZQj5kGxQ4zkJNnFJVBw@mail.gmail.com>

On Tue, Dec 10, 2024 at 03:21:29PM +0100, Bartosz Golaszewski wrote:
> On Tue, Dec 10, 2024 at 3:17 PM Vincent Fazio <vfazio@xes-inc.com> wrote:
> >
> > >
> > > @@ -131,6 +132,23 @@ class WatchingInfoEventWorks(TestCase):
> > >          self.assertGreater(ts_rel, ts_rec)
> > >          self.assertGreater(ts_rec, ts_req)
> > >
> > > +    def test_select_chip_object(self):
> >
> > Nit:
> >
> > def test_select_chip_object(self) -> None:
> >
> > These fail `mypy --strict` otherwise. These are optional checks so I'll leave it up to you to decide if you want to implement them.
> >
>
> Ah! This is why I didn't see it, I missed the --strict switch. Thanks.
>
> On an unrelated note: mypy --strict is giving me this:
>
> bindings/python/gpiod/line.py:19: error: Non-overlapping equality
> check (left operand type: "Value", right operand type: "int")
> [comparison-overlap]
>
> for:
>
> 18     def __bool__(self) -> bool:
> 19         return self == self.ACTIVE
>
> How do I fix it?
>

How about this:

    def __bool__(self) -> bool:
        return self.value == _ext.VALUE_ACTIVE

?

Granted that is a workaround and your original code should be fine, but
it does get rid of the warning...

Cheers,
Kent.


  reply	other threads:[~2024-12-10 14:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 14:15 [PATCH libgpiod] bindings: python: provide fileno() for Chip and LineRequest Vincent Fazio
2024-12-10 14:21 ` Bartosz Golaszewski
2024-12-10 14:58   ` Kent Gibson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-10 14:26 Vincent Fazio
2024-12-10 15:02 ` Vincent Fazio
2024-12-10 15:28   ` Bartosz Golaszewski
2024-12-10 10:26 Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241210145855.GA211178@rigel \
    --to=warthog618@gmail.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=vfazio@xes-inc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.